diff --git a/app/Http/Controllers/Client/Protocols/AnXray.php b/app/Http/Controllers/Client/Protocols/AnXray.php index 9bd5835a..758201b7 100644 --- a/app/Http/Controllers/Client/Protocols/AnXray.php +++ b/app/Http/Controllers/Client/Protocols/AnXray.php @@ -64,8 +64,14 @@ class AnXray "encryption" => "none", "type" => urlencode($server['network']), "security" => $server['tls'] ? "tls" : "", - "sni" => $server['tls'] ? urlencode(json_decode($server['tlsSettings'], true)['serverName']) : "" ]; + if ($server['tls']) { + if ($server['tlsSettings']) { + $tlsSettings = json_decode($server['tlsSettings'], true); + if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) + $config['sni'] = urlencode($tlsSettings['serverName']); + } + } if ((string)$server['network'] === 'ws') { $wsSettings = json_decode($server['networkSettings'], true); if (isset($wsSettings['path'])) $config['path'] = urlencode($wsSettings['path']); diff --git a/app/Http/Controllers/Client/Protocols/Passwall.php b/app/Http/Controllers/Client/Protocols/Passwall.php index 9f5115d8..3d5792e2 100644 --- a/app/Http/Controllers/Client/Protocols/Passwall.php +++ b/app/Http/Controllers/Client/Protocols/Passwall.php @@ -75,7 +75,7 @@ class Passwall } if ((string)$server['network'] === 'grpc') { $grpcSettings = json_decode($server['networkSettings'], true); - if (isset($grpcSettings['path'])) $config['path'] = $grpcSettings['serviceName']; + if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName']; } return "vmess://" . base64_encode(json_encode($config)) . "\r\n"; } diff --git a/app/Http/Controllers/Client/Protocols/SSRPlus.php b/app/Http/Controllers/Client/Protocols/SSRPlus.php index 3efa61a3..b7c3c3e4 100644 --- a/app/Http/Controllers/Client/Protocols/SSRPlus.php +++ b/app/Http/Controllers/Client/Protocols/SSRPlus.php @@ -75,7 +75,7 @@ class SSRPlus } if ((string)$server['network'] === 'grpc') { $grpcSettings = json_decode($server['networkSettings'], true); - if (isset($grpcSettings['path'])) $config['path'] = $grpcSettings['serviceName']; + if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName']; } return "vmess://" . base64_encode(json_encode($config)) . "\r\n"; } diff --git a/app/Http/Controllers/Client/Protocols/V2rayN.php b/app/Http/Controllers/Client/Protocols/V2rayN.php index e8ab9b39..61695f4a 100644 --- a/app/Http/Controllers/Client/Protocols/V2rayN.php +++ b/app/Http/Controllers/Client/Protocols/V2rayN.php @@ -75,7 +75,7 @@ class V2rayN } if ((string)$server['network'] === 'grpc') { $grpcSettings = json_decode($server['networkSettings'], true); - if (isset($grpcSettings['path'])) $config['path'] = $grpcSettings['serviceName']; + if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName']; } return "vmess://" . base64_encode(json_encode($config)) . "\r\n"; } diff --git a/app/Http/Controllers/Client/Protocols/V2rayNG.php b/app/Http/Controllers/Client/Protocols/V2rayNG.php index f4658467..54e9ad26 100644 --- a/app/Http/Controllers/Client/Protocols/V2rayNG.php +++ b/app/Http/Controllers/Client/Protocols/V2rayNG.php @@ -75,7 +75,7 @@ class V2rayNG } if ((string)$server['network'] === 'grpc') { $grpcSettings = json_decode($server['networkSettings'], true); - if (isset($grpcSettings['path'])) $config['path'] = $grpcSettings['serviceName']; + if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName']; } return "vmess://" . base64_encode(json_encode($config)) . "\r\n"; }