alroyso 1 year ago
parent
commit
c0de9bd851
2 changed files with 15 additions and 8 deletions
  1. 13 8
      lib/app/controller/GlobalController.dart
  2. 2 0
      lib/app/controller/config.dart

+ 13 - 8
lib/app/controller/GlobalController.dart

@@ -112,25 +112,30 @@ class GlobalController extends GetxController {
 
   Future<void> onRunAdmin() async {
     if(Platform.isWindows){
-      String isRunadminErore;
+
       try {
-        isRunadminErore = await _wlBaseHelpPlugin.runAsAdministrator() ?? 'error';
+          await _wlBaseHelpPlugin.runAsAdministrator();
       } on PlatformException {
-        isRunadminErore = 'error';
+
       }
     }
 
   }
 
-  Future<void> onIsRunAdmin() async {
-    if(Platform.isWindows){
-      bool isAdmin;
+  Future<bool?> onIsRunAdmin() async {
+    bool? isAdmin;
+    if (Platform.isWindows) {
       try {
-        isAdmin = await _wlBaseHelpPlugin.isRunningAsAdmin() ?? false;
+        isAdmin = await _wlBaseHelpPlugin.isRunningAsAdmin();
       } on PlatformException {
-        isAdmin = false;
+        isAdmin = null;
       }
+    } else {
+      // 对于非 Windows 平台,可以根据需要返回 null 或 false
+      isAdmin = null; // 或者保持 isAdmin = null;
     }
+
+    return isAdmin;
   }
 
   Future<void> onIsProcessRunning(String passName) async {

+ 2 - 0
lib/app/controller/config.dart

@@ -147,6 +147,8 @@ proxy-groups:
 
     var rules = '''
 rules:
+  - GEOSITE,geolocation-!cn,proxy
+  - GEOSITE,cn,DIRECT
   - GEOIP,CN,DIRECT
   - MATCH,proxy
   ''';