Compare commits

..

10 Commits

Author SHA1 Message Date
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
7 changed files with 117 additions and 14 deletions
+2 -1
View File
@@ -20,4 +20,5 @@ update/*
!update/update.sh
override.env
override.html
override.html
override.php
+90 -10
View File
@@ -142,6 +142,9 @@ class Bot
case preg_match('~^/autoupdate$~', $this->input['message'], $m):
$this->autoupdate();
break;
case preg_match('~^/adgFillAllowedClients(?: (\d+))?$~', $this->input['callback'], $m):
$this->adgFillAllowedClients($m[1] ?: false);
break;
case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
$this->appOutbound();
break;
@@ -434,6 +437,9 @@ class Bot
case preg_match('~^/xtlswarp(?: (\d+))?$~', $this->input['callback'], $m):
$this->xtlswarp($m[1] ?: 0);
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):
$this->xtlsapp($m[1] ?: 0);
break;
@@ -1063,17 +1069,18 @@ class Bot
public function cron()
{
$period = 10;
while (true) {
$this->shutdownClient();
$this->shutdownClientXr();
$this->checkVersion();
$this->checkBackup();
$this->checkBackup($period);
$this->checkCert();
sleep(10);
sleep($period);
}
}
public function checkBackup()
public function checkBackup($delta)
{
$c = $this->getPacConf();
if (!empty($c['backup'])) {
@@ -1085,8 +1092,8 @@ class Bot
!empty($start)
&& !empty($period)
&& empty($this->backup)
&& $now - $start >= $period
&& ($now - $start) % $period < 10
&& $now - $start >= 0
&& (($now - $start) % $period < $delta)
) {
if (!empty($c['pinbackup'])) {
$this->pinAdmin($c['pinbackup'], 1);
@@ -2466,7 +2473,10 @@ DNS-over-HTTPS with IP:
{
switch ($type) {
case 'includelist':
$this->pacUpdate();
$this->pacUpdate($_SESSION['proxylistentry']);
if (!empty($_SESSION['proxylistentry'])) {
$this->xtlsproxy();
}
break;
case 'blocklist':
$this->xrayUpdateRules();
@@ -3346,6 +3356,7 @@ DNS-over-HTTPS with IP:
public function pacMenu($page = 0)
{
unset($_SESSION['proxylistentry']);
$rmpac = stat(__DIR__ . '/zapretlists/rmpac');
$rpac = stat(__DIR__ . '/zapretlists/rpac');
$mpac = stat(__DIR__ . '/zapretlists/mpac');
@@ -3599,6 +3610,25 @@ DNS-over-HTTPS with IP:
);
}
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[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/routes",
],
];
$this->update(
$this->input['chat'],
$this->input['message_id'],
implode("\n", $text ?: ['...']),
$data ?: false,
);
}
public function appOutbound()
{
$p = $this->getPacConf();
@@ -4585,6 +4615,10 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('warp'),
'callback_data' => "/xtlswarp",
]],
[[
'text' => $this->i18n('proxy'),
'callback_data' => "/xtlsproxy",
]],
[[
'text' => $this->i18n('process'),
'callback_data' => "/xtlsprocess",
@@ -4656,14 +4690,17 @@ DNS-over-HTTPS with IP:
{
$p = $this->getPacConf();
if (empty($p['warpoff'])) {
$this->ssh('warp-cli --accept-tos registration delete', 'wp');
$this->ssh('pkill warp-svc', 'wp');
$p['warpoff'] = 1;
} else {
$this->ssh('warp-svc > /dev/null 2>&1 &', 'wp');
sleep(3);
$this->send($this->input['chat'], 'Registration: ' . $this->ssh('warp-cli --accept-tos registration new 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'));
if (empty($this->ssh('[ -f "/var/lib/cloudflare-warp/conf.json" ] && echo 1', 'wp'))) {
$this->send($this->input['chat'], 'Registration: ' . $this->ssh('warp-cli --accept-tos registration new 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'], 'Connect: ' . $this->ssh('warp-cli --accept-tos connect 2>&1', 'wp'));
@@ -4678,7 +4715,7 @@ DNS-over-HTTPS with IP:
$p = $this->getPacConf();
$text[] = "Menu -> " . $this->i18n('warp');
$text[] = "status: " . $this->warpStatus();
$text[] = "key: " . $this->getPacConf()['warp'];
$text[] = "key: <code>{$this->getPacConf()['warp']}</code>";
$data[] = [
[
'text' => $this->i18n($p['warpoff'] ? 'off' : 'on'),
@@ -5327,6 +5364,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 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 = [
[
[
@@ -5351,6 +5393,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[] = [
[
'text' => $this->i18n('add upstream'),
@@ -5388,6 +5440,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()
{
$data = [];
+3
View File
@@ -11,6 +11,9 @@ if ('POST' == $_SERVER['REQUEST_METHOD'] && $_GET['k'] == $c['key']) {
require __DIR__ . '/calc.php';
require __DIR__ . '/bot.php';
require __DIR__ . '/i18n.php';
if (file_exists(__DIR__ . '/override.php')) {
include __DIR__ . '/override.php';
}
$bot = new Bot($c['key'], $i);
$bot->input();
exit;
+3
View File
@@ -16,5 +16,8 @@ dns:
tls:
certificate_path: /certs/cert_public
private_key_path: /certs/cert_private
filtering:
safe_search:
enabled: false
log:
file: /logs/adguard
+2
View File
@@ -16,6 +16,7 @@ networks:
- subnet: 10.10.1.0/24
volumes:
adguard:
warp:
services:
up:
@@ -510,6 +511,7 @@ services:
- ./config:/config
- ./certs:/certs
- ./scripts/start_wp.sh:/start_wp.sh
- warp:/var/lib/cloudflare-warp
hostname: warp
container_name: warp-${VER}
depends_on:
+6 -3
View File
@@ -7,10 +7,13 @@ if [ "$off" == 'null' ]
then
warp-svc > /dev/null &
sleep 3
warp-cli --accept-tos registration new
if [ ! -z "$key" ]
if [ ! -f /var/lib/cloudflare-warp/conf.json ]
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
warp-cli --accept-tos mode proxy
warp-cli --accept-tos connect
+11
View File
@@ -1,3 +1,14 @@
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