refactor: do not trigger autobackup on profile change (#6464)

* refactor: do not trigger autobackup on profile change

* chore: i18n
This commit is contained in:
Slinetrac
2026-03-11 06:56:15 +00:00
committed by GitHub
parent 20a523b3d6
commit 7ebf27ba52
27 changed files with 35 additions and 41 deletions
-5
View File
@@ -12,7 +12,6 @@ use crate::{
},
core::{CoreManager, handle, timer::Timer, tray::Tray},
feat,
module::auto_backup::{AutoBackupManager, AutoBackupTrigger},
process::AsyncHandler,
utils::{dirs, help},
};
@@ -108,7 +107,6 @@ pub async fn import_profile(url: std::string::String, option: Option<PrfOption>)
}
logging!(info, Type::Cmd, "[导入订阅] 导入完成: {}", help::mask_url(&url));
AutoBackupManager::trigger_backup(AutoBackupTrigger::ProfileChange);
Ok(())
}
@@ -141,7 +139,6 @@ pub async fn create_profile(item: PrfItem, file_data: Option<String>) -> CmdResu
handle::Handle::notify_profile_changed(uid);
}
Config::profiles().await.apply();
AutoBackupManager::trigger_backup(AutoBackupTrigger::ProfileChange);
Ok(())
}
Err(err) => {
@@ -184,7 +181,6 @@ pub async fn delete_profile(index: String) -> CmdResult {
// 发送配置变更通知
logging!(info, Type::Cmd, "[删除订阅] 发送配置变更通知: {}", index);
handle::Handle::notify_profile_changed(&index);
AutoBackupManager::trigger_backup(AutoBackupTrigger::ProfileChange);
}
Err(e) => {
logging!(error, Type::Cmd, "{}", e);
@@ -438,7 +434,6 @@ pub async fn patch_profile(index: String, profile: PrfItem) -> CmdResult {
});
}
AutoBackupManager::trigger_backup(AutoBackupTrigger::ProfileChange);
Ok(())
}
+1 -1
View File
@@ -21,7 +21,7 @@ pub async fn save_profile_file(index: String, file_data: Option<String>) -> CmdR
let backup_trigger = match index.as_str() {
"Merge" => Some(AutoBackupTrigger::GlobalMerge),
"Script" => Some(AutoBackupTrigger::GlobalScript),
_ => Some(AutoBackupTrigger::ProfileChange),
_ => None,
};
// 在异步操作前获取必要元数据并释放锁
-2
View File
@@ -34,7 +34,6 @@ pub enum AutoBackupTrigger {
Scheduled,
GlobalMerge,
GlobalScript,
ProfileChange,
}
impl AutoBackupTrigger {
@@ -43,7 +42,6 @@ impl AutoBackupTrigger {
Self::Scheduled => "scheduled",
Self::GlobalMerge => "merge",
Self::GlobalScript => "script",
Self::ProfileChange => "profile",
}
}