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

View File

@@ -285,7 +285,8 @@
"exportBackup": "Export Backup",
"deleteBackup": "حذف پشتیبان",
"restore": "بازیابی",
"restoreBackup": "بازیابی پشتیبان"
"restoreBackup": "بازیابی پشتیبان",
"viewHistory": "View history"
},
"fields": {
"webdavUrl": "http(s):// URL سرور WebDAV",
@@ -306,9 +307,37 @@
"restoreSuccess": "بازیابی با موفقیت انجام شد، برنامه در 1 ثانیه راه‌اندازی مجدد می‌شود",
"localBackupExported": "Local backup exported successfully",
"localBackupExportFailed": "Failed to export local backup",
"webdavRefreshSuccess": "WebDAV refresh succeeded",
"webdavRefreshFailed": "WebDAV refresh failed: {{error}}",
"confirmDelete": "آیا از حذف این فایل پشتیبان اطمینان دارید؟",
"confirmRestore": "آیا از بازیابی این فایل پشتیبان اطمینان دارید؟"
},
"auto": {
"title": "Automatic backup",
"scheduleLabel": "Enable scheduled backup",
"scheduleHelper": "Create local backups in the background at the configured interval.",
"intervalLabel": "Backup frequency",
"changeLabel": "Backup on critical changes",
"changeHelper": "Automatically back up when the global extend config/script or subscriptions are added, removed, or edited.",
"options": {
"hours": "Every {{n}} hours",
"days": "Every {{n}} days"
}
},
"manual": {
"title": "Manual backup",
"local": "Creates a snapshot on this device, stored under the app data directory.",
"webdav": "Upload a snapshot to your WebDAV server once credentials are set.",
"configureWebdav": "Configure WebDAV"
},
"history": {
"title": "Backup history",
"summary": "{{count}} backups • latest {{recent}}",
"empty": "No backups available"
},
"webdav": {
"title": "WebDAV settings"
},
"table": {
"filename": "نام فایل",
"backupTime": "زمان پشتیبان‌گیری",