From 550a7e0bb9fc601e51cd8f12aedb3e56671ab440 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Tue, 2 Dec 2025 16:25:13 +0800 Subject: [PATCH] fix: restart core or change can not remember proxy select in Global mode with sidecar #5466 --- src-tauri/src/cmd/clash.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/cmd/clash.rs b/src-tauri/src/cmd/clash.rs index d4bfb9ed8..830eb2c72 100644 --- a/src-tauri/src/cmd/clash.rs +++ b/src-tauri/src/cmd/clash.rs @@ -7,7 +7,7 @@ use crate::{ constants, core::{CoreManager, handle, validate::CoreConfigValidator}, }; -use clash_verge_logging::{Type, logging}; +use clash_verge_logging::{Type, logging, logging_error}; use compact_str::CompactString; use serde_yaml_ng::Mapping; use smartstring::alias::String; @@ -46,6 +46,11 @@ pub async fn change_clash_core(clash_core: String) -> CmdResult> match CoreManager::global().change_core(&clash_core).await { Ok(_) => { + logging_error!( + Type::Core, + Config::profiles().await.latest_arc().save_file().await + ); + // 切换内核后重启内核 match CoreManager::global().restart_core().await { Ok(_) => { @@ -89,6 +94,10 @@ pub async fn start_core() -> CmdResult { /// 关闭核心 #[tauri::command] pub async fn stop_core() -> CmdResult { + logging_error!( + Type::Core, + Config::profiles().await.latest_arc().save_file().await + ); let result = CoreManager::global().stop_core().await.stringify_err(); if result.is_ok() { handle::Handle::refresh_clash(); @@ -99,6 +108,10 @@ pub async fn stop_core() -> CmdResult { /// 重启核心 #[tauri::command] pub async fn restart_core() -> CmdResult { + logging_error!( + Type::Core, + Config::profiles().await.latest_arc().save_file().await + ); let result = CoreManager::global().restart_core().await.stringify_err(); if result.is_ok() { handle::Handle::refresh_clash();