mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 06:39:01 +01:00
Provide login endpoint
This commit is contained in:
parent
00fa47ae64
commit
baf51da94b
@ -140,7 +140,6 @@
|
||||
"plugins_do_not_use_require": "به دلایل عملکردی و اجرایی، پلاگینها فقط میتوانند فایل های دیگر را که در پوشه پلاگین هاست با استفاده از راهاندازی بارگذار خودکار PSR-4، به صورت خودکار include یا require کنند (بدون require کردن دستی آنها).",
|
||||
"static_analysis_minor": "یک مشکل جزئی در طول بررسی استاتیک %s رخ داد: %s",
|
||||
"static_analysis_severe": "یک مشکل سمت سرور در طول بررسی استاتیک %s رخ داد: %s",
|
||||
"invalid_dl.php": "%s یک اسکریپت دانلود معتبر نیست. (%s)",
|
||||
"cli_need_dl.php_link": "لطفا هنگام استفاده از getDownloadLink روی CLI (محیط ترمینال)، لینک اسکریپت دانلود را مشخص کنید!",
|
||||
"need_dl.php": "اسکریپت دانلود پیشفرض تولید نشد (%s)، لطفا یک فایل dl.php بسیازید و این محتوا را در آن قرار دهید: %s سپس لینک آن فایل را به ورودی دوم getDownloadLink بدهید",
|
||||
"dl.php_powered_by_madelineproto": "سرور دانلود فایل تلگرام (تا حداکثر 4 گیگابایت)، قدرت گرفته از <a href=\"https://docs.madelineproto.xyz\" target=\"_blank\">مدلینپروتو</a>!<br>برای اطلاعات بیشتر در مورد طریقه اجرای سرور دانلود تلگرام شخصی خود <a href=\"https://docs.madelineproto.xyz/docs/FILES.html#getting-a-download-link\" target=\"_blank\">اینجا</a> کلیک کنید!"
|
||||
|
@ -142,7 +142,6 @@
|
||||
"plugins_must_have_exactly_one_class": "un plugin deve definire esattamente una classe! Per definire più classi, interfacce o trait, si prega di creare file separati, che verranno caricati da MadelineProto automaticamente.",
|
||||
"plugins_do_not_use_require": "per motivi di performance, i plugin possono solo includere altri file presenti nella cartella plugins usando il meccanismo di autocaricamento PSR-4 (non usando require o include).",
|
||||
"cli_need_dl.php_link": "È necessario specificare l'URL dello script di scaricamente per usare getDownloadLink via CLI!",
|
||||
"invalid_dl.php": "%s non è uno script di scaricamento valido (%s)",
|
||||
"need_dl.php": "Impossibile generare lo script di scaricamento di default (%s), è necessario creare un file dl.php con il seguente contenuto: %s e passare il suo URL al secondo parametro di getDownloadLink",
|
||||
"dl.php_powered_by_madelineproto": "Server di scaricamento file Telegram (fino a 4GB), creato usando <a href=\"https://docs.madelineproto.xyz\" target=\"_blank\">MadelineProto</a>!<br>Clicca <a href=\"https://docs.madelineproto.xyz/docs/FILES.html#getting-a-download-link\" target=\"_blank\">qui</a> per configurare il tuo personale server di scaricamento file Telegram!"
|
||||
}
|
||||
|
@ -94,6 +94,15 @@ abstract class AbstractMessage extends Update implements SimpleFilters
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current message replies to another message.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isReply(): bool
|
||||
{
|
||||
return $this->replyToMsgId !== null;
|
||||
}
|
||||
/**
|
||||
* Get replied-to message.
|
||||
*
|
||||
|
72
src/Lang.php
72
src/Lang.php
@ -25,6 +25,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'چاوەڕێی پاسۆردەکە ناکەم! تکایە سەرەتا پەیوەندی بە phoneLogin و شێوازەکانی completePhoneLogin بکەن!',
|
||||
'accepting_call' => 'وەرگرتنی پەیوەندی لە %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'ئەم نموونەیەی MadelineProto پێشتر چووەتە ژوورەوە!',
|
||||
'apiAppInstructionsAuto0' => 'ناوی ئەپەکە بنووسە، دەتوانێت هەر شتێک بێت: ',
|
||||
'apiAppInstructionsAuto1' => 'ناوی کورتی ئەپەکە بنووسە، ئەلفوبێی ژمارەیی، ٥-٣٢ پیت: ',
|
||||
@ -86,7 +92,7 @@ final class Lang
|
||||
'file_type_invalid' => 'جۆری پەڕگەی نادروست دۆزراوەتەوە (%s)',
|
||||
'fingerprint_invalid' => 'پەنجەمۆری کلیل نادروستە!',
|
||||
'go' => 'بڕۆ',
|
||||
'invalid_dl.php' => '%s is not a valid download script (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'درێژی زۆر گەورەیە',
|
||||
'loginBot' => 'تۆکنی بۆتەکەت بنووسە: ',
|
||||
'loginBotTokenWeb' => 'بۆت تۆکن',
|
||||
@ -174,6 +180,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phoneLogin and the completePhoneLogin methods first!',
|
||||
'accepting_call' => 'Accepting call from %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'This instance of MadelineProto is already logged in!',
|
||||
'apiAppInstructionsAuto0' => 'Enter the app\'s name, can be anything: ',
|
||||
'apiAppInstructionsAuto1' => 'Enter the app\'s short name, alphanumeric, 5-32 characters: ',
|
||||
@ -235,7 +247,7 @@ final class Lang
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'go' => 'Go',
|
||||
'invalid_dl.php' => '%s is not a valid download script (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'loginBot' => 'Enter your bot token: ',
|
||||
'loginBotTokenWeb' => 'Bot token',
|
||||
@ -323,6 +335,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'من منتظر کلمه عبور نیستم! لطفا اول توابع phoneLogin و completePhoneLogin را صدا بزنید!',
|
||||
'accepting_call' => 'در حال پذیرش تماس از طرف %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'نمونهی MadelineProto از قبل وارد شده!',
|
||||
'apiAppInstructionsAuto0' => 'نام برنامه خود را وارد کنید، میتواند هرچیزی باشد ',
|
||||
'apiAppInstructionsAuto1' => 'نام مخفف برنامهتان را وارد کنید، 5 تا 32 کاراکتر الفبا اعداد: ',
|
||||
@ -384,7 +402,7 @@ final class Lang
|
||||
'file_type_invalid' => 'نوع فایل نامعتبر شناسایی شد (%s)',
|
||||
'fingerprint_invalid' => 'اثرانگشت کلید نامعتبر است!',
|
||||
'go' => 'برو',
|
||||
'invalid_dl.php' => '%s یک اسکریپت دانلود معتبر نیست. (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'طول بسیار بزرگ است',
|
||||
'loginBot' => 'توکن رباتتان را وارد کنید: ',
|
||||
'loginBotTokenWeb' => 'توکن ربات',
|
||||
@ -472,6 +490,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phoneLogin and the completePhoneLogin methods first!',
|
||||
'accepting_call' => 'Acceptation de l\'appel de %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'Cette instance de MadelineProto est déjà connectée!',
|
||||
'apiAppInstructionsAuto0' => 'Enter the app\'s name, can be anything: ',
|
||||
'apiAppInstructionsAuto1' => 'Enter the app\'s short name, alphanumeric, 5-32 characters: ',
|
||||
@ -533,7 +557,7 @@ final class Lang
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'go' => 'Go',
|
||||
'invalid_dl.php' => '%s is not a valid download script (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'loginBot' => 'Enter your bot token: ',
|
||||
'loginBotTokenWeb' => 'Bot token',
|
||||
@ -621,6 +645,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'אני לא מחכה לסיסמא! עליך להשתמש בפונקציות phoneLogin ו- completePhoneLogin קודם!',
|
||||
'accepting_call' => 'מקבל שיחה מ %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'מופע זה של MadelineProto כבר מחובר!',
|
||||
'apiAppInstructionsAuto0' => 'הזן את שם האפליקציה שלך, יכול להיות כל שם: ',
|
||||
'apiAppInstructionsAuto1' => 'הזן שם קצר לאפליקציה שלך, אותיות באנגלית בלבד, 5-32 תווים: ',
|
||||
@ -682,7 +712,7 @@ final class Lang
|
||||
'file_type_invalid' => 'זוהה סוג קובץ לא חוקי (%s)',
|
||||
'fingerprint_invalid' => 'טביעת אצבע לא חוקית של מפתח!',
|
||||
'go' => 'קדימה',
|
||||
'invalid_dl.php' => '%s is not a valid download script (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'האורך גדול מדי',
|
||||
'loginBot' => 'הזן את הטוקן של הבוט שלך: ',
|
||||
'loginBotTokenWeb' => 'טוקן הבוט',
|
||||
@ -770,6 +800,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'Non sto aspettando la password, chiama prima le funzioni phoneLogin e completePhoneLogin!',
|
||||
'accepting_call' => 'Sto accettando una chiamata da %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'Questa istanza di MadelineProto è già loggata!',
|
||||
'apiAppInstructionsAuto0' => 'Inserisci il nome dell\'app, può essere qualsiasi cosa: ',
|
||||
'apiAppInstructionsAuto1' => 'Inserisci il nome ridotto dell\'app, caratteri alfanumerici: ',
|
||||
@ -831,7 +867,7 @@ final class Lang
|
||||
'file_type_invalid' => 'È stato fornito un tipo file errato',
|
||||
'fingerprint_invalid' => 'fingerprint della chiave non valido!',
|
||||
'go' => 'Vai',
|
||||
'invalid_dl.php' => '%s non è uno script di scaricamento valido (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'Il valore fornito è troppo lungo',
|
||||
'loginBot' => 'Inserisci il tuo bot token: ',
|
||||
'loginBotTokenWeb' => 'Token del bot',
|
||||
@ -919,6 +955,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phoneLogin and the completePhoneLogin methods first!',
|
||||
'accepting_call' => 'Accepting call from %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'This instance of MadelineProto is already logged in!',
|
||||
'apiAppInstructionsAuto0' => 'Введите имя приложения, может быть что угодно: ',
|
||||
'apiAppInstructionsAuto1' => 'Введите короткое имя вашего приложения, латиница и цифры, 5-32 букв: ',
|
||||
@ -980,7 +1022,7 @@ final class Lang
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'go' => 'ОК',
|
||||
'invalid_dl.php' => '%s is not a valid download script (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'loginBot' => 'Введите токен бота: ',
|
||||
'loginBotTokenWeb' => 'Токен бота',
|
||||
@ -1068,6 +1110,12 @@ final class Lang
|
||||
[
|
||||
'2fa_uncalled' => 'Men parolni kutmayapman! Iltimos, birinchi navbatda phoneLogin va completePhoneLogin metodlarini ishga tushuring!',
|
||||
'accepting_call' => '%s qo‘ng‘irog‘i qabul qilinmoqda...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'MadelineProto-ning bu nusxasi allaqachon tizimga kirgan!',
|
||||
'apiAppInstructionsAuto0' => 'Ilovangiz nomini kiriting: ',
|
||||
'apiAppInstructionsAuto1' => 'Ilovani qisqacha nomini kiriting, harflar va raqamlardan iborat 5-32 belgilar orasida ',
|
||||
@ -1129,7 +1177,7 @@ final class Lang
|
||||
'file_type_invalid' => 'Yaroqsiz fayl turi aniqlandi (%s)',
|
||||
'fingerprint_invalid' => 'Barmoq izi yaroqsiz!',
|
||||
'go' => 'Boshlash',
|
||||
'invalid_dl.php' => '%s is not a valid download script (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'Uzunlik juda katta',
|
||||
'loginBot' => 'Bot tokeningizni kiriting ',
|
||||
'loginBotTokenWeb' => 'Bot tokeni',
|
||||
@ -1219,6 +1267,12 @@ final class Lang
|
||||
public static array $current_lang = [
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phoneLogin and the completePhoneLogin methods first!',
|
||||
'accepting_call' => 'Accepting call from %s...',
|
||||
'account_banned' => '!!!!!!! WARNING !!!!!!!
|
||||
Telegram\'s flood prevention system suspended this account.
|
||||
To continue, manual verification is required.
|
||||
Send an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.
|
||||
Then login again.
|
||||
If you intentionally deleted this account, ignore this message.',
|
||||
'already_loggedIn' => 'This instance of MadelineProto is already logged in!',
|
||||
'apiAppInstructionsAuto0' => 'Enter the app\'s name, can be anything: ',
|
||||
'apiAppInstructionsAuto1' => 'Enter the app\'s short name, alphanumeric, 5-32 characters: ',
|
||||
@ -1280,7 +1334,7 @@ final class Lang
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'go' => 'Go',
|
||||
'invalid_dl.php' => '%s is not a valid download script (%s)',
|
||||
'invalid_dl.php_session' => '%s is not a valid download script because its session ID is different (expected %s, got %s)',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'loginBot' => 'Enter your bot token: ',
|
||||
'loginBotTokenWeb' => 'Bot token',
|
||||
|
@ -324,7 +324,7 @@ trait ResponseHandler
|
||||
$this->logger->logger($response['error_message'], Logger::FATAL_ERROR);
|
||||
if (\in_array($response['error_message'], ['USER_DEACTIVATED', 'USER_DEACTIVATED_BAN'], true)) {
|
||||
$phone = isset($this->API->authorization['user']['phone']) ? '+' . $this->API->authorization['user']['phone'] : '???';
|
||||
$this->logger->logger(sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
|
||||
$this->logger->logger(\sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
|
||||
}
|
||||
return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor());
|
||||
case 'AUTH_KEY_UNREGISTERED':
|
||||
@ -344,7 +344,7 @@ trait ResponseHandler
|
||||
if ($this->API->authorized_dc == $this->datacenter && $this->API->authorized === \danog\MadelineProto\API::LOGGED_IN) {
|
||||
$this->logger->logger('Permanent auth key was main authorized key, logging out...', Logger::FATAL_ERROR);
|
||||
$phone = isset($this->API->authorization['user']['phone']) ? '+' . $this->API->authorization['user']['phone'] : 'you are currently using';
|
||||
$this->logger->logger(sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
|
||||
$this->logger->logger(\sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
|
||||
return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor());
|
||||
}
|
||||
EventLoop::queue(function () use ($request): void {
|
||||
|
@ -46,10 +46,11 @@ trait FileServer
|
||||
*/
|
||||
public static function downloadServer(string $session): void
|
||||
{
|
||||
if (isset($_GET['ping'])) {
|
||||
if (isset($_GET['login'])) {
|
||||
$API = new API($session);
|
||||
$API->start();
|
||||
$id = (string) $API->getSelf()['id'];
|
||||
header("Content-length: ".strlen($id));
|
||||
\header("Content-length: ".\strlen($id));
|
||||
echo $id;
|
||||
die;
|
||||
}
|
||||
@ -210,7 +211,7 @@ trait FileServer
|
||||
if (isset(self::$checkedScripts[$scriptUrl])) {
|
||||
return;
|
||||
}
|
||||
$scriptUrlNew = $scriptUrl.'?'.\http_build_query(['ping' => 1]);
|
||||
$scriptUrlNew = $scriptUrl.'?'.\http_build_query(['login' => 1]);
|
||||
$this->logger->logger("Checking $scriptUrlNew...");
|
||||
$result = $this->fileGetContents($scriptUrlNew);
|
||||
$expected = (string) $this->getSelf()['id'];
|
||||
|
@ -534,7 +534,7 @@ trait Files
|
||||
}
|
||||
$info = $info[$method];
|
||||
if ($method === 'photo') {
|
||||
$info = array_values($info);
|
||||
$info = \array_values($info);
|
||||
$cur = $info[0];
|
||||
foreach ($info as $n) {
|
||||
if ($n['width'] * $n['height'] > $cur['width'] * $cur['height']) {
|
||||
|
Loading…
Reference in New Issue
Block a user