Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ef0de6e1c | |||
| 1cf24407c0 | |||
| d3470bd8ea | |||
| 1fcddf49e3 | |||
| a0d9bada2b | |||
| 32109c4526 | |||
| ca37736cd5 |
+46
-11
@@ -401,6 +401,9 @@ class Bot
|
||||
case preg_match('~^/deldomain$~', $this->input['callback'], $m):
|
||||
$this->delDomain();
|
||||
break;
|
||||
case preg_match('~^/addNipdomain$~', $this->input['callback'], $m):
|
||||
$this->addNipdomain();
|
||||
break;
|
||||
case preg_match('~^/(?P<action>change|delete)(?P<typelist>\w+) (?P<arg>\d+)$~', $this->input['callback'], $m):
|
||||
$this->listPacChange($m['typelist'], $m['action'], $m['arg']);
|
||||
break;
|
||||
@@ -452,6 +455,9 @@ class Bot
|
||||
case preg_match('~^/delTemplate (\w+)(?: (.+))?$~', $this->input['callback'], $m):
|
||||
$this->delTemplate($m[1], $m[2]);
|
||||
break;
|
||||
case preg_match('~^/downloadOrigin (\w+)$~', $this->input['callback'], $m):
|
||||
$this->downloadOrigin($m[1]);
|
||||
break;
|
||||
case preg_match('~^/downloadTemplate (\w+)(?: (.+))?$~', $this->input['callback'], $m):
|
||||
$this->downloadTemplate($m[1], $m[2]);
|
||||
break;
|
||||
@@ -1765,6 +1771,11 @@ class Bot
|
||||
}
|
||||
}
|
||||
|
||||
public function addNipdomain()
|
||||
{
|
||||
$this->addDomain(str_replace('.', '-', $this->ip) . '.nip.io');
|
||||
}
|
||||
|
||||
public function addDomain($domain, $nomenu = false)
|
||||
{
|
||||
$domain = trim($domain);
|
||||
@@ -3701,7 +3712,8 @@ DNS-over-HTTPS with IP:
|
||||
{
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> rulesset list';
|
||||
|
||||
[$data, $text] = $this->listPac('rulessetlist', $page, 'xtlsrulesset', 1);
|
||||
[$data, $tmp] = $this->listPac('rulessetlist', $page, 'xtlsrulesset', 1);
|
||||
$text = array_merge($text, $tmp ?: []);
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
@@ -4406,6 +4418,19 @@ DNS-over-HTTPS with IP:
|
||||
$this->templates($type);
|
||||
}
|
||||
|
||||
public function downloadOrigin($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case 'sing':
|
||||
$f = new \CURLFile('/config/sing.json', 'application/json', 'origin.json');
|
||||
break;
|
||||
case 'v2ray':
|
||||
$f = new \CURLFile('/config/v2ray.json', 'application/json', 'origin.json');
|
||||
break;
|
||||
}
|
||||
$this->sendFile($this->input['chat'], $f);
|
||||
}
|
||||
|
||||
public function downloadTemplate($type, $name)
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
@@ -4444,6 +4469,10 @@ DNS-over-HTTPS with IP:
|
||||
'text' => "origin",
|
||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('download'),
|
||||
'callback_data' => "/downloadOrigin $type",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]) ? 'off' : 'on'),
|
||||
'callback_data' => "/defaultTemplate $type",
|
||||
@@ -4452,7 +4481,7 @@ DNS-over-HTTPS with IP:
|
||||
foreach ($templates as $k => $v) {
|
||||
$data[] = [
|
||||
[
|
||||
'text' => "$k",
|
||||
'text' => $k,
|
||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type&te=" . urlencode($k)],
|
||||
],
|
||||
[
|
||||
@@ -4689,10 +4718,15 @@ DNS-over-HTTPS with IP:
|
||||
return 'off';
|
||||
}
|
||||
|
||||
public function offWarp($inversion = true)
|
||||
public function offWarp()
|
||||
{
|
||||
$p = $this->getPacConf();
|
||||
if ($inversion && !empty($p['warpoff'])) {
|
||||
$p = $this->getPacConf();
|
||||
if (!empty($this->selfupdate)) {
|
||||
if (!empty($p['warpoff'])) {
|
||||
$this->ssh('warp-cli --accept-tos registration delete 2>&1', 'wp');
|
||||
$this->ssh('pkill warp-svc', 'wp');
|
||||
}
|
||||
} elseif (!empty($p['warpoff'])) {
|
||||
$this->ssh('warp-svc > /dev/null 2>&1 &', 'wp');
|
||||
sleep(3);
|
||||
if (empty($this->ssh('[ -f "/var/lib/cloudflare-warp/conf.json" ] && echo 1', 'wp'))) {
|
||||
@@ -4705,16 +4739,12 @@ DNS-over-HTTPS with IP:
|
||||
$this->send($this->input['chat'], 'Connect: ' . $this->ssh('warp-cli --accept-tos connect 2>&1', 'wp'));
|
||||
unset($p['warpoff']);
|
||||
} else {
|
||||
if (empty($inversion)) {
|
||||
$this->ssh('warp-cli --accept-tos registration delete 2>&1', 'wp');
|
||||
} else {
|
||||
$this->send($this->input['chat'], 'Registration delete: ' . $this->ssh('warp-cli --accept-tos registration delete 2>&1', 'wp'));
|
||||
}
|
||||
$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);
|
||||
if (!empty($inversion)) {
|
||||
if (empty($this->selfupdate)) {
|
||||
$this->warp();
|
||||
}
|
||||
}
|
||||
@@ -5596,6 +5626,10 @@ DNS-over-HTTPS with IP:
|
||||
'text' => $this->i18n('+ subdomain'),
|
||||
'callback_data' => '/addSubdomain',
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('nip.io'),
|
||||
'callback_data' => '/addNipdomain',
|
||||
],
|
||||
],
|
||||
];
|
||||
if ($conf['domain']) {
|
||||
@@ -5842,6 +5876,7 @@ DNS-over-HTTPS with IP:
|
||||
$this->input['message_id'] = $rm[1];
|
||||
$this->input['callback_id'] = $rm[1];
|
||||
if (file_exists($this->update)) {
|
||||
$this->selfupdate = true;
|
||||
if (!empty($m)) {
|
||||
$this->send($this->input['chat'], "<pre>$m</pre>", $rm[1]);
|
||||
}
|
||||
|
||||
+10
-2
@@ -282,8 +282,8 @@ $i = [
|
||||
'ru' => 'пагинация',
|
||||
],
|
||||
'exchange' => [
|
||||
'en' => 'open ip',
|
||||
'ru' => 'откр айпи',
|
||||
'en' => 'client isolation',
|
||||
'ru' => 'изоляция клиентов',
|
||||
],
|
||||
'ocserv' => [
|
||||
'en' => 'OpenConnect',
|
||||
@@ -345,4 +345,12 @@ $i = [
|
||||
'en' => 'expose-iroutes',
|
||||
'ru' => 'изоляция клиентов',
|
||||
],
|
||||
'fill allowed clients' => [
|
||||
'en' => 'fill allowed clients',
|
||||
'ru' => 'заполнить белый список клиентов',
|
||||
],
|
||||
'delete allowed clients' => [
|
||||
'en' => 'delete allowed clients',
|
||||
'ru' => 'очистить белый список клиентов',
|
||||
],
|
||||
];
|
||||
|
||||
+3
-1
@@ -14,7 +14,9 @@ $bot = new Bot($c['key'], $i);
|
||||
|
||||
$bot->selfUpdate();
|
||||
$bot->restartTG();
|
||||
$bot->offWarp(0);
|
||||
if (!empty($bot->selfupdate)) {
|
||||
$bot->offWarp();
|
||||
}
|
||||
$bot->dontshowcron = 1;
|
||||
$bot->sslip();
|
||||
$bot->cleanDocker();
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
30.10.2024 v1.92
|
||||
- возможность скачать origin шаблон
|
||||
30.10.2024 v1.91
|
||||
- кнопка nip.io для быстрой смены домена
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user