From e1fce3ae37e4b67cc884acdc5eea72d359782bf1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 31 Dec 2019 13:45:50 +0800 Subject: [PATCH] update --- app/Http/Controllers/ClientController.php | 10 +++++----- app/Utils/Helper.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index dc2a0c06..082d4155 100755 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -48,7 +48,7 @@ class ClientController extends Controller $uri .= ', obfs=ws'; if ($item->settings) { $wsSettings = json_decode($item->settings); - if ($wsSettings->path) $uri .= ', obfs-uri='.$wsSettings->path; + if (isset($wsSettings->path)) $uri .= ', obfs-uri='.$wsSettings->path; } } $uri .= "\r\n"; @@ -66,8 +66,8 @@ class ClientController extends Controller $str .= ', obfs=ws'; if ($item->settings) { $wsSettings = json_decode($item->settings); - if ($wsSettings->path) $str .= ', obfs-path="'.$wsSettings->path.'"'; - if ($wsSettings->headers->Host) $str .= ', obfs-header="Host:'.$wsSettings->headers->Host.'"'; + if (isset($wsSettings->path)) $str .= ', obfs-path="'.$wsSettings->path.'"'; + if (isset($wsSettings->headers->Host)) $str .= ', obfs-header="Host:'.$wsSettings->headers->Host.'"'; } } $uri .= "vmess://".base64_encode($str)."\r\n"; @@ -103,8 +103,8 @@ class ClientController extends Controller $array['network'] = $item->network; if ($item->settings) { $wsSettings = json_decode($item->settings); - if ($wsSettings->path) $array['ws-path'] = $wsSettings->path; - if ($wsSettings->headers->Host) $array['ws-headers'] = [ + if (isset($wsSettings->path)) $array['ws-path'] = $wsSettings->path; + if (isset($wsSettings->headers->Host)) $array['ws-headers'] = [ 'Host' => $wsSettings->headers->Host ]; } diff --git a/app/Utils/Helper.php b/app/Utils/Helper.php index 3211b157..de0f830b 100755 --- a/app/Utils/Helper.php +++ b/app/Utils/Helper.php @@ -66,8 +66,8 @@ class Helper ]; if ($item->network == 'ws') { $wsSettings = json_decode($item->settings); - if ($wsSettings->path) $config['path'] = $wsSettings->path; - if ($wsSettings->headers->Host) $config['host'] = $wsSettings->headers->Host; + if (isset($wsSettings->path)) $config['path'] = $wsSettings->path; + if (isset($wsSettings->headers->Host)) $config['host'] = $wsSettings->headers->Host; } return "vmess://".base64_encode(json_encode($config))."\r\n"; }