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 14:56:15 +08:00 committed by GitHub
parent 20a523b3d6
commit 7ebf27ba52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 35 additions and 41 deletions

View File

@ -23,5 +23,6 @@
- 优化首次启动节点信息刷新 - 优化首次启动节点信息刷新
- Linux 默认使用内置窗口控件 - Linux 默认使用内置窗口控件
- 实现排除自定义网段的校验 - 实现排除自定义网段的校验
- 移除冗余的自动备份触发条件
</details> </details>

View File

@ -12,7 +12,6 @@ use crate::{
}, },
core::{CoreManager, handle, timer::Timer, tray::Tray}, core::{CoreManager, handle, timer::Timer, tray::Tray},
feat, feat,
module::auto_backup::{AutoBackupManager, AutoBackupTrigger},
process::AsyncHandler, process::AsyncHandler,
utils::{dirs, help}, 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)); logging!(info, Type::Cmd, "[导入订阅] 导入完成: {}", help::mask_url(&url));
AutoBackupManager::trigger_backup(AutoBackupTrigger::ProfileChange);
Ok(()) Ok(())
} }
@ -141,7 +139,6 @@ pub async fn create_profile(item: PrfItem, file_data: Option<String>) -> CmdResu
handle::Handle::notify_profile_changed(uid); handle::Handle::notify_profile_changed(uid);
} }
Config::profiles().await.apply(); Config::profiles().await.apply();
AutoBackupManager::trigger_backup(AutoBackupTrigger::ProfileChange);
Ok(()) Ok(())
} }
Err(err) => { Err(err) => {
@ -184,7 +181,6 @@ pub async fn delete_profile(index: String) -> CmdResult {
// 发送配置变更通知 // 发送配置变更通知
logging!(info, Type::Cmd, "[删除订阅] 发送配置变更通知: {}", index); logging!(info, Type::Cmd, "[删除订阅] 发送配置变更通知: {}", index);
handle::Handle::notify_profile_changed(&index); handle::Handle::notify_profile_changed(&index);
AutoBackupManager::trigger_backup(AutoBackupTrigger::ProfileChange);
} }
Err(e) => { Err(e) => {
logging!(error, Type::Cmd, "{}", 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(()) Ok(())
} }

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() { let backup_trigger = match index.as_str() {
"Merge" => Some(AutoBackupTrigger::GlobalMerge), "Merge" => Some(AutoBackupTrigger::GlobalMerge),
"Script" => Some(AutoBackupTrigger::GlobalScript), "Script" => Some(AutoBackupTrigger::GlobalScript),
_ => Some(AutoBackupTrigger::ProfileChange), _ => None,
}; };
// 在异步操作前获取必要元数据并释放锁 // 在异步操作前获取必要元数据并释放锁

View File

@ -34,7 +34,6 @@ pub enum AutoBackupTrigger {
Scheduled, Scheduled,
GlobalMerge, GlobalMerge,
GlobalScript, GlobalScript,
ProfileChange,
} }
impl AutoBackupTrigger { impl AutoBackupTrigger {
@ -43,7 +42,6 @@ impl AutoBackupTrigger {
Self::Scheduled => "scheduled", Self::Scheduled => "scheduled",
Self::GlobalMerge => "merge", Self::GlobalMerge => "merge",
Self::GlobalScript => "script", Self::GlobalScript => "script",
Self::ProfileChange => "profile",
} }
} }

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "Create local backups in the background at the configured interval.", "scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency", "intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes", "changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.", "changeHelper": "Automatically backup when Global Extend Config/Script changes.",
"options": { "options": {
"hours": "Every {{n}} hours", "hours": "Every {{n}} hours",
"days": "Every {{n}} days" "days": "Every {{n}} days"

View File

@ -359,7 +359,7 @@
"scheduleHelper": "按设定频率在后台创建本地备份文件。", "scheduleHelper": "按设定频率在后台创建本地备份文件。",
"intervalLabel": "备份频率", "intervalLabel": "备份频率",
"changeLabel": "关键变更时自动备份", "changeLabel": "关键变更时自动备份",
"changeHelper": "全局扩展配置/脚本或订阅增删改后会自动备份。", "changeHelper": "全局扩展覆写配置/脚本更改后自动备份。",
"options": { "options": {
"hours": "每 {{n}} 小时", "hours": "每 {{n}} 小时",
"days": "每 {{n}} 天" "days": "每 {{n}} 天"

View File

@ -72,8 +72,8 @@
}, },
"more": { "more": {
"global": { "global": {
"merge": "Global Merge", "merge": "Global Extend Config",
"script": "Global Script" "script": "Global Extend Script"
}, },
"chips": { "chips": {
"merge": "Merge", "merge": "Merge",

View File

@ -359,7 +359,7 @@
"scheduleHelper": "依設定頻率在背景建立本機備份檔案。", "scheduleHelper": "依設定頻率在背景建立本機備份檔案。",
"intervalLabel": "備份頻率", "intervalLabel": "備份頻率",
"changeLabel": "關鍵變更時自動備份", "changeLabel": "關鍵變更時自動備份",
"changeHelper": "全域擴充配置/腳本或訂閱新增、刪除、修改時自動備份。", "changeHelper": "Global Extend Config/Script 變更後自動備份。",
"options": { "options": {
"hours": "每 {{n}} 小時", "hours": "每 {{n}} 小時",
"days": "每 {{n}} 天" "days": "每 {{n}} 天"