fix: Prevent X-ray client UUID reuse

This commit is contained in:
infosave2007
2026-01-30 15:38:18 +03:00
parent c677509f22
commit 46938f77c7
+9 -8
View File
@@ -268,14 +268,15 @@ class VpnClient
if (is_array($decoded)) { if (is_array($decoded)) {
$inbounds = $decoded['inbounds'] ?? []; $inbounds = $decoded['inbounds'] ?? [];
if (is_array($inbounds) && !empty($inbounds)) { if (is_array($inbounds) && !empty($inbounds)) {
$settings = $inbounds[0]['settings'] ?? []; // Block removed: Do not reuse existing client ID for new clients
$clients = $settings['clients'] ?? []; // $settings = $inbounds[0]['settings'] ?? [];
if (is_array($clients) && !empty($clients)) { // $clients = $settings['clients'] ?? [];
$cid = $clients[0]['id'] ?? null; // if (is_array($clients) && !empty($clients)) {
if (is_string($cid) && $cid !== '' && empty($vars['client_id'])) { // $cid = $clients[0]['id'] ?? null;
$vars['client_id'] = $cid; // if (is_string($cid) && $cid !== '' && empty($vars['client_id'])) {
} // $vars['client_id'] = $cid;
} // }
// }
$stream = $inbounds[0]['streamSettings'] ?? []; $stream = $inbounds[0]['streamSettings'] ?? [];
if (is_array($stream) && ($stream['security'] ?? '') === 'reality') { if (is_array($stream) && ($stream['security'] ?? '') === 'reality') {
$rs = $stream['realitySettings'] ?? []; $rs = $stream['realitySettings'] ?? [];