alroyso 1 year ago
parent
commit
6435044e4e

+ 3 - 1
lib/app/controller/GlobalController.dart

@@ -99,6 +99,7 @@ class GlobalController extends GetxController {
     //   controllers.service.serviceModeSwitch(true);
     // }
     routeModesSelect.value = route;
+    LogHelper().d("当前ROUTE模式${routeModesSelect.value}");
   }
   Future<void> fetchNodes() async {
     nodeModes.value = await ApiService().getNode("/api/client/v4/nodes?vless=1");
@@ -199,7 +200,8 @@ class GlobalController extends GetxController {
 
   Future<void> TunProxySwitch(bool open) async {
     tunProxySwitchIng.value = true;
-    updateRoute(open ? "tun": "sys");
+    routeModesSelect.value = open ? "tun": "sys";
+    LogHelper().d("TunProxySwitch ----- 当前ROUTE模式${routeModesSelect.value}");
     tunProxySwitchIng.value = false;
   }
 

+ 1 - 1
lib/app/controller/tray.dart

@@ -66,7 +66,7 @@ class TrayController extends GetxController with TrayListener {
       ),
       MenuItem.checkbox(
         label: 'route_tun_title'.tr,
-        checked: controllers.global.routeModesSelect.value == "tun",
+        checked: disabledTun.value,
         disabled: false,
         onClick: handleClickSetAsTunProxy,
       ),

+ 12 - 0
lib/app/modules/home/controllers/home_controller.dart

@@ -202,6 +202,18 @@ class HomeController extends GetxController {
       //   controllers.global.updateMsg("内核没有启动...");
       //   return;
       // }
+      if(Platform.isWindows)
+      {
+        if(!await isRunningAsAdmin()){
+          controllers.global.updateMsg("网卡模式需要管理模式运行...");
+          return;
+        }
+      } else {
+        if(controllers.service.serviceMode.value == false){
+          controllers.global.updateMsg("需要开启服务,才能使用...");
+          return;
+        }
+      }
 
       if (controllers.global.allowStatusUpdate && connectStatus.value == ConnectionStatus.stopped || connectStatus.value == ConnectionStatus.connecting) {
         controllers.global.updateMsg("当前连接状态未停止,不要多次启动...");