Compare commits

...

36 Commits

Author SHA1 Message Date
mercury d3470bd8ea update version 2024-10-27 01:53:55 +04:00
mercury 1fcddf49e3 fixup! fixup! fix warp update 2024-10-27 01:42:25 +04:00
mercury a0d9bada2b fixup! fix warp update 2024-10-27 01:32:13 +04:00
mercury 32109c4526 fix warp update 2024-10-27 01:12:29 +04:00
mercury ca37736cd5 fix menu rulesset with empty rules 2024-10-26 23:14:03 +04:00
mercury 1c4fff50d1 fix menu warp after update 2024-10-26 22:47:43 +04:00
mercury 6ffb4d0a79 update version 2024-10-26 22:41:07 +04:00
mercury 394062cbe0 fix warp off after update 2024-10-26 22:29:07 +04:00
mercury dd8897575f fix warp off after update 2024-10-26 22:18:36 +04:00
mercury 9ab05de320 fix update menu 2024-10-26 21:58:10 +04:00
legiz-ru 71f7db5bac update singbox 1.10.1 windows x64 (#26) 2024-10-26 19:47:15 +04:00
mercury 237da68f14 duplicate the rulesset list in the message 2024-10-26 14:44:06 +04:00
mercury 961ebf3423 xray->routes->proxy <=> Pac 2024-10-25 21:02:58 +04:00
mercury ddcaea751f update version 2024-10-25 18:43:32 +04:00
mercury ce8cdac7c7 Fix for auto-backup not triggering on the first tick 2024-10-25 18:36:54 +04:00
mercury 00aae6c2f7 adguard: list of allowed clients 2024-10-25 18:12:05 +04:00
mercury 89c0139ef6 show safe search status 2024-10-25 17:38:50 +04:00
mercury c57053c8a0 copyable warp key 2024-10-25 17:14:52 +04:00
mercury 3cc16469ff warp registration delete before off 2024-10-25 17:11:46 +04:00
mercury e06544b00f update version 2024-10-24 23:45:25 +04:00
mercury c5b7e1ffdc warp registration fix 2024-10-24 23:15:44 +04:00
mercury 7d21937f04 ability to override i18n 2024-10-24 22:32:16 +04:00
mercury 16138648ca fix openconnect link 2024-10-24 21:54:37 +04:00
mercury ced10f22fa update version 2024-10-24 00:01:51 +04:00
mercury 18a4ee39fb improve selfupdate 2024-10-23 23:59:32 +04:00
mercury 4f4777b5ef improve selfupdate 2024-10-23 23:56:50 +04:00
mercury dee90b1f4f improve selfupdate 2024-10-23 23:53:58 +04:00
mercury 01571f50e6 improve selfupdate 2024-10-23 23:29:56 +04:00
mercury 4998893234 fix autobackup 2024-10-23 21:35:17 +04:00
mercury 95f92791b1 update version 2024-10-23 10:08:32 +04:00
mercury cedfb66ca0 fix autoupdate wireguard crash 2024-10-23 10:05:06 +04:00
mercury 6215836926 fix empty route rules for singbox 2024-10-23 03:01:10 +04:00
mercury 842d76261a update version 2024-10-23 02:45:17 +04:00
mercury 4c63ae669a improve selfupdate 2024-10-23 02:32:19 +04:00
mercury bba1ec9e17 improve selfupdate 2024-10-23 02:25:00 +04:00
mercury a798df0fd3 improve selfupdate 2024-10-23 02:20:16 +04:00
11 changed files with 230 additions and 74 deletions
+2 -1
View File
@@ -20,4 +20,5 @@ update/*
!update/update.sh !update/update.sh
override.env override.env
override.html override.html
override.php
+166 -67
View File
@@ -142,6 +142,9 @@ class Bot
case preg_match('~^/autoupdate$~', $this->input['message'], $m): case preg_match('~^/autoupdate$~', $this->input['message'], $m):
$this->autoupdate(); $this->autoupdate();
break; break;
case preg_match('~^/adgFillAllowedClients(?: (\d+))?$~', $this->input['callback'], $m):
$this->adgFillAllowedClients($m[1] ?: false);
break;
case preg_match('~^/appOutbound$~', $this->input['callback'], $m): case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
$this->appOutbound(); $this->appOutbound();
break; break;
@@ -434,6 +437,9 @@ class Bot
case preg_match('~^/xtlswarp(?: (\d+))?$~', $this->input['callback'], $m): case preg_match('~^/xtlswarp(?: (\d+))?$~', $this->input['callback'], $m):
$this->xtlswarp($m[1] ?: 0); $this->xtlswarp($m[1] ?: 0);
break; break;
case preg_match('~^/xtlsproxy(?: (\d+))?$~', $this->input['callback'], $m):
$this->xtlsproxy($m[1] ?: 0);
break;
case preg_match('~^/xtlsapp(?: (\d+))?$~', $this->input['callback'], $m): case preg_match('~^/xtlsapp(?: (\d+))?$~', $this->input['callback'], $m):
$this->xtlsapp($m[1] ?: 0); $this->xtlsapp($m[1] ?: 0);
break; break;
@@ -1063,36 +1069,41 @@ class Bot
public function cron() public function cron()
{ {
$period = 10;
while (true) { while (true) {
$this->shutdownClient(); $this->shutdownClient();
$this->shutdownClientXr(); $this->shutdownClientXr();
$this->checkVersion(); $this->checkVersion();
$this->checkBackup(); $this->checkBackup($period);
$this->checkCert(); $this->checkCert();
sleep(10); sleep($period);
} }
} }
public function checkBackup() public function checkBackup($delta)
{ {
$c = $this->getPacConf(); $c = $this->getPacConf();
$now = strtotime(date('Y-m-d H:i'));
if (!empty($c['backup'])) { if (!empty($c['backup'])) {
$now = strtotime(date('Y-m-d H:i:s'));
[$start, $period] = explode('/', $c['backup']); [$start, $period] = explode('/', $c['backup']);
$start = strtotime($start); $start = strtotime(trim($start));
$period = strtotime($period, 0); $period = strtotime(trim($period), 0);
if (!empty($start) && !empty($period)) { if (
if ($now - $start >= $period && ($now - $start) % $period == 0) { !empty($start)
if (!empty($c['pinbackup'])) { && !empty($period)
$this->pinAdmin($c['pinbackup'], 1); && empty($this->backup)
} && $now - $start >= 0
$this->pinBackup(); && (($now - $start) % $period < $delta)
) {
if (!empty($c['pinbackup'])) {
$this->pinAdmin($c['pinbackup'], 1);
} }
$this->pinBackup();
} }
} }
} }
public function cleanQueue() public function cleanQueue(): void
{ {
$r = $this->request('deleteWebhook', []); $r = $this->request('deleteWebhook', []);
$r = $this->request('getUpdates', ['offset' => -1]); $r = $this->request('getUpdates', ['offset' => -1]);
@@ -1112,9 +1123,8 @@ class Bot
{ {
require __DIR__ . '/config.php'; require __DIR__ . '/config.php';
$conf = $this->getPacConf(); $conf = $this->getPacConf();
$bot = $this->request('getMyName', [])['result']['name']; $bot = preg_replace('~[\W]~iu', '_', $this->request('getMyName', [])['result']['name']);
$conf['pinbackup'] = $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export(), $c['admin'][0])['result']['message_id']; $conf['pinbackup'] = $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export(), $c['admin'][0])['result']['message_id'];
$conf['backup'] = implode(' / ', [date('Y-m-d H:i'), trim(explode('/', $conf['backup'])[1])]);
$this->setPacConf($conf); $this->setPacConf($conf);
$this->pinAdmin($conf['pinbackup']); $this->pinAdmin($conf['pinbackup']);
} }
@@ -1456,8 +1466,10 @@ class Bot
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out)); $this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->language = $this->getPacConf()['language'] ?: 'en'; $this->language = $this->getPacConf()['language'] ?: 'en';
$this->limit = $this->getPacConf()['limitpage'] ?: 5; $this->limit = $this->getPacConf()['limitpage'] ?: 5;
sleep(3); if (empty($file)) {
$this->menu(); sleep(3);
$this->menu();
}
} }
} }
@@ -1798,13 +1810,14 @@ class Bot
$ip = getenv('IP'); $ip = getenv('IP');
$r = $this->send($c['admin'][0], "start $ip"); $r = $this->send($c['admin'][0], "start $ip");
$this->input['chat'] = $c['admin'][0]; $this->input['chat'] = $c['admin'][0];
$this->input['message_id'] = $r['result']['message_id']; $this->input['message_id'] = $r['result']['message_id'];
$this->input['callback_id'] = false;
if (empty($p['domain'])) { if (empty($p['domain'])) {
$this->addDomain(str_replace('.', '-', $this->ip) . '.nip.io', 1); $this->addDomain(str_replace('.', '-', $this->ip) . '.nip.io', 1);
$this->setSSL('letsencrypt'); $this->setSSL('letsencrypt');
} }
$this->menu(dontshowcron: 1); $this->menu();
} }
public function comment($text, $tag) public function comment($text, $tag)
@@ -2460,7 +2473,10 @@ DNS-over-HTTPS with IP:
{ {
switch ($type) { switch ($type) {
case 'includelist': case 'includelist':
$this->pacUpdate(); $this->pacUpdate($_SESSION['proxylistentry']);
if (!empty($_SESSION['proxylistentry'])) {
$this->xtlsproxy();
}
break; break;
case 'blocklist': case 'blocklist':
$this->xrayUpdateRules(); $this->xrayUpdateRules();
@@ -3340,6 +3356,7 @@ DNS-over-HTTPS with IP:
public function pacMenu($page = 0) public function pacMenu($page = 0)
{ {
unset($_SESSION['proxylistentry']);
$rmpac = stat(__DIR__ . '/zapretlists/rmpac'); $rmpac = stat(__DIR__ . '/zapretlists/rmpac');
$rpac = stat(__DIR__ . '/zapretlists/rpac'); $rpac = stat(__DIR__ . '/zapretlists/rpac');
$mpac = stat(__DIR__ . '/zapretlists/mpac'); $mpac = stat(__DIR__ . '/zapretlists/mpac');
@@ -3420,7 +3437,7 @@ DNS-over-HTTPS with IP:
'callback_data' => "/addCommunityFilter", 'callback_data' => "/addCommunityFilter",
], ],
]; ];
$data = array_merge($data, $this->listPac('includelist', $page, 'pacMenu')); $data = array_merge($data, $this->listPac('includelist', $page, 'pacMenu')[0]);
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('back'), 'text' => $this->i18n('back'),
@@ -3559,7 +3576,7 @@ DNS-over-HTTPS with IP:
{ {
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> block list'; $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> block list';
$data = $this->listPac('blocklist', $page, 'xtlsblock'); [$data] = $this->listPac('blocklist', $page, 'xtlsblock');
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('back'), 'text' => $this->i18n('back'),
@@ -3578,7 +3595,26 @@ DNS-over-HTTPS with IP:
{ {
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> warp list'; $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> warp list';
$data = $this->listPac('warplist', $page, 'xtlswarp'); [$data] = $this->listPac('warplist', $page, 'xtlswarp');
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/routes",
],
];
$this->update(
$this->input['chat'],
$this->input['message_id'],
implode("\n", $text ?: ['...']),
$data ?: false,
);
}
public function xtlsproxy($page = 0)
{
$_SESSION['proxylistentry'] = 1;
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> proxy list';
[$data] = $this->listPac('includelist', $page, 'xtlsproxy');
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('back'), 'text' => $this->i18n('back'),
@@ -3613,7 +3649,7 @@ DNS-over-HTTPS with IP:
{ {
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> package list'; $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> package list';
$data = $this->listPac('packagelist', $page, 'xtlsapp'); [$data] = $this->listPac('packagelist', $page, 'xtlsapp');
$p = $this->getPacConf(); $p = $this->getPacConf();
$data[] = [ $data[] = [
[ [
@@ -3639,7 +3675,7 @@ DNS-over-HTTPS with IP:
{ {
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> process list'; $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> process list';
$data = $this->listPac('processlist', $page, 'xtlsprocess'); [$data] = $this->listPac('processlist', $page, 'xtlsprocess');
$p = $this->getPacConf(); $p = $this->getPacConf();
$data[] = [ $data[] = [
[ [
@@ -3665,7 +3701,8 @@ DNS-over-HTTPS with IP:
{ {
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> rulesset list'; $text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> rulesset list';
$data = $this->listPac('rulessetlist', $page, 'xtlsrulesset', 1); [$data, $tmp] = $this->listPac('rulessetlist', $page, 'xtlsrulesset', 1);
$text = array_merge($text, $tmp ?: []);
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('back'), 'text' => $this->i18n('back'),
@@ -3696,6 +3733,9 @@ DNS-over-HTTPS with IP:
$domains = array_slice($domains, $page * $this->limit, $this->limit, true); $domains = array_slice($domains, $page * $this->limit, $this->limit, true);
$i = 0; $i = 0;
foreach ($domains as $k => $v) { foreach ($domains as $k => $v) {
if ($type == 'rulessetlist') {
$text[] = "<blockquote><code>$k</code></blockquote>";
}
$data[] = [ $data[] = [
[ [
'text' => $this->i18n($v ? 'on' : 'off') . ' ' . ($basename ? basename($k) . ' ' : '') . (in_array($type, ['rulessetlist', 'packagelist', 'processlist']) ? $k : idn_to_utf8($k)), 'text' => $this->i18n($v ? 'on' : 'off') . ' ' . ($basename ? basename($k) . ' ' : '') . (in_array($type, ['rulessetlist', 'packagelist', 'processlist']) ? $k : idn_to_utf8($k)),
@@ -3742,7 +3782,7 @@ DNS-over-HTTPS with IP:
], ],
]; ];
} }
return $data; return [$data, $text];
} }
public function listPacChange($type, $action, $key) public function listPacChange($type, $action, $key)
@@ -3855,13 +3895,13 @@ DNS-over-HTTPS with IP:
$this->menu('wg', 0); $this->menu('wg', 0);
} }
public function menu($type = false, $arg = false, $return = false, $dontshowcron = false) public function menu($type = false, $arg = false, $return = false)
{ {
$domain = $this->getPacConf()['domain'] ?: $this->ip; $domain = $this->getPacConf()['domain'] ?: $this->ip;
$cron = exec('pgrep -f cron.php'); $cron = exec('pgrep -f cron.php');
$menu = [ $menu = [
'main' => [ 'main' => [
'text' => 'v' . getenv('VER') . ($dontshowcron ? '' : "\ncron: " . $this->i18n($cron ? 'on' : 'off') . ($cron ? '' : ' show <code>logs/php_error</code>')), 'text' => 'v' . getenv('VER') . ($this->dontshowcron ? '' : "\ncron: " . $this->i18n($cron ? 'on' : 'off') . ($cron ? '' : ' show <code>logs/php_error</code>')),
'data' => [ 'data' => [
[ [
[ [
@@ -4153,7 +4193,7 @@ DNS-over-HTTPS with IP:
$expose = $m[1]; $expose = $m[1];
$pass = htmlspecialchars($pac['ocserv']); $pass = htmlspecialchars($pac['ocserv']);
$text[] = "Menu -> OpenConnect"; $text[] = "Menu -> OpenConnect";
if (!empty($m[1])) { if (!empty($cs)) {
$text[] = "<code>https://oc.$domain/?$cs</code>"; $text[] = "<code>https://oc.$domain/?$cs</code>";
} }
$text[] = "password: <span class='tg-spoiler'>$pass</span>"; $text[] = "password: <span class='tg-spoiler'>$pass</span>";
@@ -4579,6 +4619,10 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('warp'), 'text' => $this->i18n('warp'),
'callback_data' => "/xtlswarp", 'callback_data' => "/xtlswarp",
]], ]],
[[
'text' => $this->i18n('proxy'),
'callback_data' => "/xtlsproxy",
]],
[[ [[
'text' => $this->i18n('process'), 'text' => $this->i18n('process'),
'callback_data' => "/xtlsprocess", 'callback_data' => "/xtlsprocess",
@@ -4648,23 +4692,33 @@ DNS-over-HTTPS with IP:
public function offWarp() public function offWarp()
{ {
$p = $this->getPacConf(); $p = $this->getPacConf();
if (empty($p['warpoff'])) { if (!empty($this->selfupdate)) {
$this->ssh('pkill warp-svc', 'wp'); if (!empty($p['warpoff'])) {
$p['warpoff'] = 1; $this->ssh('warp-cli --accept-tos registration delete 2>&1', 'wp');
} else { $this->ssh('pkill warp-svc', 'wp');
}
} elseif (!empty($p['warpoff'])) {
$this->ssh('warp-svc > /dev/null 2>&1 &', 'wp'); $this->ssh('warp-svc > /dev/null 2>&1 &', 'wp');
sleep(3); sleep(3);
$this->send($this->input['chat'], 'Registration: ' . $this->ssh('warp-cli --accept-tos registration new 2>&1', 'wp')); if (empty($this->ssh('[ -f "/var/lib/cloudflare-warp/conf.json" ] && echo 1', 'wp'))) {
if (!empty($p['warp'])) { $this->send($this->input['chat'], 'Registration: ' . $this->ssh('warp-cli --accept-tos registration new 2>&1', 'wp'));
$this->send($this->input['chat'], 'License: ' . $this->ssh("warp-cli --accept-tos registration license {$p['warp']} 2>&1", 'wp')); if (!empty($p['warp'])) {
$this->send($this->input['chat'], 'License: ' . $this->ssh("warp-cli --accept-tos registration license {$p['warp']} 2>&1", 'wp'));
}
} }
$this->send($this->input['chat'], 'Proxy mode: ' . $this->ssh('warp-cli --accept-tos mode proxy 2>&1', 'wp')); $this->send($this->input['chat'], 'Proxy mode: ' . $this->ssh('warp-cli --accept-tos mode proxy 2>&1', 'wp'));
$this->send($this->input['chat'], 'Connect: ' . $this->ssh('warp-cli --accept-tos connect 2>&1', 'wp')); $this->send($this->input['chat'], 'Connect: ' . $this->ssh('warp-cli --accept-tos connect 2>&1', 'wp'));
unset($p['warpoff']); unset($p['warpoff']);
} else {
$this->send($this->input['chat'], 'Registration delete: ' . $this->ssh('warp-cli --accept-tos registration delete 2>&1', 'wp'));
$this->ssh('pkill warp-svc', 'wp');
$p['warpoff'] = 1;
} }
$this->setPacConf($p); $this->setPacConf($p);
$this->warp(); if (empty($this->selfupdate)) {
$this->warp();
}
} }
public function warp() public function warp()
@@ -4672,7 +4726,7 @@ DNS-over-HTTPS with IP:
$p = $this->getPacConf(); $p = $this->getPacConf();
$text[] = "Menu -> " . $this->i18n('warp'); $text[] = "Menu -> " . $this->i18n('warp');
$text[] = "status: " . $this->warpStatus(); $text[] = "status: " . $this->warpStatus();
$text[] = "key: " . $this->getPacConf()['warp']; $text[] = "key: <code>{$this->getPacConf()['warp']}</code>";
$data[] = [ $data[] = [
[ [
'text' => $this->i18n($p['warpoff'] ? 'off' : 'on'), 'text' => $this->i18n($p['warpoff'] ? 'off' : 'on'),
@@ -5041,6 +5095,14 @@ DNS-over-HTTPS with IP:
} }
$json['routing']['rules'] = array_values($json['routing']['rules']); $json['routing']['rules'] = array_values($json['routing']['rules']);
} }
if (!empty($json['route']['rules'])) {
foreach ($json['route']['rules'] as $k => $v) {
if (count($v) < 2) {
unset($json['route']['rules'][$k]);
}
}
$json['route']['rules'] = array_values($json['route']['rules']);
}
return json_encode($json); return json_encode($json);
} }
@@ -5313,6 +5375,11 @@ DNS-over-HTTPS with IP:
$text .= "DNS over HTTPS:\n<code>$ip</code>\n<code>$scheme://$domain/dns-query" . ($conf['adguardkey'] ? "/{$conf['adguardkey']}" : '') . "</code>\n\n"; $text .= "DNS over HTTPS:\n<code>$ip</code>\n<code>$scheme://$domain/dns-query" . ($conf['adguardkey'] ? "/{$conf['adguardkey']}" : '') . "</code>\n\n";
$text .= "DNS over TLS:\n<code>tls://" . ($conf['adguardkey'] ? "{$conf['adguardkey']}." : '') . "$domain</code>"; $text .= "DNS over TLS:\n<code>tls://" . ($conf['adguardkey'] ? "{$conf['adguardkey']}." : '') . "$domain</code>";
} }
$safesearch = yaml_parse_file($this->adguard)['filtering']['safe_search']['enabled'];
$text .= "\n\nsafesearch: " . $this->i18n($safesearch ? 'on' : 'off');
$allowedClients = yaml_parse_file($this->adguard)['dns']['allowed_clients'];
$text .= $allowedClients ? "\n\nallowed clients: \n - " . implode("\n - ", $allowedClients) : '';
$data = [ $data = [
[ [
[ [
@@ -5337,6 +5404,16 @@ DNS-over-HTTPS with IP:
], ],
], ],
]; ];
$data[] = [
[
'text' => $this->i18n('fill allowed clients'),
'callback_data' => "/adgFillAllowedClients 0",
],
[
'text' => $this->i18n('delete allowed clients'),
'callback_data' => "/adgFillAllowedClients 1",
],
];
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('add upstream'), 'text' => $this->i18n('add upstream'),
@@ -5374,6 +5451,34 @@ DNS-over-HTTPS with IP:
]; ];
} }
public function adgFillAllowedClients($delete = false)
{
$pac = $this->getPacConf();
$out[] = 'Restart Adguard Home';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->stopAd();
$c = yaml_parse_file($this->adguard);
if (!empty($delete)) {
unset($c['dns']['allowed_clients']);
} else {
$c['dns']['allowed_clients'] = [];
if (!empty($pac['adguardKey'])) {
$c['dns']['allowed_clients'][] = $pac['adguardKey'];
}
$c['dns']['allowed_clients'][] = getenv('WGADDRESS');
$c['dns']['allowed_clients'][] = getenv('WG1ADDRESS');
$c['dns']['allowed_clients'][] = '10.0.2.0/24'; // openconnect
if (!empty($xr = $this->getXray())) {
foreach ($xr['inbounds'][0]['settings']['clients'] as $v) {
$c['dns']['allowed_clients'][] = $v['id'];
}
}
}
yaml_emit_file($this->adguard, $c);
$this->startAd();
$this->menu('adguard');
}
public function menuLang() public function menuLang()
{ {
$data = []; $data = [];
@@ -5449,7 +5554,7 @@ DNS-over-HTTPS with IP:
]; ];
exec("git -C / branch -vv", $mm); exec("git -C / branch -vv", $mm);
return [ return [
'text' => '<pre><code class="language-shell">' . implode("\n", $mm) . '</code></pre>', 'text' => '<pre><code class="language-shell">' . htmlentities(implode("\n", $mm)) . '</code></pre>',
'data' => $data, 'data' => $data,
]; ];
} }
@@ -5732,28 +5837,22 @@ DNS-over-HTTPS with IP:
public function selfUpdate() public function selfUpdate()
{ {
require __DIR__ . '/config.php'; $ip = getenv('IP');
if (!empty($c['admin'])) { $rm = explode(':', trim(file_get_contents('/update/reload_message')));
$ip = getenv('IP'); $m = file_get_contents('/update/message');
$rm = explode(':', trim(file_get_contents('/update/reload_message'))); $this->input['chat'] = $rm[0];
$m = file_get_contents('/update/message'); $this->input['message_id'] = $rm[1];
if (file_exists($this->update)) { $this->input['callback_id'] = $rm[1];
$r = $this->send($c['admin'][0], "start update"); if (file_exists($this->update)) {
$this->input['chat'] = $c['admin'][0]; $this->selfupdate = true;
$this->input['message_id'] = $r['result']['message_id']; if (!empty($m)) {
if (!empty($m)) { $this->send($this->input['chat'], "<pre>$m</pre>", $rm[1]);
$this->send($c['admin'][0], "<pre>$m</pre>", $rm[1]);
}
$r = $this->send($c['admin'][0], "import settings");
$this->input['chat'] = $c['admin'][0];
$this->input['message_id'] = $r['result']['message_id'];
$this->input['callback_id'] = $r['result']['message_id'];
if (empty($flag)) {
$this->importFile($this->update);
unlink($this->update);
$flag = true;
}
} }
$r = $this->send($this->input['chat'], "import settings");
$this->input['message_id'] = $r['result']['message_id'];
$this->input['callback_id'] = $r['result']['message_id'];
$this->importFile($this->update);
unlink($this->update);
} }
file_put_contents('/update/message', ''); file_put_contents('/update/message', '');
file_put_contents('/update/reload_message', ''); file_put_contents('/update/reload_message', '');
@@ -6013,25 +6112,25 @@ DNS-over-HTTPS with IP:
public function createConfig($data) public function createConfig($data)
{ {
$pac = $this->getPacConf();
$conf[] = "[Interface]"; $conf[] = "[Interface]";
if (empty($data['interface']['ListenPort'])) { if (empty($data['interface']['ListenPort'])) {
if (empty($data['interface']['DNS'])) { if (empty($data['interface']['DNS'])) {
$data['interface']['DNS'] = $this->getPacConf()[$this->getInstanceWG(1) . 'dns'] ?: $this->dns; $data['interface']['DNS'] = $pac[$this->getInstanceWG(1) . 'dns'] ?: $this->dns;
} }
if (empty($data['interface']['MTU'])) { if (empty($data['interface']['MTU'])) {
$data['interface']['MTU'] = $this->getPacConf()[$this->getInstanceWG(1) . 'mtu'] ?: $this->mtu; $data['interface']['MTU'] = $pac[$this->getInstanceWG(1) . 'mtu'] ?: $this->mtu;
} }
} }
foreach ($data['interface'] as $k => $v) { foreach ($data['interface'] as $k => $v) {
$conf[] = "$k = $v"; $conf[] = "$k = $v";
} }
$pac = $this->getPacConf();
if (!empty($data['peers'])) { if (!empty($data['peers'])) {
foreach ($data['peers'] as $peer) { foreach ($data['peers'] as $peer) {
$conf[] = ''; $conf[] = '';
$conf[] = $peer['# PublicKey'] ? '# [Peer]' : '[Peer]'; $conf[] = $peer['# PublicKey'] ? '# [Peer]' : '[Peer]';
if (!empty($peer['Endpoint'])) { if (!empty($peer['Endpoint'])) {
$peer['Endpoint'] = ($this->getPacConf()[$this->getInstanceWG(1) . 'endpoint'] ? $this->ip : $this->getDomain()) . ":" . getenv($this->getInstanceWG(1) ? 'WG1PORT' : 'WGPORT'); $peer['Endpoint'] = ($pac[$this->getInstanceWG(1) . 'endpoint'] ? $this->ip : $this->getDomain()) . ":" . getenv($this->getInstanceWG(1) ? 'WG1PORT' : 'WGPORT');
} }
foreach ($peer as $k => $v) { foreach ($peer as $k => $v) {
$conf[] = "$k = $v"; $conf[] = "$k = $v";
+10 -2
View File
@@ -282,8 +282,8 @@ $i = [
'ru' => 'пагинация', 'ru' => 'пагинация',
], ],
'exchange' => [ 'exchange' => [
'en' => 'open ip', 'en' => 'client isolation',
'ru' => 'откр айпи', 'ru' => 'изоляция клиентов',
], ],
'ocserv' => [ 'ocserv' => [
'en' => 'OpenConnect', 'en' => 'OpenConnect',
@@ -345,4 +345,12 @@ $i = [
'en' => 'expose-iroutes', 'en' => 'expose-iroutes',
'ru' => 'изоляция клиентов', 'ru' => 'изоляция клиентов',
], ],
'fill allowed clients' => [
'en' => 'fill allowed clients',
'ru' => 'заполнить белый список клиентов',
],
'delete allowed clients' => [
'en' => 'delete allowed clients',
'ru' => 'очистить белый список клиентов',
],
]; ];
+3
View File
@@ -11,6 +11,9 @@ if ('POST' == $_SERVER['REQUEST_METHOD'] && $_GET['k'] == $c['key']) {
require __DIR__ . '/calc.php'; require __DIR__ . '/calc.php';
require __DIR__ . '/bot.php'; require __DIR__ . '/bot.php';
require __DIR__ . '/i18n.php'; require __DIR__ . '/i18n.php';
if (file_exists(__DIR__ . '/override.php')) {
include __DIR__ . '/override.php';
}
$bot = new Bot($c['key'], $i); $bot = new Bot($c['key'], $i);
$bot->input(); $bot->input();
exit; exit;
-1
View File
@@ -12,7 +12,6 @@ if ($c['debug']) {
$bot = new Bot($c['key'], $i); $bot = new Bot($c['key'], $i);
$bot->cleanQueue(); $bot->cleanQueue();
$bot->setwebhook(); $bot->setwebhook();
$bot->selfUpdate();
$bot->adguardCheckPswd(); $bot->adguardCheckPswd();
$bot->adguardProtect(); $bot->adguardProtect();
$bot->syncPortClients(); $bot->syncPortClients();
+5
View File
@@ -12,6 +12,11 @@ if ($c['debug']) {
$bot = new Bot($c['key'], $i); $bot = new Bot($c['key'], $i);
$bot->selfUpdate();
$bot->restartTG(); $bot->restartTG();
if (!empty($bot->selfupdate)) {
$bot->offWarp();
}
$bot->dontshowcron = 1;
$bot->sslip(); $bot->sslip();
$bot->cleanDocker(); $bot->cleanDocker();
+3
View File
@@ -16,5 +16,8 @@ dns:
tls: tls:
certificate_path: /certs/cert_public certificate_path: /certs/cert_public
private_key_path: /certs/cert_private private_key_path: /certs/cert_private
filtering:
safe_search:
enabled: false
log: log:
file: /logs/adguard file: /logs/adguard
+2
View File
@@ -16,6 +16,7 @@ networks:
- subnet: 10.10.1.0/24 - subnet: 10.10.1.0/24
volumes: volumes:
adguard: adguard:
warp:
services: services:
up: up:
@@ -510,6 +511,7 @@ services:
- ./config:/config - ./config:/config
- ./certs:/certs - ./certs:/certs
- ./scripts/start_wp.sh:/start_wp.sh - ./scripts/start_wp.sh:/start_wp.sh
- warp:/var/lib/cloudflare-warp
hostname: warp hostname: warp
container_name: warp-${VER} container_name: warp-${VER}
depends_on: depends_on:
+6 -3
View File
@@ -7,10 +7,13 @@ if [ "$off" == 'null' ]
then then
warp-svc > /dev/null & warp-svc > /dev/null &
sleep 3 sleep 3
warp-cli --accept-tos registration new if [ ! -f /var/lib/cloudflare-warp/conf.json ]
if [ ! -z "$key" ]
then then
warp-cli --accept-tos registration license $key warp-cli --accept-tos registration new
if [ ! -z "$key" ]
then
warp-cli --accept-tos registration license $key
fi
fi fi
warp-cli --accept-tos mode proxy warp-cli --accept-tos mode proxy
warp-cli --accept-tos connect warp-cli --accept-tos connect
Binary file not shown.
+33
View File
@@ -1,3 +1,36 @@
27.10.2024 v1.90
- очередной фикс запуска warp после апдейта
- правки фраз меню
26.10.2024 v1.89
- xray rulesset: фикс меню при отсутствующих правилах
26.10.2024 v1.88
- xray rulesset: дублирование кнопок текстом
- singbox 1.10.1 для windows x64
- фикс с включенным warp после апдейта
- фикс с нерабочей кнопкой апдейта, обновится можно через /autoupdate если поймали не рабочую кнопку апдейта
25.10.2024 v1.87
- xray: в routes добавлен раздел proxy - зеркало раздела Pac
25.10.2024 v1.86
- фикс не срабатывания автобэкапа во время старта
- adguard: вывод списка разрешенных клиентов
- adguard: кнопка заполнения разрешенных клиентов - собирает все clientId со всех контейнеров
- adguard: вывод статуса безопасного поиска
- warp: при выключении удаляется регистрация deviceid
24.10.2024 v1.85
- фикс удаления состояния warp после рестарта
- возможность перезаписать фразы меню бота через app/override.php
24.10.2024 v1.84
- фикс показа ссылки для openconnect
24.10.2024 v1.83
- фикс ошибок доступа контейнеров при автообновлении
23.10.2024 v1.82
- фикс автобэкапа
23.10.2024 v1.81
- фикс краша wireguard после апдейта
23.10.2024 v1.80
- фикс пустых правил для singbox
23.10.2024 v1.79
- улучшение процесса обновления
23.10.2024 v1.78 23.10.2024 v1.78
- фикс двойного импорта при обновлении, когда админов больше одного - фикс двойного импорта при обновлении, когда админов больше одного
- рестарт бота сбрасывает очередь сообщений от телеграма - рестарт бота сбрасывает очередь сообщений от телеграма