feat(auto-backup): implement centralized auto-backup manager and UI (#5374)

* feat(auto-backup): implement centralized auto-backup manager and UI

- Introduced AutoBackupManager to handle verge settings, run a background scheduler, debounce change-driven backups, and trim auto-labeled archives (keeps 20); wired into startup and config refresh hooks
  (src-tauri/src/module/auto_backup.rs:28-209, src-tauri/src/utils/resolve/mod.rs:64-136, src-tauri/src/feat/config.rs:102-238)

- Extended verge schema and backup helpers so scheduled/change-based settings persist, create_local_backup can rename archives, and profile/global-extend mutations now trigger backups
  (src-tauri/src/config/verge.rs:162-536, src/types/types.d.ts:857-859, src-tauri/src/feat/backup.rs:125-189, src-tauri/src/cmd/profile.rs:66-476, src-tauri/src/cmd/save_profile.rs:21-82)

- Added Auto Backup settings panel in backup dialog with dual toggles + interval selector; localized new strings across all locales
  (src/components/setting/mods/auto-backup-settings.tsx:1-138, src/components/setting/mods/backup-viewer.tsx:28-309, src/locales/en/settings.json:312-326 and mirrored entries)

- Regenerated typed i18n resources for strong typing in React
  (src/types/generated/i18n-keys.ts, src/types/generated/i18n-resources.ts)

* refactor(setting/backup): restructure backup dialog for consistent layout

* refactor(ui): unify settings dialog style

* fix(backup): only trigger auto-backup on valid saves & restore restarts app safely

* fix(backup): scrub console.log leak and rewire WebDAV dialog to actually probe server

* refactor: rename SubscriptionChange to ProfileChange

* chore: update i18n

* chore: WebDAV i18n improvements

* refactor(backup): error handling

* refactor(auto-backup): wrap scheduler startup with maybe_start_runner

* refactor: remove the redundant throw in handleExport

* feat(backup-history-viewer): improve WebDAV handling and UI fallback

* feat(auto-backup): trigger backups on all profile edits & improve interval input UX

* refactor: use InputAdornment

* docs: Changelog.md
This commit is contained in:
Sline
2025-11-10 13:49:14 +08:00
committed by GitHub
parent 78d5cb5eca
commit 838e401796
45 changed files with 1714 additions and 794 deletions
+22
View File
@@ -462,6 +462,7 @@ export const translationKeys = [
"settings.modals.backup.actions.deleteBackup",
"settings.modals.backup.actions.restore",
"settings.modals.backup.actions.restoreBackup",
"settings.modals.backup.actions.viewHistory",
"settings.modals.backup.fields.webdavUrl",
"settings.modals.backup.fields.username",
"settings.modals.backup.fields.info",
@@ -478,8 +479,26 @@ export const translationKeys = [
"settings.modals.backup.messages.restoreSuccess",
"settings.modals.backup.messages.localBackupExported",
"settings.modals.backup.messages.localBackupExportFailed",
"settings.modals.backup.messages.webdavRefreshSuccess",
"settings.modals.backup.messages.webdavRefreshFailed",
"settings.modals.backup.messages.confirmDelete",
"settings.modals.backup.messages.confirmRestore",
"settings.modals.backup.auto.title",
"settings.modals.backup.auto.scheduleLabel",
"settings.modals.backup.auto.scheduleHelper",
"settings.modals.backup.auto.intervalLabel",
"settings.modals.backup.auto.changeLabel",
"settings.modals.backup.auto.changeHelper",
"settings.modals.backup.auto.options.hours",
"settings.modals.backup.auto.options.days",
"settings.modals.backup.manual.title",
"settings.modals.backup.manual.local",
"settings.modals.backup.manual.webdav",
"settings.modals.backup.manual.configureWebdav",
"settings.modals.backup.history.title",
"settings.modals.backup.history.summary",
"settings.modals.backup.history.empty",
"settings.modals.backup.webdav.title",
"settings.modals.backup.table.filename",
"settings.modals.backup.table.backupTime",
"settings.modals.backup.table.actions",
@@ -639,6 +658,8 @@ export const translationKeys = [
"shared.actions.resume",
"shared.actions.closeAll",
"shared.actions.clear",
"shared.actions.previous",
"shared.actions.next",
"shared.labels.updateAt",
"shared.labels.timeout",
"shared.labels.icon",
@@ -659,6 +680,7 @@ export const translationKeys = [
"shared.units.milliseconds",
"shared.units.seconds",
"shared.units.minutes",
"shared.units.hours",
"shared.units.kilobytes",
"shared.units.files",
"shared.placeholders.filter",
+32
View File
@@ -690,12 +690,36 @@ export interface TranslationResources {
restore: string;
restoreBackup: string;
selectTarget: string;
viewHistory: string;
};
auto: {
changeHelper: string;
changeLabel: string;
intervalLabel: string;
options: {
days: string;
hours: string;
};
scheduleHelper: string;
scheduleLabel: string;
title: string;
};
fields: {
info: string;
username: string;
webdavUrl: string;
};
history: {
empty: string;
summary: string;
title: string;
};
manual: {
configureWebdav: string;
local: string;
title: string;
webdav: string;
};
messages: {
backupCreated: string;
backupFailed: string;
@@ -711,6 +735,8 @@ export interface TranslationResources {
usernameRequired: string;
webdavConfigSaved: string;
webdavConfigSaveFailed: string;
webdavRefreshFailed: string;
webdavRefreshSuccess: string;
webdavUrlRequired: string;
};
table: {
@@ -725,6 +751,9 @@ export interface TranslationResources {
webdav: string;
};
title: string;
webdav: {
title: string;
};
};
clashCore: {
variants: {
@@ -1139,7 +1168,9 @@ export interface TranslationResources {
hideDetails: string;
listView: string;
new: string;
next: string;
pause: string;
previous: string;
refresh: string;
refreshPage: string;
resetToDefault: string;
@@ -1242,6 +1273,7 @@ export interface TranslationResources {
};
units: {
files: string;
hours: string;
kilobytes: string;
milliseconds: string;
minutes: string;