alroyso 3 周之前
父節點
當前提交
00dbffe9b3

+ 4 - 3
lib/app/clash/service/clash_service.dart

@@ -166,10 +166,11 @@ class ClashService extends GetxController {
   }
 
   Future<bool> initClashCoreConfig() async {
-    controllers.config.config.value.selected = Files.makeProxyConfig.path;
-    //await makeInitConfig();
+    controllers.config.config.value.selected = Files.makeInitProxyConfig.path;
+    await makeInitConfig();
+
+    await controllers.global.checkAllCoresStopped();
 
-    await startClashCore();
     if (coreStatus.value == RunningState.error) {
       controllers.global.updateMsg("启动内核失败...");
       return false;

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

@@ -233,10 +233,10 @@ class GlobalController extends GetxController {
       nodeModes.value = await ApiService().getNode("/api/client/v4/nodes?vless=1");
 
       await makeProxy();
-
-      if (!await checkAllCoresStopped()) {
-        throw Exception("内核未启动");
-      }
+      //
+      // if (!await checkAllCoresStopped()) {
+      //   throw Exception("内核未启动");
+      // }
       // await controllers.cc_service.reloadClashCore();
       // await swift(selectedNode.value?.name ?? "");
 

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

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