diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bc5c0059..c81eb4210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Added ability to view "Watching topics" of other people's (For admins only) [\#1336](https://github.com/torrentpier/torrentpier/pull/1336) ([belomaxorka](https://github.com/belomaxorka)) - Added `[box]` BBCode tag [\#1368](https://github.com/torrentpier/torrentpier/pull/1368) ([belomaxorka](https://github.com/belomaxorka)) - Added `bt_announce_url` autofill [\#1331](https://github.com/torrentpier/torrentpier/pull/1331) ([belomaxorka](https://github.com/belomaxorka)) +- Added ability to send debug via Telegram [\#1323](https://github.com/torrentpier/torrentpier/pull/1323), [\#1372](https://github.com/torrentpier/torrentpier/pull/1372) ([belomaxorka](https://github.com/belomaxorka)) - Added "Random release" button in tracker.php [\#1334](https://github.com/torrentpier/torrentpier/pull/1334) ([belomaxorka](https://github.com/belomaxorka)) - Added support for fastly cdn [\#1327](https://github.com/torrentpier/torrentpier/pull/1327) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky)) - Moved announcer url autofill into cron [\#1364](https://github.com/torrentpier/torrentpier/pull/1364) ([belomaxorka](https://github.com/belomaxorka)) @@ -32,7 +33,6 @@ - Fixed download counter for torrents [\#1346](https://github.com/torrentpier/torrentpier/pull/1346) ([belomaxorka](https://github.com/belomaxorka)) - Fixed HTTP 500 while cron running in server-side [\#1321](https://github.com/torrentpier/torrentpier/pull/1321) ([belomaxorka](https://github.com/belomaxorka)) - Some enhancements for topic_tpl [\#1356](https://github.com/torrentpier/torrentpier/pull/1356) ([belomaxorka](https://github.com/belomaxorka)) -- Sending debug errors to us 🌚 via Telegram bot [\#1323](https://github.com/torrentpier/torrentpier/pull/1323) ([belomaxorka](https://github.com/belomaxorka)) - Don't update downloads counter if attachment not exists [\#1345](https://github.com/torrentpier/torrentpier/pull/1345) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1306](https://github.com/torrentpier/torrentpier/pull/1306), [\#1307](https://github.com/torrentpier/torrentpier/pull/1307), [\#1308](https://github.com/torrentpier/torrentpier/pull/1308), [\#1315](https://github.com/torrentpier/torrentpier/pull/1315), [\#1328](https://github.com/torrentpier/torrentpier/pull/1328), [\#1338](https://github.com/torrentpier/torrentpier/pull/1338), [\#1353](https://github.com/torrentpier/torrentpier/pull/1353), [\#1355](https://github.com/torrentpier/torrentpier/pull/1355), [\#1358](https://github.com/torrentpier/torrentpier/pull/1358), [\#1369](https://github.com/torrentpier/torrentpier/pull/1369) ([belomaxorka](https://github.com/belomaxorka)) - Some bugfixes [\#1326](https://github.com/torrentpier/torrentpier/pull/1326) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/library/config.php b/library/config.php index aee5adc4d..8a4bbc562 100644 --- a/library/config.php +++ b/library/config.php @@ -444,12 +444,19 @@ $bb_cfg['tech_admin_email'] = "admin@$domain_name"; // email for sending error r $bb_cfg['abuse_email'] = "abuse@$domain_name"; // abuse email (e.g. DMCA) $bb_cfg['adv_email'] = "adv@$domain_name"; // advertisement email -// Bugsnag error reporting +// Error reporting $bb_cfg['bugsnag'] = [ 'enabled' => false, 'api_key' => '', ]; +$bb_cfg['telegram_sender'] = [ + 'enabled' => false, + 'token' => '', + 'chat_id' => '', + 'timeout' => 10 +]; + // Special users $bb_cfg['unlimited_users'] = [ // Syntax: 'user_id' => 'username' @@ -565,7 +572,7 @@ $bb_cfg['advert_url'] = 'info.php?show=advert'; $bb_cfg['sitemap_sending'] = [ // A list of URLs to which to send a sitemap for indexing by a search robot. // Syntax: 'Resource name' => 'link to endpoint' - 'Google' => 'http://google.com/webmasters/sitemaps/ping?sitemap=', + 'Google' => 'https://google.com/webmasters/sitemaps/ping?sitemap=', ]; // Extensions @@ -621,8 +628,8 @@ $bb_cfg['group_avatars'] = [ // Get a Google reCAPTCHA API Key: https://www.google.com/recaptcha/admin $bb_cfg['captcha'] = [ 'disabled' => true, - 'public_key' => '', // your public key - 'secret_key' => '', // your secret key + 'public_key' => '', + 'secret_key' => '', 'theme' => 'light', // theming (available: light, dark) ]; diff --git a/library/defines.php b/library/defines.php index d431d8d3d..21c244e69 100644 --- a/library/defines.php +++ b/library/defines.php @@ -13,12 +13,6 @@ if (!defined('BB_ROOT')) { // System define('APP_NAME', 'TorrentPier'); -define('DEBUG_TELEGRAM_SENDER', [ - // Send bug reports to developers - // Better not turn it off! But you can turn it off anyway for privacy reasons (It's easy, just remove this constant) - 'token' => '5956771201:AAFQZ4edS475VWdfdbeSuAvBnhzHnhg-hCc', - 'chat_id' => 669508248 -]); // Path (trailing slash '/' at the end: XX_PATH - without, XX_DIR - with) define('ADMIN_DIR', BB_PATH . '/admin'); diff --git a/src/Dev.php b/src/Dev.php index 56d1fb9b8..c39fce40b 100644 --- a/src/Dev.php +++ b/src/Dev.php @@ -79,6 +79,8 @@ class Dev */ private static function getWhoops(): void { + global $bb_cfg; + if (!APP_DEBUG) { return; } @@ -117,14 +119,14 @@ class Dev } /** - * Send debug to us :D + * Send debug via Telegram */ - if (defined('DEBUG_TELEGRAM_SENDER') && is_array(DEBUG_TELEGRAM_SENDER)) { + if ($bb_cfg['telegram_sender']['enabled']) { $telegramSender = new PlainTextHandler(); $telegramSender->loggerOnly(true); $telegramSender->setLogger((new Logger( APP_NAME, - [(new TelegramHandler(DEBUG_TELEGRAM_SENDER['token'], DEBUG_TELEGRAM_SENDER['chat_id'])) + [(new TelegramHandler($bb_cfg['telegram_sender']['token'], (int)$bb_cfg['telegram_sender']['chat_id'], timeout: $bb_cfg['telegram_sender']['timeout'])) ->setFormatter(new TelegramFormatter())] ))); $whoops->pushHandler($telegramSender);