1
0
mirror of https://github.com/danog/telerpc.git synced 2024-11-26 12:04:47 +01:00
This commit is contained in:
Daniil Gentili 2023-04-18 21:11:26 +02:00
parent 70102ec947
commit 8a69e9af2d
4 changed files with 10 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# RPC database
API for reporting Telegram MTProto RPC errors, main endpoint @ `https://rpc.pwrtelegram.xyz`.
API for reporting Telegram MTProto RPC errors, to report a new error use the `code`, `method` and `error` GET/POST parameters to the main endpoint @ `https://rpc.pwrtelegram.xyz`.
For localized descriptions, see [rpc-db](https://github.com/danog/rpc-db).

2
data

@ -1 +1 @@
Subproject commit 36cb88c2f1f525bf96769105219bd9bd2bc5050b
Subproject commit 91d0019468103111cb1f879335af8a76d88539c8

View File

@ -1,5 +1,7 @@
<?php
chdir(__DIR__);
include 'src/Main.php';
(new Main())->run();

View File

@ -9,7 +9,7 @@ final class Main
if ($this->pdo !== null) {
return $this->pdo;
}
$this->pdo = include 'db.php';
$this->pdo = include __DIR__.'/../db.php';
$this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@ -28,9 +28,10 @@ final class Main
private static function isBad(string $error, int $code): bool
{
return \in_array($error, ['PEER_FLOOD', 'INPUT_CONSTRUCTOR_INVALID_X', 'USER_DEACTIVATED_BAN', 'INPUT_METHOD_INVALID', 'INPUT_FETCH_ERROR', 'AUTH_KEY_UNREGISTERED', 'SESSION_REVOKED', 'USER_DEACTIVATED', 'RPC_CALL_FAIL', 'RPC_MCGET_FAIL', 'INTERDC_5_CALL_ERROR', 'INTERDC_4_CALL_ERROR', 'INTERDC_3_CALL_ERROR', 'INTERDC_2_CALL_ERROR', 'INTERDC_1_CALL_ERROR', 'INTERDC_5_CALL_RICH_ERROR', 'INTERDC_4_CALL_RICH_ERROR', 'INTERDC_3_CALL_RICH_ERROR', 'INTERDC_2_CALL_RICH_ERROR', 'INTERDC_1_CALL_RICH_ERROR', 'AUTH_KEY_DUPLICATED', 'CONNECTION_NOT_INITED', 'LOCATION_NOT_AVAILABLE', 'AUTH_KEY_INVALID', 'LANG_CODE_EMPTY', 'memory limit exit', 'memory limit(?)', 'INPUT_REQUEST_TOO_LONG', 'SESSION_PASSWORD_NEEDED', 'INPUT_FETCH_FAIL',
return \in_array($error, ['PEER_FLOOD', 'INPUT_CONSTRUCTOR_INVALID_X', 'USER_DEACTIVATED_BAN', 'INPUT_METHOD_INVALID', 'INPUT_FETCH_ERROR', 'AUTH_KEY_UNREGISTERED', 'SESSION_REVOKED', 'USER_DEACTIVATED', 'RPC_SEND_FAIL', 'RPC_CALL_FAIL', 'RPC_MCGET_FAIL', 'INTERDC_5_CALL_ERROR', 'INTERDC_4_CALL_ERROR', 'INTERDC_3_CALL_ERROR', 'INTERDC_2_CALL_ERROR', 'INTERDC_1_CALL_ERROR', 'INTERDC_5_CALL_RICH_ERROR', 'INTERDC_4_CALL_RICH_ERROR', 'INTERDC_3_CALL_RICH_ERROR', 'INTERDC_2_CALL_RICH_ERROR', 'INTERDC_1_CALL_RICH_ERROR', 'AUTH_KEY_DUPLICATED', 'CONNECTION_NOT_INITED', 'LOCATION_NOT_AVAILABLE', 'AUTH_KEY_INVALID', 'LANG_CODE_EMPTY', 'memory limit exit', 'memory limit(?)', 'INPUT_REQUEST_TOO_LONG', 'SESSION_PASSWORD_NEEDED', 'INPUT_FETCH_FAIL',
'CONNECTION_SYSTEM_EMPTY',
'CHAT_FROM_CALL_CHANGED',
'BOT_POLLS_DISABLED', 'TEMPNAM_FAILED', 'MSG_WAIT_TIMEOUT',
'CHAT_FROM_CALL_CHANGED', 'MTPROTO_CLUSTER_INVALID',
'CONNECTION_DEVICE_MODEL_EMPTY', 'AUTH_KEY_PERM_EMPTY', 'UNKNOWN_METHOD', 'ENCRYPTION_OCCUPY_FAILED', 'ENCRYPTION_OCCUPY_ADMIN_FAILED', 'CHAT_OCCUPY_USERNAME_FAILED', 'REG_ID_GENERATE_FAILED',
'CONNECTION_LANG_PACK_INVALID', 'MSGID_DECREASE_RETRY', 'API_CALL_ERROR', 'STORAGE_CHECK_FAILED', 'INPUT_LAYER_INVALID', 'NEED_MEMBER_INVALID', 'NEED_CHAT_INVALID', 'HISTORY_GET_FAILED', 'CHP_CALL_FAIL', 'IMAGE_ENGINE_DOWN', 'MSG_RANGE_UNSYNC', 'PTS_CHANGE_EMPTY',
'CONNECTION_SYSTEM_LANG_CODE_EMPTY', 'WORKER_BUSY_TOO_LONG_RETRY', 'WP_ID_GENERATE_FAILED', 'ARR_CAS_FAILED', 'CHANNEL_ADD_INVALID', 'CHANNEL_ADMINS_INVALID', 'CHAT_OCCUPY_LOC_FAILED', 'GROUPED_ID_OCCUPY_FAILED', 'GROUPED_ID_OCCUPY_FAULED', 'LOG_WRAP_FAIL', 'MEMBER_FETCH_FAILED', 'MEMBER_OCCUPY_PRIMARY_LOC_FAILED', 'MEMBER_FETCH_FAILED', 'MEMBER_NO_LOCATION', 'MEMBER_OCCUPY_USERNAME_FAILED', 'MT_SEND_QUEUE_TOO_LONG', 'POSTPONED_TIMEOUT', 'RPC_CONNECT_FAILED', 'SHORTNAME_OCCUPY_FAILED', 'STORE_INVALID_OBJECT_TYPE', 'STORE_INVALID_SCALAR_TYPE', 'TMSG_ADD_FAILED', 'UNKNOWN_ERROR', 'UPLOAD_NO_VOLUME', 'USER_NOT_AVAILABLE', 'VOLUME_LOC_NOT_FOUND', ])
@ -39,6 +40,7 @@ final class Main
|| \str_contains($error, '_MIGRATE_')
|| \str_contains($error, 'INPUT_METHOD_INVALID')
|| \str_contains($error, 'INPUT_CONSTRUCTOR_INVALID')
|| \str_contains($error, 'https://telegram.org/dl')
|| \str_starts_with($error, 'Received bad_msg_notification')
|| \str_starts_with($error, 'No workers running')
|| \str_starts_with($error, 'All workers are busy. Active_queries ')
@ -269,6 +271,7 @@ final class Main
&& \is_numeric($_REQUEST['code'])
&& !self::isBad($_REQUEST['error'], (int) $_REQUEST['code'])
&& !($_REQUEST['error'] === 'Timeout' && !\in_array(\strtolower($_REQUEST['method']), ['messages.getbotcallbackanswer', 'messages.getinlinebotresults']))
&& !($_REQUEST['error'] === 'BOT_MISSING' && \in_array($_REQUEST['method'], ['stickers.changeStickerPosition', 'stickers.createStickerSet', 'messages.uploadMedia']))
) {
$error = self::sanitize($_REQUEST['error']);
$method = $_REQUEST['method'];