Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 10d84da53e | |||
| c7cc0f31ad | |||
| e3ddb642d7 | |||
| 589823e45d | |||
| 0364188fe8 |
+62
-16
@@ -142,6 +142,9 @@ class Bot
|
||||
case preg_match('~^/appOutbound$~', $this->input['callback'], $m):
|
||||
$this->appOutbound();
|
||||
break;
|
||||
case preg_match('~^/addSubdomain$~', $this->input['callback'], $m):
|
||||
$this->addSubdomain();
|
||||
break;
|
||||
case preg_match('~^/id$~', $this->input['message'], $m):
|
||||
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
|
||||
break;
|
||||
@@ -1372,7 +1375,7 @@ class Bot
|
||||
|
||||
$t = file_get_contents('/config/nginx_default.conf');
|
||||
if (!empty($json['pac']['domain'])) {
|
||||
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$json['pac']['domain']};", $t);
|
||||
$t = preg_replace('/server_name ([^\n]+)?/', "server_name *.{$json['pac']['domain']} {$json['pac']['domain']};", $t);
|
||||
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
||||
foreach ($m[0] as $k => $v) {
|
||||
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
||||
@@ -1693,7 +1696,7 @@ class Bot
|
||||
$conf = $this->getPacConf();
|
||||
$conf['domain'] = idn_to_ascii($domain);
|
||||
$nginx = file_get_contents('/config/nginx.conf');
|
||||
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$conf['domain']};", $nginx);
|
||||
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$conf['domain']} *.{$conf['domain']};", $nginx);
|
||||
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
||||
foreach ($m[0] as $k => $v) {
|
||||
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
||||
@@ -1803,9 +1806,9 @@ class Bot
|
||||
case 'letsencrypt':
|
||||
$out[] = 'Install certificate:';
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$adguardClient = $this->getPacConf()['adguardkey'];
|
||||
$adguardClient = $adguardClient ? "-d $adguardClient.{$conf['domain']}" : '';
|
||||
exec("certbot certonly --force-renew --preferred-chain 'ISRG Root X1' -n --agree-tos --email mail@{$conf['domain']} -d {$conf['domain']} -d oc.{$conf['domain']} -d np.{$conf['domain']} $adguardClient --webroot -w /certs/ --logs-dir /logs --max-log-backups 0 2>&1", $out, $code);
|
||||
$adguardClient = $conf['adguardkey'] ? "-d {$conf['adguardkey']}.{$conf['domain']}" : '';
|
||||
$custom = $conf['subdomain'] ? "-d {$conf['subdomain']}.{$conf['domain']}" : '';
|
||||
exec("certbot certonly --force-renew --preferred-chain 'ISRG Root X1' -n --agree-tos --email mail@{$conf['domain']} -d {$conf['domain']} -d oc.{$conf['domain']} -d np.{$conf['domain']} $adguardClient $custom --webroot -w /certs/ --logs-dir /logs --max-log-backups 0 2>&1", $out, $code);
|
||||
if ($code > 0) {
|
||||
$this->send($this->input['chat'], "ERROR\n" . implode("\n", $out));
|
||||
break;
|
||||
@@ -2054,6 +2057,30 @@ class Bot
|
||||
'args' => [],
|
||||
];
|
||||
}
|
||||
|
||||
public function addSubdomain()
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter subdomain",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter subdomain',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'callback' => 'setSubdomain',
|
||||
'args' => [],
|
||||
];
|
||||
}
|
||||
|
||||
public function setSubdomain($text)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
$c['subdomain'] = $text;
|
||||
$this->setPacConf($c);
|
||||
$this->menu('config');
|
||||
}
|
||||
|
||||
public function enterPage()
|
||||
{
|
||||
$r = $this->send(
|
||||
@@ -3683,7 +3710,7 @@ DNS-over-HTTPS with IP:
|
||||
[
|
||||
[
|
||||
'text' => $this->i18n('chat'),
|
||||
'url' => "https://t.me/vpnbot_group",
|
||||
'url' => "https://t.me/+BYuWVd36cZYwNTMy",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('donate'),
|
||||
@@ -3744,14 +3771,22 @@ DNS-over-HTTPS with IP:
|
||||
't' => 'si',
|
||||
's' => $c['inbounds'][0]['settings']['clients'][$i]['id'],
|
||||
]));
|
||||
$v2 = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||
'h' => $hash,
|
||||
't' => 's',
|
||||
'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']}";
|
||||
return "v2rayng://install-config?url=$v2#{$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:
|
||||
if ($pac['transport'] == 'Websocket') {
|
||||
return "vless://{$c['inbounds'][0]['settings']['clients'][$i]['id']}@$domain:443?flow=&path=%2Fws&security=tls&sni=$domain&fp=chrome&type=ws#{$c['inbounds'][0]['settings']['clients'][$i]['email']}";
|
||||
}
|
||||
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']}";
|
||||
}
|
||||
}
|
||||
@@ -4180,7 +4215,9 @@ DNS-over-HTTPS with IP:
|
||||
$c = $this->getXray();
|
||||
$p = $this->getPacConf();
|
||||
$text[] = "Menu -> " . $this->i18n('xray');
|
||||
$text[] = "fake domain: <code>{$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}</code>";
|
||||
if (!empty($fake = $c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0])) {
|
||||
$text[] = "fake domain: <code>$fake</code>";
|
||||
}
|
||||
$text[] = 'transport: ' . ($p['transport'] ?: 'Reality');
|
||||
$data[] = [
|
||||
[
|
||||
@@ -4442,7 +4479,7 @@ DNS-over-HTTPS with IP:
|
||||
$hash = substr(md5($this->key), 0, 8);
|
||||
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['email']}\n";
|
||||
$text[] = "<code>{$this->linkXray($i)}</code>\n";
|
||||
$text[] = "<pre><code>{$this->linkXray($i)}</code></pre>\n";
|
||||
|
||||
$text[] = "import subscribe:";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=s&r=v&s={$c['id']}#{$c['email']}'>v2rayng</a>";
|
||||
@@ -4450,8 +4487,8 @@ DNS-over-HTTPS with IP:
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=s&r=st&s={$c['id']}#{$c['email']}'>streisand</a>";
|
||||
$text[] = "<a href='$scheme://{$domain}/pac?h=$hash&t=si&r=h&s={$c['id']}#{$c['email']}'>hiddify</a>";
|
||||
|
||||
$text[] = "\nv2ray config: <code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['id']}</code>";
|
||||
$text[] = "sing-box config: <code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['id']}</code>";
|
||||
$text[] = "\nv2ray config: <pre><code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['id']}</code></pre>";
|
||||
$text[] = "sing-box config: <pre><code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['id']}</code></pre>";
|
||||
$text[] = "sing-box windows: <a href='$scheme://{$domain}/pac?h=$hash&t=si&r=w&s={$c['id']}'>windows service</a>";
|
||||
|
||||
$data[] = [
|
||||
@@ -4593,19 +4630,23 @@ DNS-over-HTTPS with IP:
|
||||
't' => 'si',
|
||||
's' => $uid,
|
||||
]));
|
||||
$v2 = "$scheme://{$domain}/pac?h=$hash&t=s&s=$uid";
|
||||
$v2 = "$scheme://{$domain}/pac/" . base64_encode(serialize([
|
||||
'h' => $hash,
|
||||
't' => 's',
|
||||
's' => $uid,
|
||||
]));
|
||||
switch ($_GET['r']) {
|
||||
case 'si':
|
||||
header("Location: sing-box://import-remote-profile/?url=" . $si);
|
||||
header("Location: sing-box://import-remote-profile/?url=$si");
|
||||
exit;
|
||||
case 'st':
|
||||
header("Location: streisand://import/$v2");
|
||||
exit;
|
||||
case 'v':
|
||||
header("Location: v2rayng://install-config?url=" . urlencode($v2));
|
||||
header("Location: v2rayng://install-config?url=$v2");
|
||||
exit;
|
||||
case 'h':
|
||||
header("Location: hiddify://install-config/?url=" . $si);
|
||||
header("Location: hiddify://install-config/?url=$si");
|
||||
exit;
|
||||
case 'w':
|
||||
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
||||
@@ -5159,7 +5200,7 @@ DNS-over-HTTPS with IP:
|
||||
{
|
||||
exec('git -C / fetch');
|
||||
$conf = $this->getPacConf();
|
||||
$text[] = $conf['domain'] ? "Domains:\n{$conf['domain']}\nnp.{$conf['domain']}\noc.{$conf['domain']}" . ($conf['adguardkey'] ? "\n{$conf['adguardkey']}.{$conf['domain']}" : '') : $this->i18n('domain explain');
|
||||
$text[] = $conf['domain'] ? "Domains:\n{$conf['domain']}\nnp.{$conf['domain']} (for naiveproxy)\noc.{$conf['domain']} (for openconnect)" . ($conf['adguardkey'] ? "\n{$conf['adguardkey']}.{$conf['domain']} (for adguard DoT)" : '') . ($conf['subdomain'] ? "\n{$conf['subdomain']}.{$conf['domain']} (custom)" : '') : $this->i18n('domain explain');
|
||||
$ssl = $this->expireCert();
|
||||
$text[] = $conf['domain'] ? "\nSSL: " . ($ssl ? date('Y-m-d H:i:s', $this->expireCert()) : 'none') : '';
|
||||
|
||||
@@ -5169,6 +5210,10 @@ DNS-over-HTTPS with IP:
|
||||
'text' => $conf['domain'] ? "{$this->i18n('delete')} {$conf['domain']}" : $this->i18n('install domain'),
|
||||
'callback_data' => $conf['domain'] ? '/deldomain' : '/domain',
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('subdomain') . ($conf['subdomain'] ? ": {$conf['subdomain']}" : ''),
|
||||
'callback_data' => '/addSubdomain',
|
||||
],
|
||||
],
|
||||
];
|
||||
if ($conf['domain']) {
|
||||
@@ -5514,6 +5559,7 @@ DNS-over-HTTPS with IP:
|
||||
"security" => "reality"
|
||||
];
|
||||
}
|
||||
$this->setUpstreamDomain($ws ? 't' : $p['reality']['domain']);
|
||||
$this->setPacConf($p);
|
||||
$this->restartXray($x);
|
||||
$this->xray();
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
08.09.2024 v1.47
|
||||
- fix websocket -> reality
|
||||
03.09.2024 v1.46.2
|
||||
- fix link v2ray
|
||||
03.09.2024 v1.46.1
|
||||
- fix import
|
||||
- fix websocket domain
|
||||
03.09.2024 v1.46
|
||||
- возможность добавить кастомный поддомен для Letsencrypt
|
||||
03.09.2024 v1.45
|
||||
- выбор транспорта reality/websocket
|
||||
26.08.2024 v1.44
|
||||
|
||||
Reference in New Issue
Block a user