feat: Update client IP handling for X-Ray configuration and enable text content display by default
This commit is contained in:
@@ -1749,13 +1749,9 @@ class InstallProtocolManager
|
|||||||
|
|
||||||
$name = $nameById[$uuid] ?? ($email !== '' ? $email : 'xray-' . substr($uuid, 0, 8));
|
$name = $nameById[$uuid] ?? ($email !== '' ? $email : 'xray-' . substr($uuid, 0, 8));
|
||||||
|
|
||||||
// Allocate a proper IP address for the client instead of using UUID
|
// X-Ray config does not store per-client tunnel IP like WireGuard.
|
||||||
try {
|
// Keep client_ip deterministic from config client id (UUID) during restore.
|
||||||
$clientIp = VpnClient::getNextClientIP($serverData);
|
$clientIp = $uuid;
|
||||||
} catch (Throwable $e) {
|
|
||||||
// Fallback to UUID if IP allocation fails
|
|
||||||
$clientIp = $uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate VLESS config URL for the client
|
// Generate VLESS config URL for the client
|
||||||
$host = $serverData['host'] ?? '';
|
$host = $serverData['host'] ?? '';
|
||||||
@@ -1781,8 +1777,8 @@ class InstallProtocolManager
|
|||||||
$serverId,
|
$serverId,
|
||||||
$serverData['user_id'] ?? null,
|
$serverData['user_id'] ?? null,
|
||||||
$name,
|
$name,
|
||||||
$clientIp, // Use allocated IP address
|
$clientIp,
|
||||||
$uuid, // Store UUID as public_key for X-Ray clients
|
$uuid,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$vlessUrl,
|
$vlessUrl,
|
||||||
|
|||||||
@@ -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;
|
||||||
Reference in New Issue
Block a user