From 39643bf681c4147b7da5bf594924709a19ce4c9e Mon Sep 17 00:00:00 2001 From: mercury Date: Sun, 6 Oct 2024 23:19:05 +0400 Subject: [PATCH] add html fake from settings menu --- app/bot.php | 34 ++++++++++++++++++++++++++++++++-- app/i18n.php | 4 ++++ version | 2 ++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/app/bot.php b/app/bot.php index 92982fc..fb135be 100644 --- a/app/bot.php +++ b/app/bot.php @@ -482,8 +482,8 @@ class Bot case preg_match('~^/proxy$~', $this->input['callback'], $m): $this->proxy(); break; - case preg_match('~^/showpac$~', $this->input['callback'], $m): - $this->showpac(); + case preg_match('~^/addOverrideHtml$~', $this->input['callback'], $m): + $this->addOverrideHtml(); break; case preg_match('~^/export$~', $this->input['callback'], $m): $this->exportManual(); @@ -809,6 +809,30 @@ class Bot ]; } + public function addOverrideHtml() + { + $r = $this->send( + $this->input['chat'], + "@{$this->input['username']} attach html", + $this->input['message_id'], + reply: 'attach html', + ); + $_SESSION['reply'][$r['result']['message_id']] = [ + 'start_message' => $this->input['message_id'], + 'start_callback' => $this->input['callback_id'], + 'callback' => 'setOverrideHtml', + 'args' => [], + ]; + } + + public function setOverrideHtml() + { + $r = $this->request('getFile', ['file_id' => $this->input['file_id']]); + if (!empty($f = file_get_contents($this->file . $r['result']['file_path']))) { + file_put_contents('/app/webapp/override.html', $f); + } + } + public function restartOcserv($conf) { file_put_contents('/config/ocserv.conf', $conf); @@ -5518,6 +5542,12 @@ DNS-over-HTTPS with IP: 'callback_data' => "/backup", ], ]; + $data[] = [ + [ + 'text' => $this->i18n('fake html'), + 'callback_data' => "/addOverrideHtml", + ], + ]; $data[] = [ [ 'text' => $this->i18n('logs'), diff --git a/app/i18n.php b/app/i18n.php index e5e25c0..ce4124b 100644 --- a/app/i18n.php +++ b/app/i18n.php @@ -337,4 +337,8 @@ $i = [ 'en' => '🟢 have updates', 'ru' => '🟢 есть обновления', ], + 'fake html' => [ + 'en' => 'fake html', + 'ru' => 'фейк заглушка', + ], ]; diff --git a/version b/version index ddc72ce..ec02892 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +06.10.2024 v1.64.1 +- добавление html заглушки через меню 06.10.2024 v1.64 - возможность установить свою html-заглушку 06.10.2024 v1.63