|
@@ -282,8 +282,18 @@ class ServiceController extends GetxController {
|
|
|
}
|
|
|
Future<void> reloadClashCore() async {
|
|
|
controllers.config.config.value.selected = 'proxy.yaml';
|
|
|
- if( coreStatus.value == RunningState.running){
|
|
|
- await controllers.core.fetchReloadConfig({"path": path.join(Paths.config.path, controllers.config.config.value.selected),"payload":""});
|
|
|
+ // if( coreStatus.value == RunningState.running){
|
|
|
+ // await controllers.core.fetchReloadConfig({"path": path.join(Paths.config.path, controllers.config.config.value.selected),"payload":""});
|
|
|
+ // }
|
|
|
+ BotToast.showText(text: '正在重启 Core ……');
|
|
|
+ await stopClashCore();
|
|
|
+ await controllers.config.readClashCoreApi();
|
|
|
+ await startClashCore();
|
|
|
+ if (coreStatus.value == RunningState.error) {
|
|
|
+ BotToast.showText(text: '重启失败');
|
|
|
+ } else {
|
|
|
+ await controllers.core.updateVersion();
|
|
|
+ BotToast.showText(text: '重启成功');
|
|
|
}
|
|
|
}
|
|
|
|