From 741f402ca137fcfb8d69ca6974b2a728aa7aa2a1 Mon Sep 17 00:00:00 2001 From: mercury Date: Wed, 14 Aug 2024 23:52:21 +0400 Subject: [PATCH 1/8] fix singbox import --- app/bot.php | 10 +++++++--- app/index.php | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/bot.php b/app/bot.php index 0080bd1..2baacdb 100644 --- a/app/bot.php +++ b/app/bot.php @@ -4320,11 +4320,15 @@ DNS-over-HTTPS with IP: } if (!empty($_GET['r'])) { - $si = "$scheme://{$domain}/pac?h=$hash&t=si&s=$uid"; + $si = "$scheme://{$domain}/pac/" . base64_encode(serialize([ + 'h' => $hash, + 't' => 'si', + 's' => $uid, + ])); $v2 = "$scheme://{$domain}/pac?h=$hash&t=s&s=$uid"; switch ($_GET['r']) { case 'si': - header("Location: sing-box://import-remote-profile/?url=" . urlencode($si)); + header("Location: sing-box://import-remote-profile/?url=" . $si); exit; case 'st': header("Location: streisand://import/$v2"); @@ -4333,7 +4337,7 @@ DNS-over-HTTPS with IP: header("Location: v2rayng://install-config?url=" . urlencode($v2)); exit; case 'h': - header("Location: hiddify://install-config/?url=" . urlencode($si)); + header("Location: hiddify://install-config/?url=" . $si); exit; case 'w': $link = htmlspecialchars($si, ENT_XML1, 'UTF-8'); diff --git a/app/index.php b/app/index.php index 8fec39b..938f1d1 100644 --- a/app/index.php +++ b/app/index.php @@ -17,10 +17,13 @@ if ('POST' == $_SERVER['REQUEST_METHOD'] && $_GET['k'] == $c['key']) { } // pac -$type = $_GET['t'] ?? 'pac'; +if (!empty($t = unserialize(base64_decode(explode('/', $_SERVER['REQUEST_URI'])[2])))) { // fix sing-box import + $_GET = array_merge($_GET, $t); +} +$type = $_GET['t'] ?? 'pac'; $address = $_GET['a'] ?: '127.0.0.1'; -$port = $_GET['p'] ?: '1080'; -$hash = $_GET['h']; +$port = $_GET['p'] ?: '1080'; +$hash = $_GET['h']; if ($hash == substr(md5($c['key']), 0, 8)) { require __DIR__ . '/bot.php'; require __DIR__ . '/i18n.php'; From 30f0f8c5f00210bc1caa2f4673366b96e9800357 Mon Sep 17 00:00:00 2001 From: mercury Date: Thu, 15 Aug 2024 01:07:31 +0400 Subject: [PATCH 2/8] fix selfpac update --- app/bot.php | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/app/bot.php b/app/bot.php index 2baacdb..5d288ea 100644 --- a/app/bot.php +++ b/app/bot.php @@ -4437,35 +4437,33 @@ DNS-over-HTTPS with IP: } } if (!empty($_GET['r']) && $r['name'] == $_GET['r']) { + header("Content-Disposition: attachment; filename={$r['name']}.srs"); + header('Content-Type: application/binary'); $f = "/tmp/{$r['name']}" . time() . rand(1, 100); file_put_contents($f, json_encode([ 'version' => 1, - 'rules' => $r['rules'], + 'rules' => $r['rules'] ?: [], ])); exec("sing-box rule-set compile $f"); - header("Content-Disposition: attachment; filename={$r['name']}.srs"); - header('Content-Type: application/binary'); echo file_get_contents("$f.srs"); unlink($f); unlink("$f.srs"); exit; } - if (!empty($r['rules'])) { - $ruleset[] = [ - "tag" => $r['name'], - "url" => "$scheme://{$domain}/pac?" . http_build_query([ - 'h' => $hash, - 't' => 'si', - 's' => $uid, - 'r' => $r['name'], - ]), - "update_interval" => $r['interval'], - "type" => "remote", - "format" => "binary", - "download_detour" => "direct", - ]; - $route['rules'][$k]['rule_set'][] = $r['name']; - } + $ruleset[] = [ + "tag" => $r['name'], + "url" => "$scheme://{$domain}/pac?" . http_build_query([ + 'h' => $hash, + 't' => 'si', + 's' => $uid, + 'r' => $r['name'], + ]), + "update_interval" => $r['interval'], + "type" => "remote", + "format" => "binary", + "download_detour" => "direct", + ]; + $route['rules'][$k]['rule_set'][] = $r['name']; } unset($route['rules'][$k]['createruleset']); if (empty($route['rules'][$k]['rule_set'])) { From f8f95e22ac09e390b995616545a775dd18170329 Mon Sep 17 00:00:00 2001 From: mercury Date: Thu, 15 Aug 2024 10:40:20 +0400 Subject: [PATCH 3/8] backup for domain lists --- app/bot.php | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/app/bot.php b/app/bot.php index 5d288ea..300d2fc 100644 --- a/app/bot.php +++ b/app/bot.php @@ -148,6 +148,9 @@ class Bot case preg_match('~^/deleteAll (\w+)$~', $this->input['callback'], $m): $this->deleteAll($m[1]); break; + case preg_match('~^/exportList (\w+)$~', $this->input['callback'], $m): + $this->exportList($m[1]); + break; case preg_match('~^/deleteYes (\w+)$~', $this->input['callback'], $m): $this->deleteYes($m[1]); break; @@ -458,6 +461,9 @@ class Bot case preg_match('~^/import$~', $this->input['callback'], $m): $this->import(); break; + case preg_match('~^/importList (\w+)$~', $this->input['callback'], $m): + $this->importList($m[1]); + break; case preg_match('~^/rename (?P\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m): $this->rename(...explode('_', $m['arg'])); break; @@ -920,6 +926,40 @@ class Bot ]; } + public function importList($type) + { + $r = $this->send( + $this->input['chat'], + "@{$this->input['username']} send the export file:", + $this->input['message_id'], + reply: 'send the export file:', + ); + $_SESSION['reply'][$r['result']['message_id']] = [ + 'start_message' => $this->input['message_id'], + 'start_callback' => $this->input['callback_id'], + 'callback' => 'importListFile', + 'args' => [$type], + ]; + } + + public function importListFile($text = '', $type) + { + $r = $this->request('getFile', ['file_id' => $this->input['file_id']]); + $f = file_get_contents($this->file . $r['result']['file_path']); + if (!empty($f)) { + foreach (explode("\n", $f) as $v) { + if (!empty($s = trim($v))) { + $t = explode(';', $s); + $list[$t[0]] = (bool) $t[1]; + } + } + $p = $this->getPacConf(); + $p[$type] = $list; + $this->setPacConf($p); + } + $this->backXtlsList($type); + } + public function timerClient(string $time, int $client) { $clients = $this->readClients(); @@ -3222,6 +3262,21 @@ DNS-over-HTTPS with IP: ); } + public function exportList($type) + { + $domains = $this->getPacConf()[$type]; + if (!empty($domains)) { + foreach ($domains as $k => $v) { + $text .= "$k;$v\n"; + } + $this->sendFile( + $this->input['chat'], + new CURLStringFile($text, "$type.csv", 'application/csv'), + to: $this->input['message_id'], + ); + } + } + public function xtlsblock($page = 0) { $text[] = "Menu -> " . $this->i18n('xray') . ' -> block list'; @@ -3304,6 +3359,21 @@ DNS-over-HTTPS with IP: 'text' => $this->i18n('delete all'), 'callback_data' => "/deleteAll $type", ], + [ + 'text' => $this->i18n('export'), + 'callback_data' => "/exportList $type", + ], + [ + 'text' => $this->i18n('import'), + 'callback_data' => "/importList $type", + ], + ]; + } else { + $data[] = [ + [ + 'text' => $this->i18n('import'), + 'callback_data' => "/importList $type", + ], ]; } return $data; From b663eca4454425ade4c03569945ad293481f7188 Mon Sep 17 00:00:00 2001 From: mercury Date: Fri, 16 Aug 2024 02:08:44 +0400 Subject: [PATCH 4/8] routes for sinbox --- app/bot.php | 228 +++++++++++++++++++++++++++++++++++++++++++---- app/i18n.php | 4 +- config/sing.json | 28 +++++- 3 files changed, 240 insertions(+), 20 deletions(-) diff --git a/app/bot.php b/app/bot.php index 300d2fc..41b0e29 100644 --- a/app/bot.php +++ b/app/bot.php @@ -401,9 +401,18 @@ class Bot case preg_match('~^/xtlsblock(?: (\d+))?$~', $this->input['callback'], $m): $this->xtlsblock($m[1] ?: 0); break; + case preg_match('~^/routes(?: (\d+))?$~', $this->input['callback'], $m): + $this->routes($m[1] ?: 0); + break; case preg_match('~^/xtlswarp(?: (\d+))?$~', $this->input['callback'], $m): $this->xtlswarp($m[1] ?: 0); break; + case preg_match('~^/xtlsapp(?: (\d+))?$~', $this->input['callback'], $m): + $this->xtlsapp($m[1] ?: 0); + break; + case preg_match('~^/xtlsrulesset(?: (\d+))?$~', $this->input['callback'], $m): + $this->xtlsrulesset($m[1] ?: 0); + break; case preg_match('~^/delTemplate (\w+)(?: (.+))?$~', $this->input['callback'], $m): $this->delTemplate($m[1], $m[2]); break; @@ -950,7 +959,13 @@ class Bot foreach (explode("\n", $f) as $v) { if (!empty($s = trim($v))) { $t = explode(';', $s); - $list[$t[0]] = (bool) $t[1]; + if ($type == 'rulessetlist') { + if (preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $t[0])) { + $list[$t[0]] = (bool) $t[1]; + } + } else { + $list[$t[0]] = (bool) $t[1]; + } } } $p = $this->getPacConf(); @@ -2198,12 +2213,25 @@ DNS-over-HTTPS with IP: public function include($type) { - $r = $this->send( - $this->input['chat'], - "@{$this->input['username']} list domains separated by commas", - $this->input['message_id'], - reply: 'list domains separated by commas', - ); + switch ($type) { + case 'rulessetlist': + $r = $this->send( + $this->input['chat'], + "@{$this->input['username']} [direct | block | proxy]:time:URL", + $this->input['message_id'], + reply: '[direct | block | proxy]:time:URL', + ); + break; + + default: + $r = $this->send( + $this->input['chat'], + "@{$this->input['username']} list domains separated by commas", + $this->input['message_id'], + reply: 'list domains separated by commas', + ); + break; + } $_SESSION['reply'][$r['result']['message_id']] = [ 'start_message' => $this->input['message_id'], 'callback' => 'addInclude', @@ -2213,6 +2241,10 @@ DNS-over-HTTPS with IP: public function addInclude(string $domains, $type) { + if ($type == 'rulessetlist' && !preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $domains)) { + $this->send($this->input['from'], 'wrong pattern, enter [direct|block|proxy]:time:URL'); + return; + } $domains = explode(',', $domains); $domains = array_filter($domains, fn($x) => !empty(trim($x))); if (!empty($domains)) { @@ -2242,6 +2274,14 @@ DNS-over-HTTPS with IP: $this->xrayUpdateRules(); $this->xtlswarp(); break; + case 'packagelist': + $this->xrayUpdateRules(); + $this->xtlsapp(); + break; + case 'rulessetlist': + $this->xrayUpdateRules(); + $this->xtlsrulesset(); + break; } } @@ -3203,6 +3243,12 @@ DNS-over-HTTPS with IP: case 'warplist': $this->xtlswarp(); break; + case 'packagelist': + $this->xtlsapp(); + break; + case 'rulessetlist': + $this->xtlsrulesset(); + break; } } @@ -3218,6 +3264,12 @@ DNS-over-HTTPS with IP: case 'blocklist': $dir = 'BLOCK'; break; + case 'packagelist': + $dir = 'PACKAGE'; + break; + case 'rulessetlist': + $dir = 'rulesset'; + break; } $text = << $dir -> delete all @@ -3253,6 +3305,22 @@ DNS-over-HTTPS with IP: ], ]; break; + case 'packagelist': + $data[] = [ + [ + 'text' => $this->i18n('back'), + 'callback_data' => "/xtlsapp", + ], + ]; + break; + case 'rulessetlist': + $data[] = [ + [ + 'text' => $this->i18n('back'), + 'callback_data' => "/xtlsrulesset", + ], + ]; + break; } $this->update( $this->input['chat'], @@ -3279,13 +3347,13 @@ DNS-over-HTTPS with IP: public function xtlsblock($page = 0) { - $text[] = "Menu -> " . $this->i18n('xray') . ' -> block list'; + $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> block list'; $data = $this->listPac('blocklist', $page, 'xtlsblock'); $data[] = [ [ 'text' => $this->i18n('back'), - 'callback_data' => "/xray", + 'callback_data' => "/routes", ], ]; $this->update( @@ -3298,13 +3366,51 @@ DNS-over-HTTPS with IP: public function xtlswarp($page = 0) { - $text[] = "Menu -> " . $this->i18n('xray') . ' -> warp list'; + $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> warp list'; $data = $this->listPac('warplist', $page, 'xtlswarp'); $data[] = [ [ 'text' => $this->i18n('back'), - 'callback_data' => "/xray", + 'callback_data' => "/routes", + ], + ]; + $this->update( + $this->input['chat'], + $this->input['message_id'], + implode("\n", $text ?: ['...']), + $data ?: false, + ); + } + + public function xtlsapp($page = 0) + { + $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> package list'; + + $data = $this->listPac('packagelist', $page, 'xtlsapp'); + $data[] = [ + [ + 'text' => $this->i18n('back'), + 'callback_data' => "/routes", + ], + ]; + $this->update( + $this->input['chat'], + $this->input['message_id'], + implode("\n", $text ?: ['...']), + $data ?: false, + ); + } + + public function xtlsrulesset($page = 0) + { + $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> rulesset list'; + + $data = $this->listPac('rulessetlist', $page, 'xtlsrulesset'); + $data[] = [ + [ + 'text' => $this->i18n('back'), + 'callback_data' => "/routes", ], ]; $this->update( @@ -4057,14 +4163,11 @@ DNS-over-HTTPS with IP: ]; $data[] = [ [ - 'text' => $this->i18n('block'), - 'callback_data' => "/xtlsblock", - ], - [ - 'text' => $this->i18n('warp'), - 'callback_data' => "/xtlswarp", + 'text' => $this->i18n('routes'), + 'callback_data' => "/routes", ], ]; + $data[] = [ ]; foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) { @@ -4132,6 +4235,42 @@ DNS-over-HTTPS with IP: ); } + public function routes($page = 0) + { + $text[] = "Menu -> " . $this->i18n('xray') . ' -> routes'; + + $data = [ + [[ + 'text' => $this->i18n('block'), + 'callback_data' => "/xtlsblock", + ]], + [[ + 'text' => $this->i18n('warp'), + 'callback_data' => "/xtlswarp", + ]], + [[ + 'text' => $this->i18n('package'), + 'callback_data' => "/xtlsapp", + ]], + [[ + 'text' => $this->i18n('rulesset'), + 'callback_data' => "/xtlsrulesset", + ]], + ]; + $data[] = [ + [ + 'text' => $this->i18n('back'), + 'callback_data' => "/xray", + ], + ]; + $this->update( + $this->input['chat'], + $this->input['message_id'], + implode("\n", $text ?: ['...']), + $data ?: false, + ); + } + public function warpPlus() { $r = $this->send( @@ -4480,6 +4619,8 @@ DNS-over-HTTPS with IP: } } $c['route']['rules'] = array_values($c['route']['rules']); + $c['route'] = $this->addRuleSet($c['route']); + $c['route'] = $this->addPackageRule($c['route']); $c['route'] = $this->createRuleSet($c['route'], $uid); break; } @@ -4488,6 +4629,47 @@ DNS-over-HTTPS with IP: echo json_encode($c); } + public function addPackageRule($route) + { + foreach ($route['rules'] as $k => $v) { + $t[$v['outbound']] = $k; + } + $p = $this->getPacConf(); + if (!empty($p['packagelist'])) { + foreach ($p['packagelist'] as $k => $v) { + if (!empty($v)) { + $route['rules'][$t['proxy']]['package_name'][] = $k; + } + } + } + return $route; + } + + public function addRuleSet($route) + { + foreach ($route['rules'] as $k => $v) { + $t[$v['outbound']] = $k; + } + $p = $this->getPacConf(); + if (!empty($p['rulessetlist'])) { + foreach ($p['rulessetlist'] as $k => $v) { + if (!empty($v)) { + [$type, $time, $url] = explode(':', $k, 3); + $route['rule_set'][] = [ + "tag" => $k, + "type" => "remote", + "format" => "binary", + "url" => $url, + "download_detour" => "direct", + "update_interval" => $time + ]; + $route['rules'][$t[$type]]['rule_set'][] = $k; + } + } + } + return $route; + } + public function createRuleSet($route, $uid) { $pac = $this->getPacConf(); @@ -4505,6 +4687,18 @@ DNS-over-HTTPS with IP: unset($r['rules'][$l]); } } + if (array_key_exists('domain_suffix', $n) && $n['domain_suffix'] == '~warp~') { + $r['rules'][$l]['domain_suffix'] = array_keys(array_filter($pac['warplist'] ?: [])); + if (empty($r['rules'][$l]['domain_suffix'])) { + unset($r['rules'][$l]); + } + } + if (array_key_exists('domain_suffix', $n) && $n['domain_suffix'] == '~block~') { + $r['rules'][$l]['domain_suffix'] = array_keys(array_filter($pac['blocklist'] ?: [])); + if (empty($r['rules'][$l]['domain_suffix'])) { + unset($r['rules'][$l]); + } + } } if (!empty($_GET['r']) && $r['name'] == $_GET['r']) { header("Content-Disposition: attachment; filename={$r['name']}.srs"); diff --git a/app/i18n.php b/app/i18n.php index 172fac2..cc968ae 100644 --- a/app/i18n.php +++ b/app/i18n.php @@ -2,8 +2,8 @@ $i = [ 'warp' => [ - 'en' => 'Warp', - 'ru' => 'Warp', + 'en' => 'warp', + 'ru' => 'warp', ], 'wg_title' => [ 'en' => 'Wireguard', diff --git a/config/sing.json b/config/sing.json index 319568c..f430d60 100644 --- a/config/sing.json +++ b/config/sing.json @@ -113,16 +113,42 @@ { "createruleset": [ { - "name": "selfpac", + "name": "pac", "interval": "15s", "rules": [ { "domain_suffix": "~pac~" } ] + }, + { + "name": "warp", + "interval": "15s", + "rules": [ + { + "domain_suffix": "~warp~" + } + ] } ], "outbound": "proxy" + }, + { + "createruleset": [ + { + "name": "block", + "interval": "15s", + "rules": [ + { + "domain_suffix": "~block~" + } + ] + } + ], + "outbound": "block" + }, + { + "outbound": "direct" } ], "final": "direct" From 9da810ba3db20b32d18f75571cbe9d67d7969689 Mon Sep 17 00:00:00 2001 From: mercury Date: Fri, 16 Aug 2024 02:21:29 +0400 Subject: [PATCH 5/8] fix empty rules route --- app/bot.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/bot.php b/app/bot.php index 41b0e29..bdc3f8b 100644 --- a/app/bot.php +++ b/app/bot.php @@ -4622,6 +4622,7 @@ DNS-over-HTTPS with IP: $c['route'] = $this->addRuleSet($c['route']); $c['route'] = $this->addPackageRule($c['route']); $c['route'] = $this->createRuleSet($c['route'], $uid); + $c['route'] = $this->clearEmptyRules($c['route']); break; } @@ -4629,6 +4630,16 @@ DNS-over-HTTPS with IP: echo json_encode($c); } + public function clearEmptyRules($route) + { + foreach ($route['rules'] as $k => $v) { + if (count($v) == 1) { + unset($route['rules'][$k]); + } + } + return $route; + } + public function addPackageRule($route) { foreach ($route['rules'] as $k => $v) { From 5263de514eefd615922e51ff47c0b98dc2f61e05 Mon Sep 17 00:00:00 2001 From: mercury Date: Fri, 16 Aug 2024 11:24:51 +0400 Subject: [PATCH 6/8] fix naming ruleset --- app/bot.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/app/bot.php b/app/bot.php index bdc3f8b..583c5ce 100644 --- a/app/bot.php +++ b/app/bot.php @@ -3406,7 +3406,7 @@ DNS-over-HTTPS with IP: { $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> rulesset list'; - $data = $this->listPac('rulessetlist', $page, 'xtlsrulesset'); + $data = $this->listPac('rulessetlist', $page, 'xtlsrulesset', 1); $data[] = [ [ 'text' => $this->i18n('back'), @@ -3421,7 +3421,7 @@ DNS-over-HTTPS with IP: ); } - public function listPac($type, $page, $menu) + public function listPac($type, $page, $menu, $basename = false) { $data[] = [ [ @@ -3431,22 +3431,23 @@ DNS-over-HTTPS with IP: ]; $domains = $this->getPacConf()[$type]; if (!empty($domains)) { - ksort($domains); $all = (int) ceil(count($domains) / $this->limit); $page = min($page, $all - 1); $page = $page < 0 ? $all - 1 : $page; $domains = array_slice($domains, $page * $this->limit, $this->limit, true); + $i = 0; foreach ($domains as $k => $v) { $data[] = [ [ - 'text' => $this->i18n($v ? 'on' : 'off') . ' ' . idn_to_utf8($k), - 'callback_data' => "/change$type {$k}_{$this->limit}", + 'text' => $this->i18n($v ? 'on' : 'off') . ' ' . ($basename ? basename($k) . ' ' : '') . idn_to_utf8($k), + 'callback_data' => "/change$type " . $i, ], [ 'text' => 'delete', - 'callback_data' => "/delete$type {$k}_{$this->limit}", + 'callback_data' => "/delete$type " . $i, ], ]; + $i++; } if ($all > 1) { $data[] = [ @@ -3488,14 +3489,19 @@ DNS-over-HTTPS with IP: public function listPacChange($type, $action, $key) { $conf = $this->getPacConf(); - ksort($conf[$type]); - switch ($action) { - case 'change': - $conf[$type][$key] = !$conf[$type][$key]; - break; - case 'delete': - unset($conf[$type][$key]); + $i = 0; + foreach ($conf[$type] as $k => $v) { + if ($key == $i) { + switch ($action) { + case 'change': + $conf[$type][$k] = !$v; + break; + case 'delete': + unset($conf[$type][$k]); + break; + } break; + } } $this->setPacConf($conf); $this->backXtlsList($type); From 49d2d21f41140835047ce2b4de97258a82ecec15 Mon Sep 17 00:00:00 2001 From: mercury Date: Fri, 16 Aug 2024 11:41:42 +0400 Subject: [PATCH 7/8] fix changelist --- app/bot.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/bot.php b/app/bot.php index 583c5ce..970059e 100644 --- a/app/bot.php +++ b/app/bot.php @@ -371,8 +371,8 @@ class Bot case preg_match('~^/deldomain$~', $this->input['callback'], $m): $this->delDomain(); break; - case preg_match('~^/(?Pchange|delete)(?P\w+) (?P[^\s]+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m): - $this->listPacChange($m['typelist'], $m['action'], ...explode('_', $m['arg'])); + case preg_match('~^/(?Pchange|delete)(?P\w+) (?P\d+)$~', $this->input['callback'], $m): + $this->listPacChange($m['typelist'], $m['action'], $m['arg']); break; case preg_match('~^/paczapret$~', $this->input['callback'], $m): $this->pacZapret(); @@ -3440,11 +3440,11 @@ DNS-over-HTTPS with IP: $data[] = [ [ 'text' => $this->i18n($v ? 'on' : 'off') . ' ' . ($basename ? basename($k) . ' ' : '') . idn_to_utf8($k), - 'callback_data' => "/change$type " . $i, + 'callback_data' => "/change$type $i", ], [ 'text' => 'delete', - 'callback_data' => "/delete$type " . $i, + 'callback_data' => "/delete$type $i", ], ]; $i++; @@ -3502,6 +3502,7 @@ DNS-over-HTTPS with IP: } break; } + $i++; } $this->setPacConf($conf); $this->backXtlsList($type); From 5791cabfb5aeb86cd453c4cb459f50acf23eb87f Mon Sep 17 00:00:00 2001 From: mercury Date: Fri, 16 Aug 2024 12:07:14 +0400 Subject: [PATCH 8/8] update version --- app/bot.php | 3 --- version | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/bot.php b/app/bot.php index 970059e..3fb2055 100644 --- a/app/bot.php +++ b/app/bot.php @@ -4174,9 +4174,6 @@ DNS-over-HTTPS with IP: 'callback_data' => "/routes", ], ]; - - $data[] = [ - ]; foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) { if (!empty($v['off'])) { $off++; diff --git a/version b/version index 16c5ae4..972f7c4 100644 --- a/version +++ b/version @@ -1,3 +1,9 @@ +16.08.2024 v1.42 +- добавлена возможность сохранять/восстанавливать список доменов/правил маршрутизации +- изменена ссылка на сингбокс-конфиг для совместимости с клиентом сингбокса (фикс импорта в sing-box) +- sing-box: добавлена возможность добавлять свои packagename (outbound:proxy) +- sing-box: добавлена возможность добавлять свои ruleset с указанием outbound и временем обновления +- sing-box: списки доменов pac/warp/block трансформируются в собственный ruleset и присутствуют в шаблоне origin всегда, даже если они пустые. это дает возможность не ждать перезагрузки конфига клиентом 09.08.2024 v1.41.1 - фикс для "удалить все" в списках доменов 06.08.2024 v1.41