Commit Graph

25 Commits

Author SHA1 Message Date
18948efd17 Debian packaging 2026-10-22 21:33:31 -05:00
82f10f835b Debian packaging 2026-10-22 21:19:23 -05:00
4b651b5108 Library import asks for a location to file the cards under
After picking a file, Import cards… asks where the cards are kept,
pre-filled with the file's name (a ManaBox export is named after its
binder). A location is set on every imported card, replacing any it had,
as Add Cards does; blank leaves locations alone. It's applied inside the
import's single transaction.
2026-10-17 21:58:44 -05:00
1641d9aa47 Android: build on JDK 25 with Gradle 9.6.1, AGP 9.4.1, Kotlin 2.2.10
Android Studio now bundles JBR 25, which Gradle 8.14's embedded Kotlin
can't parse. Follow Tauri's current template: Gradle 9.6.1, Kotlin 2.2.10,
the builtInKotlin/newDsl/failOnMissingFiles compatibility flags, the
compilerOptions DSL, and ExecOperations in BuildTask (project.exec is gone
in Gradle 9). AGP goes to 9.4.1 rather than the template's 9.3.1.

Release lint vital is turned off: AGP 9.3/9.4's lint crashes analysing the
.gradle.kts scripts (findFirCompiledSymbol), failing every release build.

The env scripts now accept JDK 17 through 25, preferring Studio's JBR.
2026-10-16 22:39:36 -05:00
89378a41fb Android env: require JDK 21/17 by version, since Studio now bundles JBR 25
Check each JDK candidate's major version instead of assuming Android Studio's
JBR is 21, look for Adoptium temurin-{21,17}-jdk (Fedora 44 dropped
java-21-openjdk), and propagate android-env.sh failures to scripts that
source it so fdroid-publish.sh stops before building.
2026-10-16 22:08:47 -05:00
8301371679 Add multi-library to readme 2026-10-16 21:58:28 -05:00
507df81f5f ManaBox import, with progress and a format explainer
Library → Import cards… now reads a ManaBox collection export, either the
.csv or the .txt. The CSV is matched by Scryfall ID, falling back to name,
set and collector number, and its Foil column picks the copy group's finish.
Condition, language and prices are ignored; proxies count as owned.

A decklist line that names a printing now resolves to that printing's card
when several cards share the name (a card and its token, or an art-series
entry), and a bare name prefers the real card.

Imports run in one transaction (nestable via SAVEPOINT), which took the
942-row sample from 22s to 0.2s, and off the main thread, with a progress
dialog for slow ones. An explainer of the supported formats now comes
before the file picker.
2026-10-16 21:57:52 -05:00
81b1df8c9f 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.
2026-10-16 21:44:55 -05:00
214a535588 Printing tracking for owned copies and deck art, and an outdated-card-data notice
Owned copies can now be pinned to a printing + finish (nonfoil / foil /
etched), activating the long-dormant library_card_copies table as groups
of identical copies. library_cards.quantity_owned stays authoritative:
groups are a subset of it, and the rest are "unspecified". Tracking more
copies than are unspecified grows ownership to fit; lowering ownership
trims the most recently added groups first. Migration 0006 adds the
group quantity, a unique (card, printing, finish) index, and
deck_cards.preferred_scryfall_id.

A deck slot can show a chosen printing's art, both faces from that
printing, falling back to the default when the id no longer resolves.
It survives quantity/board changes and is kept by duplicate_deck.

