Compare commits

...

11 Commits

Author SHA1 Message Date
mercury a82147eeda update version 2024-08-26 23:23:09 +04:00
mercury 6bd21d06c0 fix list actions 2024-08-26 23:19:31 +04:00
mercury 3416cda826 qr for singbox 2024-08-25 23:30:19 +04:00
mercury 2e40daf0c4 update version 2024-08-21 23:04:58 +04:00
mercury 9c40b04392 custom outbound for ruleset 2024-08-18 20:01:53 +04:00
mercury 1217ea7a09 fix empty packagelist 2024-08-18 11:54:12 +04:00
mercury 7f6d462f22 fix name for short link vless 2024-08-18 02:11:05 +04:00
mercury 47876ecdb4 rule package_name separately 2024-08-18 02:00:09 +04:00
mercury 66f03709fc Merge branch 'master' into dev 2024-08-16 22:27:14 +04:00
mercury 42aafc6427 update version 2024-08-16 22:26:42 +04:00
mercury 1674f6929e fix ruleset list key 2024-08-16 22:24:23 +04:00
2 changed files with 68 additions and 27 deletions
+61 -27
View File
@@ -136,6 +136,9 @@ class Bot
case preg_match('~^/mirror$~', $this->input['message'], $m):
$this->menu('mirror');
break;
case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
$this->appOutbound();
break;
case preg_match('~^/id$~', $this->input['message'], $m):
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
break;
@@ -350,8 +353,8 @@ class Bot
case preg_match('~^/qrSS$~', $this->input['callback'], $m):
$this->qrSS();
break;
case preg_match('~^/qrXray (\d+)$~', $this->input['callback'], $m):
$this->qrXray($m[1]);
case preg_match('~^/qrXray (\d+)(?:_(\d+))?$~', $this->input['callback'], $m):
$this->qrXray($m[1], $m[2] ?: false);
break;
case preg_match('~^/qrMtproto$~', $this->input['callback'], $m):
$this->qrMtproto();
@@ -960,7 +963,7 @@ class Bot
if (!empty($s = trim($v))) {
$t = explode(';', $s);
if ($type == 'rulessetlist') {
if (preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $t[0])) {
if (preg_match('~^.+:.+:https?://.+~', $t[0])) {
$list[$t[0]] = (bool) $t[1];
}
} else {
@@ -1601,9 +1604,9 @@ class Bot
}
}
public function qrXray($i)
public function qrXray($i, $s = false)
{
$link = $this->linkXray($i);
$link = $this->linkXray($i, $s);
$qr_file = __DIR__ . "/qr/xray.png";
exec("qrencode -t png -o $qr_file '$link'");
$r = $this->sendPhoto(
@@ -2241,8 +2244,8 @@ DNS-over-HTTPS with IP:
public function addInclude(string $domains, $type)
{
if ($type == 'rulessetlist' && !preg_match('~^(?:direct|block|proxy):.+:https?://.+~', $domains)) {
$this->send($this->input['from'], 'wrong pattern, enter [direct|block|proxy]:time:URL');
if ($type == 'rulessetlist' && !preg_match('~^.+:.+:https?://.+~', $domains)) {
$this->send($this->input['from'], 'wrong pattern, enter [direct|block|proxy|custom outbound]:time:URL');
return;
}
$domains = explode(',', $domains);
@@ -2250,7 +2253,7 @@ DNS-over-HTTPS with IP:
if (!empty($domains)) {
$conf = $this->getPacConf();
foreach ($domains as $k => $v) {
$conf[$type][idn_to_ascii(trim($v))] = true;
$conf[$type][$type == 'rulessetlist' ? trim($v) : idn_to_ascii(trim($v))] = true;
}
ksort($conf[$type]);
$this->setPacConf($conf);
@@ -3383,11 +3386,26 @@ DNS-over-HTTPS with IP:
);
}
public function appOutbound()
{
$p = $this->getPacConf();
$p['app_outbound'] = !$p['app_outbound'];
$p = $this->setPacConf($p);
$this->xtlsapp();
}
public function xtlsapp($page = 0)
{
$text[] = "Menu -> " . $this->i18n('xray') . ' -> ' . $this->i18n('routes') . ' -> package list';
$data = $this->listPac('packagelist', $page, 'xtlsapp');
$p = $this->getPacConf();
$data[] = [
[
'text' => 'set to ' . ($p['app_outbound'] ? 'proxy' : 'direct'),
'callback_data' => "/appOutbound",
],
];
$data[] = [
[
'text' => $this->i18n('back'),
@@ -3440,11 +3458,11 @@ DNS-over-HTTPS with IP:
$data[] = [
[
'text' => $this->i18n($v ? 'on' : 'off') . ' ' . ($basename ? basename($k) . ' ' : '') . idn_to_utf8($k),
'callback_data' => "/change$type $i",
'callback_data' => "/change$type " . ($i + $page * $this->limit),
],
[
'text' => 'delete',
'callback_data' => "/delete$type $i",
'callback_data' => "/delete$type " . ($i + $page * $this->limit),
],
];
$i++;
@@ -3711,17 +3729,28 @@ DNS-over-HTTPS with IP:
}
}
public function geodb()
{
$this->answer($this->input['callback_id'], 'in developing...');
}
public function linkXray($i)
public function linkXray($i, $s = false)
{
$c = $this->getXray();
$pac = $this->getPacConf();
$domain = $pac['domain'] ?: $this->ip;
return "vless://{$c['inbounds'][0]['settings']['clients'][$i]['id']}@$domain:443?security=reality&sni={$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}&fp=chrome&pbk={$pac['xray']}&sid={$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0]}&type=tcp&flow=xtls-rprx-vision#vpnbot";
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
$hash = substr(md5($this->key), 0, 8);
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
'h' => $hash,
't' => 'si',
's' => $c['inbounds'][0]['settings']['clients'][$i]['id'],
]));
switch ($s) {
case 1:
return "$scheme://{$domain}/pac?h=$hash&t=s&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}";
case 2:
return "sing-box://import-remote-profile/?url={$si}#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
default:
return "vless://{$c['inbounds'][0]['settings']['clients'][$i]['id']}@$domain:443?security=reality&sni={$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}&fp=chrome&pbk={$pac['xray']}&sid={$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0]}&type=tcp&flow=xtls-rprx-vision#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
}
}
public function dockerApi($url, $method = 'GET', $data = [])
@@ -4441,9 +4470,17 @@ DNS-over-HTTPS with IP:
];
$data[] = [
[
'text' => $this->i18n('show QR'),
'text' => $this->i18n('qr short'),
'callback_data' => "/qrXray $i",
],
[
'text' => $this->i18n('qr v2ray'),
'callback_data' => "/qrXray {$i}_1",
],
[
'text' => $this->i18n('qr singbox'),
'callback_data' => "/qrXray {$i}_2",
],
];
$data[] = [
[
@@ -4641,21 +4678,18 @@ DNS-over-HTTPS with IP:
unset($route['rules'][$k]);
}
}
$route['rules'] = array_values($route['rules']);
return $route;
}
public function addPackageRule($route)
{
foreach ($route['rules'] as $k => $v) {
$t[$v['outbound']] = $k;
}
$p = $this->getPacConf();
if (!empty($p['packagelist'])) {
foreach ($p['packagelist'] as $k => $v) {
if (!empty($v)) {
$route['rules'][$t['proxy']]['package_name'][] = $k;
}
}
if (!empty($t = array_filter($p['packagelist'] ?: []))) {
$route['rules'][] = [
'package_name' => array_keys($t),
'outbound' => $p['app_outbound'] ? 'direct' : 'proxy',
];
}
return $route;
}
+7
View File
@@ -1,3 +1,10 @@
26.08.2024 v1.44
- qr для xtls
- фикс действий на элементом списков
21.08.2024 v1.43
- singbox:поддержка кастомных outbound для ruleset
16.08.2024 v1.42.1
- фикс добавления рулсетов с длинными урл
16.08.2024 v1.42
- добавлена возможность сохранять/восстанавливать список доменов/правил маршрутизации
- изменена ссылка на сингбокс-конфиг для совместимости с клиентом сингбокса (фикс импорта в sing-box)