Browse Source

fix server rules maybe not defined

Tokumeikoi 5 years ago
parent
commit
0446e7d99f
2 changed files with 14 additions and 13 deletions
  1. 14 13
      app/Http/Controllers/Server/DeepbworkController.php
  2. 0 0
      public/assets/admin/umi.js

+ 14 - 13
app/Http/Controllers/Server/DeepbworkController.php

@@ -146,20 +146,21 @@ class DeepbworkController extends Controller
         if ($server->rules) {
             $rules = json_decode($server->rules);
             // domain
-            $domainObj = new \StdClass();
-            $domainObj->type = 'field';
-            $domainObj->domain = $rules->domain;
-            $domainObj->outboundTag = 'block';
+            if (isset($rules->domain)) {
+                $domainObj = new \StdClass();
+                $domainObj->type = 'field';
+                $domainObj->domain = $rules->domain;
+                $domainObj->outboundTag = 'block';
+                array_push($json->routing->settings->rules, $domainObj);
+            }
             // protocol
-            $protocolObj = new \StdClass();
-            $protocolObj->type = 'field';
-            $protocolObj->protocol = $rules->protocol;
-            $protocolObj->outboundTag = 'block';
-            array_push(
-                $json->routing->settings->rules,
-                $domainObj,
-                $protocolObj
-            );
+            if (isset($rules->protocol)) {
+                $protocolObj = new \StdClass();
+                $protocolObj->type = 'field';
+                $protocolObj->protocol = $rules->protocol;
+                $protocolObj->outboundTag = 'block';
+                array_push($json->routing->settings->rules, $protocolObj);
+            }
         }
 
         if ((int)$server->tls) {

File diff suppressed because it is too large
+ 0 - 0
public/assets/admin/umi.js


Some files were not shown because too many files changed in this diff