UI: the click preview's info tile gets a Printings section when opened
from the Library or a deck (copy groups with steppers, "Add a
printing…", and "Shown in this deck" with Change…/Default), backed by a
printing picker grid. The picker takes Escape in the capture phase so
it closes without closing the preview under it.

Sync: CardEntry.printings (keyed "<scryfall_id>/<finish>") and
DeckCardEntry.printing. Cards now merge field by field with groups per
key, so a quantity edit and a printing added on another device both
survive; merged groups are clamped deterministically. A document is
written as version 2 only once it holds printing data, so older builds
and servers refuse it instead of dropping the data and syncing the loss.

Decklists: "(SET) NUM", optionally "*F*"/"*E*", round-trips through deck
and library export/import. Library export writes a line per group plus
one for unspecified copies.

reference.db printings gain lang and released_at for picker labels and
ordering. When the installed card data lacks any column this build's
reference schema has (found by diffing against the schema applied
in-memory, so no list to maintain), a notice under the top bar offers
Update card data (and Import card data… on phones); "Not now" is
remembered until something more goes missing.
2026-10-16 21:06:17 -05:00
1c5e045591 Update docker tag 2026-10-16 20:12:11 -05:00
5d8549af2e Windows installer: cross-build on Linux and publish to a downloads folder
scripts/windows-publish.sh builds the NSIS setup.exe for
x86_64-pc-windows-msvc through cargo-xwin, versioned like the RPM and
APK, and copies it into a folder to serve: the newest three installers,
a stable mtgc-latest-x64-setup.exe, and SHA256SUMS.
2026-10-16 20:11:02 -05:00
8d510b8ffd Publish desktop releases to a self-hosted dnf repo
scripts/rpm-publish.sh builds the RPM, signs it and the repo metadata
with a dedicated GPG key, and adds it to a dnf repo in a given directory,
keeping the newest three versions for downgrades. The directory holds
nothing secret, so it can be served as is.

Both publish scripts now share the version scheme in
scripts/lib/release-version.sh: <major>.<minor>.<commit count>, plain
enough for RPM, MSI and semver alike. Android's versionCode stays the
commit count.

Fixes the publish scripts failing under set -u when the repo URL
variable isn't set, which is every run after the first. tauri.conf.json
now declares the license and homepage for the package metadata.
2026-10-13 22:05:17 -05:00
cec61b886e Run the sync server image as a numeric UID/GID; explain unwritable /data
The image now runs as USER 10001:10001 with a matching group, so
Kubernetes can verify runAsNonRoot and fsGroup: 10001 grants it a mounted
volume. When the database can't be opened because its directory isn't
writable, the server says so and how to fix it, instead of SQLite's bare
"unable to open database file". The README covers the pod securityContext.
2026-10-13 21:21:36 -05:00
3a72780027 Publish Android releases to a self-hosted F-Droid repo
scripts/fdroid-publish.sh builds a signed arm64 APK and adds it to an
F-Droid repo in a given directory, creating the app signing key and the
repo on first use. The versionCode is the commit count, so any commit can
ship without a manual version bump.

Release builds are signed when src-tauri/gen/android/keystore.properties
exists and stay unsigned otherwise. The manifest picks up the deep-link
plugin's intent filter, which every build regenerates and was never
committed.
2026-10-13 21:20:28 -05:00
5b4fa81bc1 Run the sync server as a plain container; stop cleanly on SIGTERM
Drop the Compose/Caddy example: production runs on Kubernetes, and locally
the container only needs a forwarded port and a volume. The README now gives
the `docker run` steps and what a Kubernetes deployment needs (one replica,
since it's a single SQLite file; a volume at /data; TLS at the ingress).

The server only shut down on Ctrl-C, so `docker stop` and pod termination,
which send SIGTERM, waited out the grace period and killed it. It now shuts
down gracefully on either.

Also ignore `.env`, which can hold the OIDC client secret.
2026-10-08 23:09:34 -05:00
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
196f1b9b21 Drop the internal working database from the README
It's an implementation detail the app deliberately hides: the user names and
moves a JSON file, and nothing else. Documenting the derived SQLite copy
invited people to think about (or back up, or move) a file that is rebuilt on
demand. The rationale for keeping it in private storage stays where it belongs,
in sync.rs's module docs.
2026-08-07 22:10:38 -05:00
96489f8e7c Update README for document-based sync and the Android port
The data-model section still described library.db as "the file you sync",
which is no longer how any of this works. Replace it with the document +
internal working copy split, and add a Sync section covering the three-way
merge, when sync runs, and the one-time conversion from an older library.db.

Also: the app is no longer desktop-with-a-future-mobile-port, so say so;
document the SAF folder grant on Android and why no storage permission is
declared; list the filters added since this was last touched, including the
caveat that the reference.db-backed ones need one card-data rebuild; and
mention the shell test suite and the Kotlin-only typecheck.
2026-08-07 22:08:35 -05:00
683f13e6bc Make 'tauri android dev --open' find a Toolbox-installed Android Studio
cargo-mobile2 locates Studio by scanning XDG data dirs for a .desktop entry
whose Name is exactly "Android Studio", then runs its Exec line. A standalone
install writes that name; JetBrains Toolbox writes a versioned one ("Android
Studio Quail 2 2026.1.2 Patch 1"), so the lookup misses and it falls back to
running "Android Studio" as a literal command, failing with an ENOENT that
names every env var except the actual problem.

android-setup.sh now writes a hidden shim entry when no exact-name match
exists, reusing the Exec line Toolbox already generated rather than hardcoding
a path. Idempotent: a later run reports Studio as discoverable and rewrites
nothing.
2026-08-02 13:27:24 -05:00
17c927afa3 Add a fish version of the Android env helper
Only the env helper needs a per-shell variant, since it has to mutate the
calling shell; android-setup.sh is executed rather than sourced and already
works from fish.

The fish version finds NDK/JDK candidates via `find` rather than globs because
fish raises an error on a wildcard matching nothing, and "SDK with no ndk/
directory yet" is a normal state the helper has to report cleanly.

Also switch the bash helper's NDK selection to `find | sort -V` so the two
agree: glob order is lexicographic, which would rank 9.x above 10.x. Verified
both pick the same NDK and JDK on this machine and against a fixture with
9.0.111 / 10.0.222 / 28.2.333 / 30.0.999-beta2 installed.
2026-08-02 13:22:36 -05:00
d494f2543b Add a sourceable Android env helper and document the Studio workflow
scripts/android-env.sh exports ANDROID_HOME/NDK_HOME/JAVA_HOME by
auto-detection, so there are no machine-specific paths to keep in sync. It
skips prerelease NDKs when several are installed and prefers Android Studio's
bundled JDK 21, which Gradle accepts.

Also document that Android Studio must be launched via
`cargo tauri android dev --open` rather than by opening src-tauri/gen/android
directly: Studio's Run button delegates the Rust build to
`tauri android android-studio-script`, which reads the dev-server address from
/tmp/<identifier>-server-addr and fails with "missing addr file" if no Tauri
dev session is running. `cargo tauri android build` needs no addr file.
2026-08-02 13:19:24 -05:00
d3154738d2 Add Android support via Tauri
The Rust core was already portable (caller-provided db paths, rustls rather
than openssl) and the shell already had the mobile entry point, so this is
mostly toolchain, provisioning, and platform-gating.

Toolchain:
- scripts/android-setup.sh installs what Android Studio doesn't: SDK
  cmdline-tools, a pinned stable NDK, and the Rust Android targets. The NDK is
  pinned rather than "latest" because sdkmanager's newest is often a beta
  (30.0.15729638 is r30-beta2) -- not something to compile SQLite with. Prefers
  Android Studio's bundled JDK 21, since Gradle rejects newer JDKs.
- Track src-tauri/gen/android (excluding build output): AndroidManifest.xml is
  hand-edited and Android permissions have no tauri.conf.json equivalent.
- vite: serve on TAURI_DEV_HOST so a device/emulator can reach the dev server.

Card data: downloading streams ~740MB to build a ~73MB db, which is rough on a
phone. Add import_reference_db to adopt a desktop-built file instead, validated
by db::inspect_reference_db first so picking the wrong file is a clean error
rather than a broken install. Installs via copy-then-rename so an interrupted
copy can't leave a partial db.

Ingest hardening (helps desktop too):
- Give ureq connect/read timeouts. Cancellation is only polled per parsed
  record, so a stalled socket previously hung forever with no way to cancel.
- Drop the remove_file before rename; POSIX rename already replaces atomically,
  and the delete-first window could leave no reference.db at all if the process
  was killed -- much likelier on Android.

UI: hide Open/New Library on mobile (scoped storage has no arbitrary-path
equivalent, and SQLite can't open a content:// URI), reported via a cfg!(mobile)
flag on Status rather than user-agent sniffing. Use 100dvh so the soft keyboard
doesn't break the shell.

Verified: 70/70 core tests, desktop build clean, and the aarch64 APK builds
(bundled SQLite C and ring both cross-compile under NDK 28). Not yet run on a
device.
2026-08-02 13:16:34 -05:00
d8a9787ecd Rebrand to mtgc: pirate-ship logo, lowercase app name, mtgc binary
- New logomark: an original pirate-ship silhouette (hull, twin billowing
  sails, swallow-tail pennant) in the terracotta brand gradient on a dark
  square — a nod to the MTG card "Pirate Ship", not a reproduction of its
  art. Source at src-tauri/icons/logo-source.svg; regenerate the full
  platform icon set (desktop/Windows Store/iOS/Android) with
  `cargo tauri icon src-tauri/icons/logo-source.svg`.
- Apply it in-app via a new inline ShipLogo component (App.tsx), replacing
  the old "M" sidebar mark and "✦" empty-state mark with dark rounded
  squares containing the ship glyph.
- Rename the app to lowercase "mtgc" everywhere: window title and
  productName (tauri.conf.json), <title> (index.html), sidebar brand text,
  empty-state heading.
- Rename the Tauri package/binary mtgc-app -> mtgc (and its lib crate
  mtgc_app_lib -> mtgc_lib), so `cargo tauri build` now produces
  target/release/mtgc; updated main.rs and every README reference.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-07 21:53:36 -05:00
131554532a Document GTK4 blocker in README and devel-setup.sh
Tauri v2's Linux backend hard-depends on GTK3 + webkit2gtk-4.1; GTK4
support is tracked upstream (tauri#7335, tao#1104, wry#1228) but
unmerged with no ETA. Note this so it isn't re-investigated from
scratch later.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-07 19:49:50 -05:00
399c628461 Initial commit: MTG personal library catalog (Tauri v2 + React/TS)
Full working app with:
- Rust core (mtgc-core): Scryfall ingester, nucleo fuzzy search, SQLite two-DB
  architecture (reference.db + library.db via ATTACH), criteria filters, deck ops
- Tauri v2 shell exposing the core as typed IPC commands
- React/TS frontend: card entry, library browser, deck editor
- Features: fuzzy card search, color/CMC/type/commander-identity filters,
  tile/list view toggle, hover card previews, deck format + commander support,
  per-card location field, grouping by type/subtype/CMC/color, localStorage
  persistence for active tab/deck/grouping, Discord-inspired dark UI (#C8553D accent)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 19:37:56 -05:00