Named libraries: switch between several, each syncing on its own

The app can keep any number of named libraries and switch between them
from the top bar or Info → Libraries. Each can sync to the account's other
devices or stay on this one (a scratch library to try things in).

The sync server now keeps several libraries per user under
/api/libraries; a migration makes each existing library the user's default
"Main", which /api/library keeps serving for older app builds. Every sync
lines the device's libraries up with the account's: new ones elsewhere are
downloaded, new ones here created on the server, ones deleted elsewhere
flagged rather than thrown away. The existing library keeps its files and
merge base, so upgrading asks nothing.
This commit is contained in:
2026-10-16 21:44:55 -05:00
parent 6072d44ebe
commit 81b1df8c9f
21 changed files with 2451 additions and 202 deletions

View File

@@ -12,16 +12,17 @@ in a platform-agnostic Rust core, so both platforms share it.
src/ React + TypeScript UI (swappable presentation)
src-tauri/ Tauri v2 shell — exposes the core as typed commands
crates/mtgc-core/ Pure Rust: db, fuzzy search, filters, decks, ingester, sync
crates/mtgc-server/ Optional sync server: one library per user, OIDC and/or passwords
crates/mtgc-server/ Optional sync server: each user's libraries, OIDC and/or passwords
```
Two kinds of data, both in the OS app-data dir (e.g.
`~/.local/share/com.garrettmills.mtgc/`):
- **your library** — owned cards, decks, deck contents. Lives on each device
and works fully offline; sign in to a sync server to share it between
devices (see [Sync](#sync)). **Export library…** in the Info tab saves it as
a JSON backup.
- **your libraries** — owned cards, decks, deck contents. Each lives on the
device and works fully offline; sign in to a sync server to share them
between devices (see [Sync](#sync)). You can keep several and switch between
them (see [Libraries](#libraries)). **Export library…** in the Info tab saves
the open one as a JSON backup.
- **`reference.db`** — read-only card data built from Scryfall bulk. Bulky and
re-downloaded per device, so it's never synced.
@@ -261,6 +262,10 @@ stands (**Synced**, **Offline — changes will sync**, …); **Sync now** in the
Info tab forces a pass. Offline, edits simply wait on the device: nothing is
lost, and they go out with the next sync that reaches the server.
Each library syncs on its own: a library's edits never reach another one. An
older sync server keeps just one library per account, which **Main** syncs
with; update the server to sync the others.
The first time a device signs in to an account that already has a library,
and the device has one too, it asks whether to **combine** them (nothing from
either is lost) or **use the server's library** instead of this device's.