From b6789f2acc9349448096f4cc264ad03ee56b7ccf Mon Sep 17 00:00:00 2001 From: mercury Date: Tue, 6 Feb 2024 15:19:34 +0400 Subject: [PATCH] show dns openconnect --- app/bot.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/bot.php b/app/bot.php index 0c3753c..a630e7c 100644 --- a/app/bot.php +++ b/app/bot.php @@ -2817,11 +2817,15 @@ DNS-over-HTTPS with IP: public function ocMenu() { - $pac = $this->getPacConf(); - preg_match('~^camouflage_secret[^\n]+?"([^"]+)*"~sm', file_get_contents('/config/ocserv.conf'), $m); + $pac = $this->getPacConf(); + $ocserv = file_get_contents('/config/ocserv.conf'); + preg_match('~^camouflage_secret[^\n]+?"([^"]+)*"~sm', $ocserv, $m); + $cs = $m[1]; + preg_match('~^dns = ([^\n]+)~sm', $ocserv, $m); + $dns = $m[1]; $text[] = "Menu -> OpenConnect"; if (!empty($m[1])) { - $text[] = "https://oc.{$pac['domain']}/?{$m[1]}"; + $text[] = "https://oc.{$pac['domain']}/?$cs"; } $text[] = "password: {$pac['ocserv']}"; $data[] = [ @@ -2834,7 +2838,7 @@ DNS-over-HTTPS with IP: 'callback_data' => "/changeOcPass", ], [ - 'text' => $this->i18n('dns'), + 'text' => $this->i18n('dns') . ": $dns", 'callback_data' => "/changeOcDns", ], ];