Files
mtgc/crates/mtgc-core/Cargo.toml
Garrett Mills de55fc634a Replace folder sync with an HTTP sync server, keeping the app offline-first
Folder sync left too much to the user's sync tool: platform file access
(the Android SAF plugin), choosing the document, merging conflict copies —
and its merge base could fall out of step with the document (absorbing
conflict copies, "forget", picking a new Android folder), reading every
difference as a deletion.

The new mtgc-server crate stores one versioned library per user and accepts
a write only when it names the version it replaces. It never merges: devices
still do that with merge3, through a new sync cycle over a `Remote` trait in
mtgc-core. The base advances only on knowledge — to what was read, or to a
write the server confirmed — and is stored with the server and account it
belongs to, so a different account starts from an empty ancestor instead of
deleting. The working copy is only rewritten under the app-state lock, and
sync commands now run off the main thread.

Sign-in happens in the browser on the server's pages, via the owner's OIDC
provider and/or local username/password accounts (Argon2id, managed with
`mtgc-server user ...`), and returns a per-device revocable token to the app
by PKCE-protected code: a loopback port on desktop, the mtgc:// scheme on
Android.

The Info tab gains sign-in, the first-sync combine/replace choice, the
account's devices, and JSON export/import; the top bar shows sync state.
Includes a Dockerfile, Compose/Caddy example, and scripts to build and push
${DOCKER_REGISTRY}/mtgc/sync-server.
2026-10-08 22:32:08 -05:00

34 lines
893 B
TOML

[package]
name = "mtgc-core"
version.workspace = true
edition.workspace = true
license.workspace = true
description = "Platform-agnostic core for the MTG library catalog: DB, fuzzy search, filters, decks, and Scryfall ingestion."
[lib]
name = "mtgc_core"
path = "src/lib.rs"
# Binary that builds reference.db from Scryfall bulk data.
[[bin]]
name = "mtgc-ingest"
path = "src/bin/ingest.rs"
[dependencies]
rusqlite = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
nucleo = { workspace = true }
ureq = { workspace = true }
flate2 = { workspace = true }
anyhow = { workspace = true }
thiserror = { workspace = true }
# Sync sign-in: PKCE (RFC 7636) needs a SHA-256 and unpadded base64url, and
# its verifier fresh randomness. All pure Rust, so Android needs nothing extra.
sha2 = "0.10"
base64 = "0.22"
getrandom = "0.3"
[dev-dependencies]
tempfile = "3"