From bb83ab0684255ef56618ddf4ecac385dde77bb17 Mon Sep 17 00:00:00 2001 From: mercury Date: Thu, 18 Apr 2024 16:10:13 +0400 Subject: [PATCH] warp status on menu --- app/bot.php | 13 +++++++++---- version | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/bot.php b/app/bot.php index 6bcb15c..337adbc 100644 --- a/app/bot.php +++ b/app/bot.php @@ -3281,7 +3281,7 @@ DNS-over-HTTPS with IP: 'callback_data' => "/menu ss", ], [ - 'text' => $this->i18n('warp'), + 'text' => $this->i18n('warp') . ': ' . $this->warpStatus(), 'callback_data' => "/warp", ], ], @@ -3869,12 +3869,17 @@ DNS-over-HTTPS with IP: $this->warp(); } + public function warpStatus() + { + $st = $this->ssh('curl -m 1 -x socks5://127.0.0.1:40000 https://cloudflare.com/cdn-cgi/trace', 'wp'); + preg_match('~warp=(\w+)~', $st, $m); + return $m[1]; + } + public function warp() { - $st = $this->ssh('curl -x socks5://127.0.0.1:40000 https://cloudflare.com/cdn-cgi/trace', 'wp'); - preg_match('~warp=(\w+)~', $st, $m); $text[] = "Menu -> " . $this->i18n('warp'); - $text[] = "status: {$m['1']}"; + $text[] = "status: " . $this->warpStatus(); $data[] = [ [ 'text' => $this->i18n('set key'), diff --git a/version b/version index 230670a..36f8b3e 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +18.04.2024 v1.33 +- вывод статуса warp в меню 18.04.2024 v1.32 - фиксы в названии и отображении выбранного шаблона xtls 18.04.2024 v1.31