1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 01:14:39 +01:00

Merge branch 'v8' into v8

This commit is contained in:
Mahdi 2023-07-25 20:39:29 +03:30 committed by GitHub
commit 093cc383c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 18 deletions

View File

@ -105,8 +105,8 @@ abstract class AbstractMessage extends Update implements SimpleFilters
return $this->replyToMsgId !== null;
}
private readonly ?self $replyCache;
private bool $replyCached = false;
protected readonly ?self $replyCache;
protected bool $replyCached = false;
/**
* Get replied-to message.
*

View File

@ -266,6 +266,7 @@ abstract class Message extends AbstractMessage
private readonly string $html;
private readonly string $htmlTelegram;
private readonly ?array $entities;
/**
* Get an HTML version of the message.
*

View File

@ -2,14 +2,16 @@
namespace danog\MadelineProto\Ipc;
use danog\MadelineProto\MTProto;
/**
* Plugin event handler proxy object, for use through the IPC API.
*/
final class EventHandlerProxy extends IpcCapable
{
public function __construct(
private readonly ?string $__plugin,
Client $API
protected readonly ?string $__plugin,
MTProto $API
) {
parent::__construct($API);
}

View File

@ -73,6 +73,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => 'نەتوانرا پەیوەندی %s بدۆزرێتەوە و تەواو بکات',
'cli_need_dl.php_link' => 'Please specify a download script URL when using getDownloadLink via CLI!',
'constructor_not_found' => 'Constructor نەدۆزرایەوە بۆ جۆری: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Could not convert object of type %s',
'deserialization_error' => 'هەڵەیەک لە کاتی ڕیزبەندیکردندا ڕوویدا',
'dl.php_check_logs_make_sure_session_running' => 'Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!',
@ -235,6 +236,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => 'Could not find and complete call %s',
'cli_need_dl.php_link' => 'Please specify a download script URL when using getDownloadLink via CLI!',
'constructor_not_found' => 'Constructor not found for type: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Could not convert object of type %s',
'deserialization_error' => 'An error occurred on deserialization',
'dl.php_check_logs_make_sure_session_running' => 'Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!',
@ -397,6 +399,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => 'نمیتوان تماس %s را یافت و کامل کرد',
'cli_need_dl.php_link' => 'لطفا هنگام استفاده از getDownloadLink روی CLI (محیط ترمینال)، لینک اسکریپت دانلود را مشخص کنید!',
'constructor_not_found' => 'سازنده برای این نوع پیدا نشد: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'نمیتوان مقدار آبجکت تایپ %s را تبدیل کرد',
'deserialization_error' => 'مشکلی در سریال‌زدایی پیش آمد',
'dl.php_check_logs_make_sure_session_running' => 'هم ربات ایونت‌هندلر مدلین‌پروتو مرتبط و هم سرور IPC مدلین‌پروتو آفلاین هستند، لطفا لاگ‌ها را بررسی کنید و مطمئن شوید حداقل یکی از آنها در حال اجراست!',
@ -559,6 +562,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => 'Impossible de trouver et de terminer l\'appel %s',
'cli_need_dl.php_link' => 'Please specify a download script URL when using getDownloadLink via CLI!',
'constructor_not_found' => 'Constructor not found for type: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Could not convert object of type %s',
'deserialization_error' => 'Une erreur s\'est produite lors de la désérialisation',
'dl.php_check_logs_make_sure_session_running' => 'Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!',
@ -721,6 +725,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => 'לא ניתן היה למצוא ולהשלים את השיחה %s',
'cli_need_dl.php_link' => 'Please specify a download script URL when using getDownloadLink via CLI!',
'constructor_not_found' => 'הבנאי לא נמצא לסוג: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Could not convert object of type %s',
'deserialization_error' => 'אירעה שגיאה בעת דה-סידריאליזציה',
'dl.php_check_logs_make_sure_session_running' => 'Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!',
@ -883,6 +888,7 @@ Ignorare questo messaggio se la sessione è stata resettata intenzionalmente.',
'call_error_3' => 'Impossibile trovare e completare la chiamata %s',
'cli_need_dl.php_link' => 'È necessario specificare l\'URL dello script di scaricamente per usare getDownloadLink via CLI!',
'constructor_not_found' => 'Costruttore non trovato per tipo: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Non è stato possibile convertire l\'oggetto di tipo %s',
'deserialization_error' => 'C\'è stato un errore durante la deserializzazione',
'dl.php_check_logs_make_sure_session_running' => 'Sia l\'event handler associato al bot che il server IPC della sessione sono offline, controllare i log e assicurarsi che almeno uno dei due sia online!',
@ -1045,6 +1051,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => 'Could not find and complete call %s',
'cli_need_dl.php_link' => 'Please specify a download script URL when using getDownloadLink via CLI!',
'constructor_not_found' => 'Constructor not found for type: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Could not convert object of type %s',
'deserialization_error' => 'An error occurred on deserialization',
'dl.php_check_logs_make_sure_session_running' => 'Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!',
@ -1207,6 +1214,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => '%s qongirogini topib bolmadi',
'cli_need_dl.php_link' => 'Please specify a download script URL when using getDownloadLink via CLI!',
'constructor_not_found' => 'Ushbu tur uchun konstruktor topilmadi: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Could not convert object of type %s',
'deserialization_error' => 'Seriyadan chiqarishda xatolik yuz berdi',
'dl.php_check_logs_make_sure_session_running' => 'Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!',
@ -1371,6 +1379,7 @@ If you intentionally deleted this account, ignore this message.',
'call_error_3' => 'Could not find and complete call %s',
'cli_need_dl.php_link' => 'Please specify a download script URL when using getDownloadLink via CLI!',
'constructor_not_found' => 'Constructor not found for type: ',
'could_not_connect_to_MadelineProto' => 'Could not connect to MadelineProto, please enable proc_open or disable webserver path rewrites to fix!',
'could_not_convert_object' => 'Could not convert object of type %s',
'deserialization_error' => 'An error occurred on deserialization',
'dl.php_check_logs_make_sure_session_running' => 'Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!',

View File

@ -192,7 +192,7 @@ final class PasswordCalculator
$g_x = $g->powMod($x, $p);
$k = new BigInteger(\hash('sha256', $pForHash.$gForHash, true), 256);
$kg_x = $k->multiply($g_x)->powMod(Magic::$one, $p);
$a = new BigInteger(Tools::random(2048 / 8), 256);
$a = new BigInteger(Tools::random(256), 256);
$A = $g->powMod($a, $p);
Crypt::checkG($A, $p);
$AForHash = \str_pad($A->toBytes(), 256, \chr(0), STR_PAD_LEFT);

View File

@ -39,16 +39,16 @@ final class Button extends IpcCapable implements JsonSerializable, ArrayAccess
*
* @var array<array-key, mixed>
*/
private array $button = [];
protected array $button = [];
/**
* Message ID.
*/
private int $id;
protected int $id;
/**
* Peer ID.
*
*/
private array|int $peer;
protected array|int $peer;
/**
* Constructor function.
*
@ -95,15 +95,6 @@ final class Button extends IpcCapable implements JsonSerializable, ArrayAccess
return $this->getClient()->clickInternal($donotwait, 'messages.getBotCallbackAnswer', ['peer' => $this->peer, 'msg_id' => $this->id, 'game' => true]);
}
}
/**
* Get debug info.
*/
public function __debugInfo(): array
{
$res = \get_object_vars($this);
unset($res['API']);
return $res;
}
/**
* Serialize button.
*/

View File

@ -308,7 +308,16 @@ trait Login
throw new Exception(Lang::$current_lang['2fa_uncalled']);
}
$this->logger->logger(Lang::$current_lang['login_user'], Logger::NOTICE);
return $this->processAuthorization($this->methodCallAsyncRead('auth.checkPassword', ['password' => $password]));
try {
$res = $this->methodCallAsyncRead('auth.checkPassword', ['password' => $password]);
} catch (RPCErrorException $e) {
if ($e->rpc === 'PASSWORD_HASH_INVALID') {
$res = $this->methodCallAsyncRead('auth.checkPassword', ['password' => $password]);
} else {
throw $e;
}
}
return $this->processAuthorization($res);
}
private function processAuthorization(array $authorization): array
{