Skip to content

Add custom db location and backup/restore functionality in Settings#89

Merged
julyx10 merged 3 commits into
mainfrom
lap-custom-db
Apr 27, 2026
Merged

Add custom db location and backup/restore functionality in Settings#89
julyx10 merged 3 commits into
mainfrom
lap-custom-db

Conversation

@julyx10
Copy link
Copy Markdown
Owner

@julyx10 julyx10 commented Apr 27, 2026

No description provided.

julyx10 added 3 commits April 26, 2026 18:35
Translate previously untranslated values in de/es/fr/ja/pt/ru/zh locale
files, including dedup strategy options, image editor tabs/labels, zoom
controls, and copyright fields across all supported languages.
- Extract DB storage, migration, and backup/restore into t_storage.rs
- Add BackupDialog and RestoreDialog with library selection and conflict detection
- Create ZIP backup containing library databases and metadata
- Restore adds libraries alongside existing ones with auto-rename on conflicts
- Emit updated event on library add/delete to refresh context menu
- Handle ESC key to close dialogs before closing settings window
- Add i18n translations for all 9 locale files
@julyx10
Copy link
Copy Markdown
Owner Author

julyx10 commented Apr 27, 2026

Branch: lap-custom-db — Custom DB Storage + Backup/Restore

Rust Backend

t_storage.rs (new, 526 lines)

  • Extracted DB storage management, migration, and backup/restore logic from t_config.rs into a dedicated module
  • Includes: DB_MIGRATION_GUARD, custom storage directory switching (change_db_storage_dir / reset_db_storage_dir), SQLite WAL checkpoint, and
    backup/restore pipeline
  • Backup: Select libraries → checkpoint → create ZIP (backup-info.json metadata + app-config.json + individual .db files), Deflate compression
  • Restore: Parse ZIP → detect name conflicts (auto-rename to Name (1)) → append as new libraries with fresh UUIDs, no existing data overwritten

t_config.rs

  • Removed ~500 lines of migrated code; remove_library / get_library_info now delegate to t_storage::

t_cmds.rs

  • Added 4 Tauri commands: get_db_storage_info, backup_databases, parse_backup_file, restore_databases
  • Existing storage commands (get_db_storage_dir, change_db_storage_dir, etc.) now call t_storage::

Cargo.toml — Added zip crate (deflate-only, no unused features)

Vue Frontend

BackupDialog.vue (new)

  • Multi-select libraries → estimated size → native save dialog → create ZIP
  • Select-all toggle, loading states, success/error toasts

RestoreDialog.vue (new)

  • Pick ZIP → parse & display library list ("New library" / "Will be renamed" badges) → select which to restore
  • Loads existing library names from backend for conflict detection

Settings.vue

  • Added backup/restore buttons in the storage section with hint text
  • Registered BackupDialog and RestoreDialog
  • ESC key closes dialogs in priority order (backup → restore → confirmation → window)
  • Emits libraries-changed event after restore to notify Home view

ManageLibraries.vue — Emits updated after add/delete to keep the Home library dropdown in sync

configStore.js / main.js / Home.vue

  • Cross-window library change notification via Pinia version counter + global event listener + watcher

i18n

All 9 locale files updated: storage section labels simplified, ~20 new backup/restore key-value pairs added.

Summary

  • Verified on macOS. Windows considerations: sanitize_filename replaces illegal filename characters (:, *, etc.) for ZIP entry names — this keeps the
  • restore consistent across platforms. Linux: native save/open dialogs should be tested. No platform-specific code was introduced.

@julyx10 julyx10 merged commit 043c34e into main Apr 27, 2026
6 checks passed
@julyx10 julyx10 added feat New feature or request labels Apr 27, 2026
@julyx10 julyx10 modified the milestone: v0.2.1 Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant