alroyso 3 viikkoa sitten
vanhempi
säilyke
7fadd581d2

+ 5 - 4
lib/app/controller/GlobalController.dart

@@ -106,11 +106,11 @@ class GlobalController extends GetxController {
         }
         }
         
         
         // 确保初始配置文件存在并设置为当前配置
         // 确保初始配置文件存在并设置为当前配置
-        final initProxyConfig = File(path.join(Paths.config.path, Files.makeProxyConfig.path));
+        final initProxyConfig = File(path.join(Paths.config.path, Files.makeInitProxyConfig.path));
         if (!await initProxyConfig.exists()) {
         if (!await initProxyConfig.exists()) {
           await makeProxy();
           await makeProxy();
         }
         }
-        controllers.config.config.value.selected = Files.makeProxyConfig.path;
+        controllers.config.config.value.selected = Files.makeInitProxyConfig.path;
         
         
         if (Platform.isWindows) {
         if (Platform.isWindows) {
           await controllers.service.startClashCore();
           await controllers.service.startClashCore();
@@ -233,11 +233,12 @@ class GlobalController extends GetxController {
       nodeModes.value = await ApiService().getNode("/api/client/v4/nodes?vless=1");
       nodeModes.value = await ApiService().getNode("/api/client/v4/nodes?vless=1");
 
 
       await makeProxy();
       await makeProxy();
+
       if (!await checkAllCoresStopped()) {
       if (!await checkAllCoresStopped()) {
         throw Exception("内核未启动");
         throw Exception("内核未启动");
       }
       }
-      await controllers.cc_service.reloadClashCore();
-      await swift(selectedNode.value?.name ?? "");
+      // await controllers.cc_service.reloadClashCore();
+      // await swift(selectedNode.value?.name ?? "");
 
 
     } catch (e) {
     } catch (e) {
       handleApiError(e);
       handleApiError(e);

+ 2 - 2
lib/app/modules/home/controllers/home_controller.dart

@@ -230,8 +230,8 @@ class HomeController extends GetxController {
       await controllers.global.fetchNodes();
       await controllers.global.fetchNodes();
       nodeModes =  controllers.global.nodeModes;
       nodeModes =  controllers.global.nodeModes;
       isLoading.value = false;
       isLoading.value = false;
-      await Future.delayed(Duration(seconds: 2)); // 等待核心状态更新
-      //await connectionService.coreInit();
+      //await Future.delayed(Duration(seconds: 2)); // 等待核心状态更新
+      // await connectionService.coreInit();
     });
     });
   }
   }
   @override
   @override

+ 4 - 2
lib/app/service/connection_service.dart

@@ -25,6 +25,7 @@ class ConnectionService {
     updateStatus(ConnectionStatus.connecting);
     updateStatus(ConnectionStatus.connecting);
     globalController.updateMsg("正在启动连接...");
     globalController.updateMsg("正在启动连接...");
     await globalController.updateNode();
     await globalController.updateNode();
+    await controllers.cc_service.reloadClashCore();
     await globalController.swift(globalController.selectedNode.value?.name ?? "");
     await globalController.swift(globalController.selectedNode.value?.name ?? "");
     // 等待连接建立
     // 等待连接建立
     await Future.delayed(Duration(seconds: 2));
     await Future.delayed(Duration(seconds: 2));
@@ -39,6 +40,7 @@ class ConnectionService {
       updateStatus(ConnectionStatus.connecting);
       updateStatus(ConnectionStatus.connecting);
       globalController.updateMsg("正在启动连接...");
       globalController.updateMsg("正在启动连接...");
       await globalController.updateNode();
       await globalController.updateNode();
+      await controllers.cc_service.reloadClashCore();
       await globalController.swift(globalController.selectedNode.value?.name ?? "");
       await globalController.swift(globalController.selectedNode.value?.name ?? "");
       // 等待连接建立
       // 等待连接建立
       await Future.delayed(Duration(seconds: 2));
       await Future.delayed(Duration(seconds: 2));
@@ -179,7 +181,7 @@ class ConnectionService {
 
 
         } else {
         } else {
           if (controllers.service.clashServiceIsRuning){
           if (controllers.service.clashServiceIsRuning){
-            //await controllers.service.stopClash();
+            await controllers.service.stopClash();
             await globalController.closeProxy();
             await globalController.closeProxy();
             globalController.updateMsg("内核已重新加载");
             globalController.updateMsg("内核已重新加载");
           } else {
           } else {
@@ -189,7 +191,7 @@ class ConnectionService {
         }
         }
       } else{
       } else{
         if (controllers.service.clashServiceIsRuning){
         if (controllers.service.clashServiceIsRuning){
-          //await controllers.service.stopClash();
+          await controllers.service.stopClash();
           final proxyManager = WlBaseHelp();
           final proxyManager = WlBaseHelp();
           await proxyManager.stopProxy();
           await proxyManager.stopProxy();
           // await globalController.closeProxy();
           // await globalController.closeProxy();