From 9051b214c56a0e6487837e35137e44f7889f30db Mon Sep 17 00:00:00 2001 From: mercury Date: Sun, 9 Nov 2025 23:52:51 +0400 Subject: [PATCH] fix reality --- app/bot.php | 38 ++++++++++++-------------------------- scripts/start_xray.sh | 6 +++--- version | 2 ++ 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/app/bot.php b/app/bot.php index 87c43f4..cb9e381 100644 --- a/app/bot.php +++ b/app/bot.php @@ -624,9 +624,6 @@ class Bot case preg_match('~^/templateAdd (\w+)$~', $this->input['callback'], $m): $this->templateAdd($m[1]); break; - case preg_match('~^/generateSecretXray$~', $this->input['callback'], $m): - $this->generateSecretXray(); - break; case preg_match('~^/changeFakeDomain$~', $this->input['callback'], $m): $this->changeFakeDomain(); break; @@ -4664,7 +4661,7 @@ DNS-over-HTTPS with IP: [ [ 'text' => $this->i18n('chat'), - 'url' => base64_decode('aHR0cHM6Ly90Lm1lLytlcVV2X0RBNUdMRmxOVFZp'), + 'url' => base64_decode('aHR0cHM6Ly90Lm1lLys0RzMtUTRkX3ZGRXhPRGN5'), ], [ 'text' => $this->i18n('donate'), @@ -6284,9 +6281,6 @@ DNS-over-HTTPS with IP: public function xray($page = 0) { - if (!$this->ssh('pgrep xray', 'xr')) { - $this->generateSecretXray(); - } $c = $this->getXray(); $p = $this->getPacConf(); $text[] = "Menu -> " . $this->i18n('xray'); @@ -7625,25 +7619,6 @@ DNS-over-HTTPS with IP: 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) { $nginx = file_get_contents('/config/upstream.conf'); @@ -8511,6 +8486,17 @@ DNS-over-HTTPS with IP: $p['reality']['domain'] = $p['reality']['domain'] ?: 'web.telegram.org'; $p['reality']['destination'] = $p['reality']['destination'] ?: $p['reality']['domain'] . ':443'; $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)) { $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']; diff --git a/scripts/start_xray.sh b/scripts/start_xray.sh index b0e7dc4..4ef2330 100755 --- a/scripts/start_xray.sh +++ b/scripts/start_xray.sh @@ -1,8 +1,8 @@ cat /ssh/key.pub > /root/.ssh/authorized_keys ssh-keygen -A exec /usr/sbin/sshd -D -e "$@" & -if [ $(cat /xray.json | jq -r '.inbounds[0].settings.clients[0].id' | wc -c) -gt 1 ] -then - xray run -config /xray.json > /dev/null & +uuid=$(cat /xray.json | jq -r '.inbounds[0].settings.clients[0].id // empty') +if [ -n "$uuid" ]; then + xray run -config /xray.json > /dev/null 2>&1 & fi tail -f /dev/null diff --git a/version b/version index 278924f..35d25fc 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +09.11.2025 v2.27 +- фикс reality 08.11.2025 v2.26 - обновлено ядро xray - обновлен adguardHome