Compare commits

...

1 Commits

Author SHA1 Message Date
mercury a5599118fc improve choice templae sing-box per user 2024-04-11 14:02:30 +04:00
2 changed files with 22 additions and 16 deletions
+20 -16
View File
@@ -3639,7 +3639,7 @@ DNS-over-HTTPS with IP:
];
$data[] = [
[
'text' => "default: " . $this->i18n('show'),
'text' => "origin",
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te"],
],
[
@@ -3650,7 +3650,7 @@ DNS-over-HTTPS with IP:
foreach ($templates as $k => $v) {
$data[] = [
[
'text' => "$k: " . $this->i18n('show'),
'text' => "$k",
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&te=" . urlencode($k)],
],
[
@@ -3798,6 +3798,12 @@ DNS-over-HTTPS with IP:
'callback_data' => "/choiceTemplate $i",
],
];
$data[] = [
[
'text' => 'origin',
'callback_data' => "/choiceTemplate {$i}_" . base64_encode('origin'),
],
];
foreach ($templates as $k => $v) {
$data[] = [
[
@@ -3945,7 +3951,7 @@ DNS-over-HTTPS with IP:
if (empty($v['off'])) {
$flag = false;
}
$template = $v['template'];
$template = base64_decode($v['template']);
break;
}
}
@@ -3953,14 +3959,18 @@ DNS-over-HTTPS with IP:
return false;
}
if (!empty($template) && !empty($pac['singtemplates'][base64_decode($template)])) {
$c = $pac['singtemplates'][base64_decode($template)];
} else {
if (!empty($pac['defaulttemplate'])) {
$c = $pac['singtemplates'][base64_decode($pac['defaulttemplate'])];
} else {
switch (true) {
case !empty($template) && $template == 'origin':
case empty($template) && empty($pac['defaulttemplate']):
$c = json_decode(file_get_contents('/config/sing.json'), true);
}
break;
case !empty($template):
$c = $pac['singtemplates'][$template];
break;
default:
$c = $pac['singtemplates'][base64_decode($pac['defaulttemplate'])];
break;
}
if ($c['dns']['servers'][0]['address'] == '~dns~') {
@@ -4161,12 +4171,6 @@ DNS-over-HTTPS with IP:
],
],
];
$data[] = [
[
'text' => $this->i18n('reset settings'),
'callback_data' => "/adguardreset",
],
];
$data[] = [
[
'text' => $this->i18n('add upstream'),
+2
View File
@@ -1,3 +1,5 @@
11.04.2024 v1.22
- улучшение гибкости выбора шаблона sing-box
11.04.2024 v1.21
- фикс доступности адгвард панели при первом запуске
10.04.2024 v1.20