Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9051b214c5 | |||
| 0710ef51fd | |||
| 597763f80a |
+18
-30
@@ -624,9 +624,6 @@ class Bot
|
|||||||
case preg_match('~^/templateAdd (\w+)$~', $this->input['callback'], $m):
|
case preg_match('~^/templateAdd (\w+)$~', $this->input['callback'], $m):
|
||||||
$this->templateAdd($m[1]);
|
$this->templateAdd($m[1]);
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/generateSecretXray$~', $this->input['callback'], $m):
|
|
||||||
$this->generateSecretXray();
|
|
||||||
break;
|
|
||||||
case preg_match('~^/changeFakeDomain$~', $this->input['callback'], $m):
|
case preg_match('~^/changeFakeDomain$~', $this->input['callback'], $m):
|
||||||
$this->changeFakeDomain();
|
$this->changeFakeDomain();
|
||||||
break;
|
break;
|
||||||
@@ -1903,10 +1900,12 @@ class Bot
|
|||||||
|
|
||||||
public function dw($u, $t)
|
public function dw($u, $t)
|
||||||
{
|
{
|
||||||
$c = $this->getXray()['inbounds'][0]['settings']['clients'][$u];
|
$pac = $this->getPacConf();
|
||||||
$_GET['s'] = $c['id'];
|
$c = $this->getXray()['inbounds'][0]['settings']['clients'][$u];
|
||||||
$_GET['t'] = $t;
|
$_GET['s'] = $c['id'];
|
||||||
$conf = $this->subscription(1);
|
$_GET['t'] = $t;
|
||||||
|
$_SERVER['SERVER_NAME'] = $this->getDomain($pac['transport'] != 'Reality');
|
||||||
|
$conf = $this->subscription(1);
|
||||||
$this->sendFile($this->input['from'], new CURLStringFile($conf, $c['email'] . ($t == 'cl' ? '_mihomo.yaml' :($t == 'si' ? '_singbox.json' : '_v2ray.json'))));
|
$this->sendFile($this->input['from'], new CURLStringFile($conf, $c['email'] . ($t == 'cl' ? '_mihomo.yaml' :($t == 'si' ? '_singbox.json' : '_v2ray.json'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4662,7 +4661,7 @@ DNS-over-HTTPS with IP:
|
|||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('chat'),
|
'text' => $this->i18n('chat'),
|
||||||
'url' => base64_decode('aHR0cHM6Ly90Lm1lLytXZnhnNi1ucm9rQmxNbVl5'),
|
'url' => base64_decode('aHR0cHM6Ly90Lm1lLys0RzMtUTRkX3ZGRXhPRGN5'),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('donate'),
|
'text' => $this->i18n('donate'),
|
||||||
@@ -6282,9 +6281,6 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function xray($page = 0)
|
public function xray($page = 0)
|
||||||
{
|
{
|
||||||
if (!$this->ssh('pgrep xray', 'xr')) {
|
|
||||||
$this->generateSecretXray();
|
|
||||||
}
|
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
$p = $this->getPacConf();
|
$p = $this->getPacConf();
|
||||||
$text[] = "Menu -> " . $this->i18n('xray');
|
$text[] = "Menu -> " . $this->i18n('xray');
|
||||||
@@ -7623,25 +7619,6 @@ DNS-over-HTTPS with IP:
|
|||||||
return json_decode(file_get_contents('/config/xray.json'), true);
|
return json_decode(file_get_contents('/config/xray.json'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateSecretXray()
|
|
||||||
{
|
|
||||||
$c = $this->getXray();
|
|
||||||
$shortId = trim($this->ssh('openssl rand -hex 8', 'xr'));
|
|
||||||
$keys = $this->ssh('xray x25519', 'xr');
|
|
||||||
preg_match('~^Private key:\s([^\s]+)~m', $keys, $m);
|
|
||||||
$private = trim($m[1]);
|
|
||||||
preg_match('~^Public key:\s([^\s]+)~m', $keys, $m);
|
|
||||||
$public = trim($m[1]);
|
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['privateKey'] = $private;
|
|
||||||
$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0] = $shortId;
|
|
||||||
$pac = $this->getPacConf();
|
|
||||||
$pac['xray'] = $public;
|
|
||||||
$pac['reality']['shortId'] = $shortId;
|
|
||||||
$pac['reality']['privateKey'] = $private;
|
|
||||||
$this->setPacConf($pac);
|
|
||||||
$this->restartXray($c);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUpstreamDomain($domain)
|
public function setUpstreamDomain($domain)
|
||||||
{
|
{
|
||||||
$nginx = file_get_contents('/config/upstream.conf');
|
$nginx = file_get_contents('/config/upstream.conf');
|
||||||
@@ -8509,6 +8486,17 @@ DNS-over-HTTPS with IP:
|
|||||||
$p['reality']['domain'] = $p['reality']['domain'] ?: 'web.telegram.org';
|
$p['reality']['domain'] = $p['reality']['domain'] ?: 'web.telegram.org';
|
||||||
$p['reality']['destination'] = $p['reality']['destination'] ?: $p['reality']['domain'] . ':443';
|
$p['reality']['destination'] = $p['reality']['destination'] ?: $p['reality']['domain'] . ':443';
|
||||||
$p['transport'] = $ws ? 'Websocket' : 'Reality';
|
$p['transport'] = $ws ? 'Websocket' : 'Reality';
|
||||||
|
if (empty($p['xray'])) {
|
||||||
|
$shortId = trim($this->ssh('openssl rand -hex 8', 'xr'));
|
||||||
|
$keys = $this->ssh('xray x25519', 'xr');
|
||||||
|
preg_match('~^PrivateKey:\s([^\s]+)~m', $keys, $m);
|
||||||
|
$private = trim($m[1]);
|
||||||
|
preg_match('~^Password:\s([^\s]+)~m', $keys, $m);
|
||||||
|
$public = trim($m[1]);
|
||||||
|
$p['xray'] = $public;
|
||||||
|
$p['reality']['shortId'] = $shortId;
|
||||||
|
$p['reality']['privateKey'] = $private;
|
||||||
|
}
|
||||||
if (!empty($ws)) {
|
if (!empty($ws)) {
|
||||||
$p['reality']['domain'] = $x['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] ?: $p['reality']['domain'];
|
$p['reality']['domain'] = $x['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] ?: $p['reality']['domain'];
|
||||||
$p['reality']['destination'] = $x['inbounds'][0]['streamSettings']['realitySettings']['dest'] ?: $p['reality']['destination'];
|
$p['reality']['destination'] = $x['inbounds'][0]['streamSettings']['realitySettings']['dest'] ?: $p['reality']['destination'];
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||||
ssh-keygen -A
|
ssh-keygen -A
|
||||||
exec /usr/sbin/sshd -D -e "$@" &
|
exec /usr/sbin/sshd -D -e "$@" &
|
||||||
if [ $(cat /xray.json | jq -r '.inbounds[0].settings.clients[0].id' | wc -c) -gt 1 ]
|
uuid=$(cat /xray.json | jq -r '.inbounds[0].settings.clients[0].id // empty')
|
||||||
then
|
if [ -n "$uuid" ]; then
|
||||||
xray run -config /xray.json > /dev/null &
|
xray run -config /xray.json > /dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
tail -f /dev/null
|
tail -f /dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user