root 5 年之前
父节点
当前提交
e1fce3ae37
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 5 5
      app/Http/Controllers/ClientController.php
  2. 2 2
      app/Utils/Helper.php

+ 5 - 5
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
             ];
           }

+ 2 - 2
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";
     }