debug mode setting

This commit is contained in:
mercury
2023-06-10 13:45:19 +04:00
parent 192a2f83e2
commit 40ccd0106b
3 changed files with 25 additions and 1 deletions
+18
View File
@@ -124,6 +124,9 @@ class Bot
case preg_match('~^/mtproto$~', $this->input['callback'], $m):
$this->mtproto();
break;
case preg_match('~^/debug$~', $this->input['callback'], $m):
$this->debug();
break;
case preg_match('~^/generateSecret$~', $this->input['callback'], $m):
$this->generateSecret();
break;
@@ -2632,6 +2635,12 @@ DNS-over-HTTPS with IP:
'callback_data' => "/blinkmenuswitch",
],
];
$data[] = [
[
'text' => $this->i18n('debug') . ': ' . $this->i18n($c['debug'] ? 'on' : 'off'),
'callback_data' => "/debug",
],
];
$data[] = [
[
'text' => $this->i18n('back'),
@@ -2644,6 +2653,15 @@ DNS-over-HTTPS with IP:
];
}
public function debug()
{
$file = __DIR__ . '/config.php';
require $file;
$c['debug'] = !$c['debug'];
file_put_contents($file, "<?php\n\n\$c = " . var_export($c, true) . ";\n");
$this->menu('config');
}
public function getStatusPeer(string $publickey, array $peers)
{
foreach ($peers as $k => $v) {