Compare commits

..

2 Commits

Author SHA1 Message Date
mercury 29e7be6cd8 improve xray config 2024-04-11 17:06:21 +04:00
mercury a5599118fc improve choice templae sing-box per user 2024-04-11 14:02:30 +04:00
2 changed files with 25 additions and 16 deletions
+21 -16
View File
@@ -481,6 +481,7 @@ class Bot
public function restartXray($c)
{
$c['inbounds'][0]['settings']['clients'] = array_values($c['inbounds'][0]['settings']['clients']);
$this->ssh('pkill xray', 'xr');
file_put_contents('/config/xray.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
$this->ssh('xray run -config /xray.json > /dev/null 2>&1 &', 'xr');
@@ -3639,7 +3640,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 +3651,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 +3799,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 +3952,7 @@ DNS-over-HTTPS with IP:
if (empty($v['off'])) {
$flag = false;
}
$template = $v['template'];
$template = base64_decode($v['template']);
break;
}
}
@@ -3953,14 +3960,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 +4172,6 @@ DNS-over-HTTPS with IP:
],
],
];
$data[] = [
[
'text' => $this->i18n('reset settings'),
'callback_data' => "/adguardreset",
],
];
$data[] = [
[
'text' => $this->i18n('add upstream'),
+4
View File
@@ -1,3 +1,7 @@
11.04.2024 v1.23
- фикс совместимости старого конфига xray из бэкапа
11.04.2024 v1.22
- улучшение гибкости выбора шаблона sing-box
11.04.2024 v1.21
- фикс доступности адгвард панели при первом запуске
10.04.2024 v1.20