Browse Source

Merge pull request #37 from v2board/dev

1.1.1
tokumeikoi 5 years ago
parent
commit
c1583a1014

+ 11 - 8
app/Http/Controllers/Passport/AuthController.php

@@ -116,16 +116,17 @@ class AuthController extends Controller
             abort(500, '该账户已被停止使用');
         }
 
+        $data = [
+            'token' => $user->token
+        ];
         $request->session()->put('email', $user->email);
         $request->session()->put('id', $user->id);
         if ($user->is_admin) {
             $request->session()->put('is_admin', true);
+            $data['is_admin'] = true;
         }
         return response([
-            'data' => [
-                'is_admin' => $user->is_admin ? 2 : 1,
-                'token' => $user->token
-            ]
+            'data' => $data
         ]);
     }
 
@@ -175,13 +176,15 @@ class AuthController extends Controller
 
     public function check(Request $request)
     {
-        $response = [
-            'data' => $request->session()->get('id') ? true : false
+        $data = [
+            'is_login' => $request->session()->get('id') ? true : false
         ];
         if ($request->session()->get('is_admin')) {
-            $response['is_admin'] = true;
+            $data['is_admin'] = true;
         }
-        return response($response);
+        return response([
+            'data' => $data
+        ]);
     }
 
     public function forget(AuthForget $request)

+ 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) {

+ 1 - 1
config/app.php

@@ -234,5 +234,5 @@ return [
     |--------------------------------------------------------------------------
     */
 
-    'version' => '1.1'
+    'version' => '1.1.1'
 ];

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


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


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