Browse Source

update: app

Tokumeikoi 4 years ago
parent
commit
5df67aef16
1 changed files with 13 additions and 13 deletions
  1. 13 13
      app/Http/Controllers/Client/AppController.php

+ 13 - 13
app/Http/Controllers/Client/AppController.php

@@ -29,19 +29,19 @@ class AppController extends Controller
         $proxy = [];
         $proxies = [];
 
-        foreach ($servers['shadowsocks'] as $item) {
-            array_push($proxy, Clash::buildShadowsocks($user->uuid, $item));
-            array_push($proxies, $item->name);
-        }
-
-        foreach ($servers['vmess'] as $item) {
-            array_push($proxy, Clash::buildVmess($user->uuid, $item));
-            array_push($proxies, $item->name);
-        }
-
-        foreach ($servers['trojan'] as $item) {
-            array_push($proxy, Clash::buildTrojan($user->uuid, $item));
-            array_push($proxies, $item->name);
+        foreach ($servers as $item) {
+            if ($item['type'] === 'shadowsocks') {
+                array_push($proxy, Clash::buildShadowsocks($user->uuid, $item));
+                array_push($proxies, $item->name);
+            }
+            if ($item['type'] === 'v2ray') {
+                array_push($proxy, Clash::buildVmess($user->uuid, $item));
+                array_push($proxies, $item->name);
+            }
+            if ($item['type'] === 'trojan') {
+                array_push($proxy, Clash::buildTrojan($user->uuid, $item));
+                array_push($proxies, $item->name);
+            }
         }
 
         $config['proxies'] = array_merge($config['proxies'] ? $config['proxies'] : [], $proxy);