Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e40daf0c4 | |||
| 9c40b04392 | |||
| 1217ea7a09 | |||
| 7f6d462f22 | |||
| 47876ecdb4 | |||
| 66f03709fc | |||
| 1674f6929e |
+29
-14
@@ -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;
|
||||
@@ -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 {
|
||||
@@ -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'),
|
||||
@@ -3721,7 +3739,7 @@ DNS-over-HTTPS with IP:
|
||||
$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";
|
||||
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 = [])
|
||||
@@ -4641,21 +4659,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user