From 85ff5b2502ca50469864e50a81b912262714ae1f Mon Sep 17 00:00:00 2001 From: infosave2007 Date: Sat, 14 Feb 2026 11:39:04 +0300 Subject: [PATCH] feat: Update client IP handling for X-Ray configuration and enable text content display by default --- inc/InstallProtocolManager.php | 14 +++++--------- .../056_enable_show_text_content_for_xray.sql | 5 +++++ 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 migrations/056_enable_show_text_content_for_xray.sql diff --git a/inc/InstallProtocolManager.php b/inc/InstallProtocolManager.php index a82210e..e2edc8c 100644 --- a/inc/InstallProtocolManager.php +++ b/inc/InstallProtocolManager.php @@ -1749,13 +1749,9 @@ class InstallProtocolManager $name = $nameById[$uuid] ?? ($email !== '' ? $email : 'xray-' . substr($uuid, 0, 8)); - // Allocate a proper IP address for the client instead of using UUID - try { - $clientIp = VpnClient::getNextClientIP($serverData); - } catch (Throwable $e) { - // Fallback to UUID if IP allocation fails - $clientIp = $uuid; - } + // X-Ray config does not store per-client tunnel IP like WireGuard. + // Keep client_ip deterministic from config client id (UUID) during restore. + $clientIp = $uuid; // Generate VLESS config URL for the client $host = $serverData['host'] ?? ''; @@ -1781,8 +1777,8 @@ class InstallProtocolManager $serverId, $serverData['user_id'] ?? null, $name, - $clientIp, // Use allocated IP address - $uuid, // Store UUID as public_key for X-Ray clients + $clientIp, + $uuid, '', '', $vlessUrl, diff --git a/migrations/056_enable_show_text_content_for_xray.sql b/migrations/056_enable_show_text_content_for_xray.sql new file mode 100644 index 0000000..40ae202 --- /dev/null +++ b/migrations/056_enable_show_text_content_for_xray.sql @@ -0,0 +1,5 @@ +-- Enable text content display by default on client page for XRay VLESS +UPDATE protocols +SET show_text_content = 1 +WHERE slug = 'xray-vless' + AND COALESCE(show_text_content, 0) <> 1;