Compare commits

..

2 Commits

Author SHA1 Message Date
mercury bb83ab0684 warp status on menu 2024-04-18 16:10:13 +04:00
mercury 05267f44be fix naming templates 2024-04-18 15:52:37 +04:00
3 changed files with 19 additions and 9 deletions
+13 -7
View File
@@ -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",
],
],
@@ -3699,7 +3699,7 @@ DNS-over-HTTPS with IP:
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
],
[
'text' => $this->i18n($pac["default{$type}template"] ? 'off' : 'on'),
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][$pac["default{$type}template"]]) ? 'off' : 'on'),
'callback_data' => "/defaultTemplate $type",
],
];
@@ -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'),
@@ -3990,8 +3995,8 @@ DNS-over-HTTPS with IP:
'callback_data' => "/switchXr $i",
],
];
$singtemplate = $c['singtemplate'] ? base64_decode($c['singtemplate']) : 'default(' . ($pac['defaultsingtemplate'] ? base64_decode($pac['defaultsingtemplate']) : 'origin') . ')';
$v2raytemplate = $c['v2raytemplate'] ? base64_decode($c['v2raytemplate']) : 'default(' . ($pac['defaultv2raytemplate'] ? base64_decode($pac['defaultv2raytemplate']) : 'origin') . ')';
$singtemplate = $c['singtemplate'] ? base64_decode($c['singtemplate']) : 'default(' . ($pac['defaultsingtemplate'] && !empty($pac['singtemplates'][base64_decode($pac['defaultsingtemplate'])]) ? base64_decode($pac['defaultsingtemplate']) : 'origin') . ')';
$v2raytemplate = $c['v2raytemplate'] ? base64_decode($c['v2raytemplate']) : 'default(' . ($pac['defaultv2raytemplate'] && !empty($pac['v2raytemplates'][base64_decode($pac['defaultv2raytemplate'])]) ? base64_decode($pac['defaultv2raytemplate']) : 'origin') . ')';
$data[] = [
[
'text' => $this->i18n('v2ray') . ": $v2raytemplate",
@@ -4131,6 +4136,7 @@ DNS-over-HTTPS with IP:
switch (true) {
case !empty($template) && $template == 'origin':
case empty($template) && empty($pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template']):
case empty($template) && !empty($pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template']) && empty($pac[($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'templates'][$pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template']]):
$c = json_decode(file_get_contents('/config/' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . '.json'), true);
break;
case !empty($template):
+1 -1
View File
@@ -36,7 +36,7 @@ if ($hash == substr(md5($c['key']), 0, 8)) {
case 'te':
if (!empty($_GET['te'])) {
$t = $bot->getPacConf()["{$_GET['ty']}templates"][urldecode($_GET['te'])];
$t = $bot->getPacConf()["{$_GET['ty']}templates"][$_GET['te']];
} else {
$t = json_decode(file_get_contents("/config/{$_GET['ty']}.json"), true);
}
+5 -1
View File
@@ -1,4 +1,8 @@
18.04.2024 v1.30.1
18.04.2024 v1.33
- вывод статуса warp в меню
18.04.2024 v1.32
- фиксы в названии и отображении выбранного шаблона xtls
18.04.2024 v1.31
- возможность устанавливать ключ для warp
16.04.2024 v1.30.1
- улучшение сообщения об обновлениях