From cdc20adccdda04bd4fe00f9cced3a357884aad31 Mon Sep 17 00:00:00 2001 From: mercury Date: Wed, 27 Nov 2024 16:52:30 +0400 Subject: [PATCH] consistent template logic --- app/bot.php | 46 ++++++++++------------------------------------ config/sing.json | 12 ++++-------- 2 files changed, 14 insertions(+), 44 deletions(-) diff --git a/app/bot.php b/app/bot.php index e9eda1c..28381fc 100644 --- a/app/bot.php +++ b/app/bot.php @@ -37,7 +37,7 @@ class Bot 'xray', ]; $this->reg = '~' . implode('|', [ - 'GET /ws(?:.+)? HTTP', + 'GET /ws HTTP', 'GET /adguard/(?:.+)? HTTP', 'GET /webapp(?:.+)? HTTP', 'GET /pac(?:.+)? HTTP', @@ -3828,12 +3828,6 @@ DNS-over-HTTPS with IP: $p = $this->getPacConf(); $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> proxy list'; [$data] = $this->listPac('includelist', $page, 'xtlsproxy'); - $data[] = [ - [ - 'text' => 'set to ' . ($p['domains_outbound'] ? ($p['outbound'] ?: 'proxy') : 'direct'), - 'callback_data' => "/domainsOutbound", - ], - ]; $data[] = [ [ 'text' => $this->i18n('back'), @@ -3886,12 +3880,6 @@ DNS-over-HTTPS with IP: [$data] = $this->listPac('packagelist', $page, 'xtlsapp'); $p = $this->getPacConf(); - $data[] = [ - [ - 'text' => 'set to ' . ($p['app_outbound'] ? ($p['outbound'] ?: 'proxy') : 'direct'), - 'callback_data' => "/appOutbound", - ], - ]; $data[] = [ [ 'text' => $this->i18n('back'), @@ -3912,12 +3900,6 @@ DNS-over-HTTPS with IP: [$data] = $this->listPac('processlist', $page, 'xtlsprocess'); $p = $this->getPacConf(); - $data[] = [ - [ - 'text' => 'set to ' . ($p['process_outbound'] ? ($p['outbound'] ?: 'proxy') : 'direct'), - 'callback_data' => "/processOutbound", - ], - ]; $data[] = [ [ 'text' => $this->i18n('back'), @@ -5342,6 +5324,10 @@ DNS-over-HTTPS with IP: $text[] = <<~outbound~ "~pac~" + ~package~ + ~process~ + ~block~ + ~warp~ ~dns~ ~uid~ ~domain~ @@ -5350,10 +5336,6 @@ DNS-over-HTTPS with IP: ~short_id~ ~public_key~ ~server_name~ - ~app_outbound~ - ~process_outbound~ - ~domains_outbound~ - ~final_outbound~ ~ip~ TEXT; $templates = $pac["{$type}templates"]; @@ -5589,24 +5571,20 @@ DNS-over-HTTPS with IP: 'callback_data' => "/xtlswarp", ]], [[ - 'text' => $this->i18n('rulesset'), - 'callback_data' => "/xtlsrulesset", - ]], - [[ - 'text' => 'domains: ' . ($p['domains_outbound'] ? 'direct' : $outbound), + 'text' => 'domains', 'callback_data' => "/xtlsproxy", ]], [[ - 'text' => 'process: ' . ($p['process_outbound'] ? 'direct' : $outbound), + 'text' => 'process', 'callback_data' => "/xtlsprocess", ]], [[ - 'text' => 'package: ' . ($p['app_outbound'] ? 'direct' : $outbound), + 'text' => 'package', 'callback_data' => "/xtlsapp", ]], [[ - 'text' => 'final: ' . ($p['final_outbound'] ? $outbound : 'direct'), - 'callback_data' => "/finalOutbound", + 'text' => $this->i18n('rulesset'), + 'callback_data' => "/xtlsrulesset", ]], ]; $data[] = [ @@ -6056,10 +6034,6 @@ DNS-over-HTTPS with IP: '~short_id~' => $xr['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0], '~public_key~' => $pac['xray'], '~server_name~' => $xr['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0], - '~app_outbound~' => $pac['app_outbound'] ? 'direct' : $outbound, - '~process_outbound~' => $pac['process_outbound'] ? 'direct' : $outbound, - '~domains_outbound~' => $pac['domains_outbound'] ? 'direct' : $outbound, - '~final_outbound~' => $pac['final_outbound'] ? $outbound : 'direct', '~ip~' => $this->ip, ]); $json = $this->addRuleSet($json); diff --git a/config/sing.json b/config/sing.json index b6e5d4a..f4e53fd 100644 --- a/config/sing.json +++ b/config/sing.json @@ -123,7 +123,7 @@ ] } ], - "outbound": "~domains_outbound~" + "outbound": "~outbound~" }, { "addruleset": true, @@ -138,7 +138,7 @@ ] } ], - "outbound": "~app_outbound~" + "outbound": "~outbound~" }, { "addruleset": true, @@ -153,7 +153,7 @@ ] } ], - "outbound": "~process_outbound~" + "outbound": "~outbound~" }, { "addruleset": true, @@ -184,12 +184,8 @@ } ], "outbound": "~outbound~" - }, - { - "addruleset": true, - "outbound": "direct" } ], - "final": "~final_outbound~" + "final": "direct" } } \ No newline at end of file