fix(config): restart and quit application or shutdown system can not remember user's behavior #5347, #5359, #5430

This commit is contained in:
Tunglies
2025-11-20 16:03:43 +08:00
parent e42ae0e8c5
commit 131cd6c3b8
4 changed files with 20 additions and 3 deletions
+1
View File
@@ -25,6 +25,7 @@ pub async fn restart_clash_core() {
/// Restart the application
pub async fn restart_app() {
utils::server::shutdown_embedded_server();
Config::apply_all_and_save_file().await;
if let Err(err) = resolve::resolve_reset_async().await {
handle::Handle::notice_message(
"restart_app::error",
+2 -2
View File
@@ -4,6 +4,7 @@ use crate::module::lightweight;
use crate::utils;
use crate::utils::window_manager::WindowManager;
use clash_verge_logging::{Type, logging};
use tokio::time::{Duration, timeout};
/// Public API: open or close the dashboard
pub async fn open_or_close_dashboard() {
@@ -20,6 +21,7 @@ async fn open_or_close_dashboard_internal() {
pub async fn quit() {
logging!(debug, Type::System, "启动退出流程");
utils::server::shutdown_embedded_server();
Config::apply_all_and_save_file().await;
// 获取应用句柄并设置退出标志
let app_handle = handle::Handle::app_handle();
@@ -38,8 +40,6 @@ pub async fn quit() {
}
pub async fn clean_async() -> bool {
use tokio::time::{Duration, timeout};
logging!(info, Type::System, "开始执行异步清理操作...");
// 1. 处理TUN模式