Commit Graph

10817 Commits

Author SHA1 Message Date
Georges-Antoine Assi
2cc8c02101 feat(v2): record EmulatorJS play sessions in the v2 shell, not v1 Player
Wire usePlaySession into the v2 EmulatorJS view so a session is recorded on
any exit path (in-emulator Exit/Save & Quit, back nav, or route change),
starting when the game goes live and flushing on unmount. flush() is
idempotent so overlapping exit paths can't double-submit.

Remove the play-session ingest from the shared v1 Player component so there
is a single source of truth and no double-recording. immediateExit now only
navigates back to the game details view.

Note: Player.vue is also mounted by the v1 EmulatorJS view, which no longer
records sessions as a result; acceptable while v1 is frozen and slated for
removal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 16:32:39 -04:00
Georges-Antoine Assi
b720781f87 more cleanup 2026-07-21 16:15:02 -04:00
Georges-Antoine Assi
58ec1c4aa8 feat(v2): drive rom_user status from play sessions, not launch write
Move the per-play status update (last_played, now_playing, and the
finished/empty -> incomplete rewind) off the optimistic launch-time write
and onto play-session ingest, so it reflects real play and is recorded once.

Backend: ingest now updates rom_user status when a session is the newest
play, leaving deliberate statuses (completed_100 / retired / never_playing)
untouched and skipping backfilled older sessions so they can't resurrect
now_playing.

Frontend: new usePlaySession composable records a session and ingests it on
exit; wired into Ruffle and Stream. EmulatorJS already ingests via the
embedded v1 Player, so its launch-time recordLaunch is dropped. The dead
recordLaunch / applyLaunchStatus helpers are removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 15:56:28 -04:00
Georges-Antoine Assi
7ce5a4719c Merge remote-tracking branch 'origin/master' into feat/v2-launch-status-and-confirm
# Conflicts:
#	frontend/src/composables/useUISettings.ts
#	frontend/src/v2/views/Settings/UserInterface.vue
2026-07-21 09:57:15 -04:00
Georges-Antoine Assi
ccb4a3986a fix(v2): decouple stream launch-status write from the claim transaction
Move recordLaunch out of the claimSession try/catch and run it after a
successful claim (gated on playerState === "playing"). The launch-status
write is incidental metadata, so keeping it inside the launch transaction
risked coupling it to the claimed-session lifecycle; running it afterward
ensures it can never affect play or leave a claimed session needing cleanup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 09:04:50 -04:00
Georges-Antoine Assi
44c467524e fix(v2): revert local status and handle rejection when a launch write fails
The launch write optimistically mutated the shared rom_user but was
fire-and-forget, so a network/authorization/server failure produced an
unhandled rejection while the client kept status values that were never
persisted. Introduce a shared recordLaunch() helper that snapshots the
fields, applies the optimistic update, and on failure reverts them and logs
instead of leaving the rejection unhandled. Use it in all three v2 players
(EmulatorJS, Ruffle, Stream) so the behavior is consistent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 09:00:13 -04:00
Georges-Antoine Assi
bad4f92702 fix(v2): record Ruffle launch only after playback starts
Move the now-playing / last_played write into the nextTick after the Ruffle
player is created and the SWF load is issued, so a failed player creation or
load no longer leaves the game marked playing (or rewinds its status).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 08:48:20 -04:00
Georges-Antoine Assi
810f61be66 Merge pull request #3868 from rommapp/dependabot/uv/pydantic-settings-2.14.2
build(deps): bump pydantic-settings from 2.14.1 to 2.14.2
2026-07-21 08:39:26 -04:00
Georges-Antoine Assi
a932507b5c Merge pull request #3861 from rommapp/feat/reassociate-missing-roms-by-hash
feat(scan): reassociate renamed/moved ROMs with missing entries by file hash
2026-07-21 08:39:11 -04:00
Georges-Antoine Assi
953ce94045 test(db): make test_screenshots deterministic across backends
rom.screenshots has no guaranteed order, so indexing into it picked a
different row on PostgreSQL than on MariaDB and failed CI. Fetch the
original screenshot by its known id instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 08:33:58 -04:00
Georges-Antoine Assi
55b3b45981 fix(roms): return 404 for single-file downloads missing on disk
In DEV_MODE the content endpoints serve a single-file ROM straight through
FileResponse, which raises a RuntimeError at send time when the file no
longer exists on disk (e.g. a renamed or moved ROM whose old entry is now
missing). Check the path first and raise a clean 404 instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 08:33:56 -04:00
Georges-Antoine Assi
b7ff92e792 more cleanup 2026-07-21 08:29:38 -04:00
Georges-Antoine Assi
7e8be36ea6 cleanup 2026-07-21 08:09:40 -04:00
Georges-Antoine Assi
e129142fb4 test(v2): cover applyLaunchStatus and the play() launch confirmation
Adds unit tests for the shared applyLaunchStatus helper (now-playing flag,
empty/finished -> incomplete rewind, and protection of completed/retired/
never-playing) and for useGameActions.play()'s confirmation gate (normal
launch skips the prompt, retired/never-playing launches prompt and abort on
cancel or proceed on confirm, and the per-user preference disables it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 08:02:44 -04:00
Georges-Antoine Assi
b21be05f1c fix(scan): only reassociate on an unambiguous single hash match
When more than one missing entry shares the same CRC/MD5/SHA1 (e.g.
duplicate content stored twice), limit(1) returned an arbitrary row, so
reassociation could move user data onto the wrong game nondeterministically.
Fetch up to two matches and reassociate only when exactly one exists;
otherwise fall back to creating a new entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 08:01:32 -04:00
Georges-Antoine Assi
d66a3f90c2 fix(scan): require CRC, MD5, and SHA1 to all match for reassociation
The reassociation lookup OR'd the individual hashes across the Rom and its
RomFiles, so a lone CRC32 collision (or one shared child-file hash) could
move an unrelated missing entry onto the scanned file, attaching the wrong
collections, notes, and assets. Require all three of CRC, MD5, and SHA1 to
match on the ROM row instead; any missing hash yields no match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 07:58:26 -04:00
dependabot[bot]
e77dd2c34d build(deps): bump pydantic-settings from 2.14.1 to 2.14.2
Bumps [pydantic-settings](https://github.com/pydantic/pydantic-settings) from 2.14.1 to 2.14.2.
- [Release notes](https://github.com/pydantic/pydantic-settings/releases)
- [Commits](https://github.com/pydantic/pydantic-settings/compare/v2.14.1...v2.14.2)

---
updated-dependencies:
- dependency-name: pydantic-settings
  dependency-version: 2.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-21 11:57:04 +00:00
Georges-Antoine Assi
e9a518458e feat(v2): auto-mark games now-playing on launch + confirm launching shelved games
Launching a game now advances its per-user status: it is marked "now
playing" and an empty or "finished" status rewinds to "incomplete", while
statuses the user set on purpose (completed 100% / retired / never playing)
are left untouched. This is applied at the authoritative launch write of all
three v2 players (EmulatorJS, Ruffle, Stream); Ruffle and Stream previously
persisted nothing on launch, so they now also refresh last_played.

Launching a game marked Retired or Never Playing now asks for confirmation
first, so an accidental Play does not silently reactivate a game the user
deliberately shelved. Gated by a new per-user preference
(confirmProtectedLaunch, on by default) exposed as a Gameplay toggle in
Settings > User Interface.

Adds the shared applyLaunchStatus helper and 5 i18n keys across all 18
locales.

Part of #3721.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 07:55:03 -04:00
Georges-Antoine Assi
5ff58c1438 Merge pull request #3863 from rommapp/dependabot/uv/pillow-12.3.0
build(deps): bump pillow from 12.2.0 to 12.3.0
2026-07-21 07:54:43 -04:00
Georges-Antoine Assi
4584be518f Merge pull request #3859 from rommapp/feat/v2-home-smart-virtual-collections
feat(v2): show smart and virtual collections on the home screen
2026-07-21 07:54:10 -04:00
Georges-Antoine Assi
774ccaded8 cleanup 2026-07-21 07:49:37 -04:00
dependabot[bot]
00345956e0 build(deps): bump pillow from 12.2.0 to 12.3.0
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.2.0 to 12.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/12.2.0...12.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.3.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-21 10:10:45 +00:00
Georges-Antoine Assi
2b58cd1a16 Merge pull request #3860 from rommapp/feat/collection-random-rom
feat(v2): add random-ROM button to collections
2026-07-20 22:32:46 -04:00
Georges-Antoine Assi
aa28e9054b refactor(v2): reuse platform random-ROM i18n keys and guard stale nav
Point the collection random-ROM button and error snackbar at the
existing platform.random-rom* keys and drop the duplicate keys from
collection.json across all locales. Bail out of onRandomGame's
navigation if the active collection changes while a request is in
flight, so a pick started in one collection can't open a ROM after the
user has moved on.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 22:30:41 -04:00
Georges-Antoine Assi
6ec3820cf6 feat(scan): reassociate renamed/moved ROMs with missing entries by hash
When a ROM file is renamed or moved, the scan matched files to DB rows
solely by (platform_id, fs_name), so the old row was flagged missing and
the renamed file became a brand-new entry, orphaning all user data
(collections, notes, per-user status, uploaded saves/states/screenshots).

Now, when a scanned file matches no existing fs_name, the scan hashes it
first and looks for an existing missing_from_fs entry on the same platform
with a matching hash. On a match it moves that entry onto the new file and
clears its missing state, preserving user data linked by rom_id, instead
of inserting a duplicate. Empty hashes never match, so non-hashable
platforms and SKIP_HASH_CALCULATION fall back to creating a new entry.

File hashing is hoisted so it runs once per new file and is reused for
both the reassociation probe and the downstream scan.

Fixes #3618

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 22:28:34 -04:00
Georges-Antoine Assi
ec39078620 feat(v2): add random-ROM button to collections
Add a random-game shortcut to the v2 collection view, mirroring the one
platforms already have. Works for regular, virtual, and smart
collections by scoping the getRoms filter param to the collection kind.
No backend changes: getRoms already accepts collection/virtual/smart ids.

Fixes #3718

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 22:14:31 -04:00
Georges-Antoine Assi
ed01f5885e feat(v2): show smart and virtual collections on the home screen
Port the v1 home behaviour to the v2 home: smart and virtual
(autogenerated) collections can now be surfaced as their own rows,
each toggled independently from the regular collections row.

- Add `showSmartCollections` UI setting; wire the existing
  `showVirtualCollections` / `virtualCollectionType` settings into v2.
- Fetch smart/virtual collections on the home view only when their
  toggle is on, so the expensive virtual "all" fetch is skipped when
  disabled.
- Render Smart and Virtual CardRows reusing the CollectionTile pattern.
- Move the smart/virtual visibility toggles into the "Home sections"
  settings group; the "Virtual collections" section keeps only the
  collection-type selector.
- Add `settings.show-smart-collections` (+ desc) to all 18 locales.

Closes #3720

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 22:14:15 -04:00
Georges-Antoine Assi
f5fee69f1a Merge pull request #3858 from rommapp/fix/v2-scroll-lock-and-library-stats-cutoff
fix(v2): overlay body-scroll-lock leaks + Library Stats label clipping
2026-07-20 21:53:11 -04:00
Georges-Antoine Assi
52fb6be0c8 fix(v2): share one body scroll lock across all overlays
RDialog and RDrawer each mutated body { overflow: hidden } but tracked
it with their own counter and saved-overflow key (rDialogOpenCount vs
rOverlayOpenCount). A dialog stacked over a drawer (or vice versa) would
restore overflow off its own count when it closed and clobber the other
overlay's lock, leaving the page scrollable while an overlay was still
open, or permanently locked once all closed.

Extract a single reference-counted lock (createBodyScrollLock) that
every overlay shares, so the body only unlocks once the last overlay
closes, in any close order. RDialog's z-index stack depth now reads the
shared overlay count (drawers sit below dialogs, so relative dialog
ordering is unchanged). Add a unit test covering the cross-overlay case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 21:43:11 -04:00
Georges-Antoine Assi
37c58a74ef fix(v2): stop Library Stats labels from clipping in extended mode
Extended mode used a fixed 420px card with a repeat(3, 1fr) grid. Since
values don't shrink, large numbers (84,283, 290.6 TB) consumed the
column and the label clipped via text-overflow ("Screenshots" -> screens,
"Size on Disk" -> "Size o"). Size the card to its content (max-content)
with auto columns, and let the label flex to keep values right-aligned
without ever truncating. The rail already scrolls horizontally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 21:36:19 -04:00
Georges-Antoine Assi
a5f2fcb4cc fix(v2): release body scroll lock when an open overlay unmounts
RDialog/RDrawer locked `body { overflow: hidden }` from their
`modelValue` watcher but only unlocked it in the watcher's close
branch. Consumers that null a `v-if` entity in the same tick as `show`
(e.g. EditRomDialog's closeDialog) unmount the overlay before that
branch runs, so the lock leaked and the page could no longer scroll.

Guard each instance with `holdsLock` so lock/unlock are idempotent, and
release in `onBeforeUnmount` as a safety net.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 21:36:17 -04:00
Georges-Antoine Assi
262271b395 Merge pull request #3857 from rommapp/feat/cover-search-filters
feat: add filters to manual cover search (SteamGridDB)
2026-07-20 20:58:47 -04:00
Georges-Antoine Assi
b805f36f26 refactor: extract cover filters into composable, simplify controls
Move the SearchCoverDialog filtering/sorting logic into a
useCoverFilters composable. Drop the "All sources" dropdown (and its
locale key), turn the sort control into a left-floated toggle with a
Relevance/Most votes label, rename the providers-covers key to
metadata-providers, and stop resetting filters on every re-search.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 20:52:18 -04:00
Georges-Antoine Assi
0a262ebf8d Merge pull request #3855 from Spinnich/feat/platform-descriptions
feat(platforms): add editable platform descriptions
2026-07-20 19:16:52 -04:00
Georges-Antoine Assi
08fa010383 feat: add filters to manual cover search (SteamGridDB)
Adds client-side filters to the v2 manual cover-search dialog so users
can narrow SteamGridDB results without endless scrolling:

- Source (SteamGridDB / each metadata provider)
- Resolution (dynamically built from the results present)
- Style (alternate / blurred / material / no logo / white logo)
- Uploader (searchable list of contributors)
- Content toggles (NSFW / humor / epilepsy, NSFW off by default)
- Sort by relevance or most votes

Backend surfaces the rich per-cover metadata SGDB already returned but
was discarding: SGDBResource / SearchCoverSchema now carry width,
height, style, author, score and content flags, and the cover-search
path fetches every content variant so the picker can toggle them
client-side. Auto-scan cover selection is unchanged and stays
safe-by-default.

New keys translated across all 18 locales.

Closes #3749

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 19:08:01 -04:00
Georges-Antoine Assi
389e768ee8 cleanup 2026-07-20 19:04:59 -04:00
Georges-Antoine Assi
31c19f754e Merge pull request #3854 from rommapp/feat/scan-settings-v2-ui
feat: editable v2 UI for scan settings
2026-07-20 18:58:15 -04:00
Georges-Antoine Assi
4031072eaf cleanup 2026-07-20 17:31:36 -04:00
Spinnich
fa2631ef11 fix(platforms): don't stamp custom_name on a description-only edit
Found while testing the v2 form: saving only a description also wrote
`custom_name`, because the merged save always sent the name field. The
previous name-only form bailed unless the name was dirty, so `custom_name`
was written just on a real rename.

The effect was invisible (`display_name` falls back to `name`, so it looked
unchanged) but not harmless: the platform gained an explicit custom name
that would shadow later upstream metadata renames.

Each field is now sent only when it actually changed. Covered by a component
test that fails if the name is written unconditionally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 20:41:08 +00:00
Georges-Antoine Assi
33332488d6 cleanup 2026-07-20 16:33:00 -04:00
Georges-Antoine Assi
e1ce87018f rnu generate 2026-07-20 16:16:58 -04:00
Georges-Antoine Assi
e4ff481731 tweaks 2026-07-20 16:15:33 -04:00
Spinnich
84dd839a62 fix(platforms): keep the v1 UI untouched
The previous commit changed the shared updatePlatform signature, which
forced a matching edit in the v1 platform drawer and tripped the
check-v1-frozen CI gate.

Keep the platform-object argument so the v1 call site compiles unchanged,
and make `description` an opt-in second field instead. Callers that only
rename still send custom_name alone, which is exactly the pre-existing
behaviour and keeps them from replaying a stale description.

The fully explicit signature is the nicer shape and worth revisiting once
v1 is deleted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 20:10:27 +00:00
Spinnich
82caaf87a9 fix(platforms): address review feedback on PR #3855
Bound the user-authored fields. `description` (TEXT) and `custom_name`
(VARCHAR(400)) had no length constraint, so an oversized value reached the
database and surfaced as an unhandled DataError, turning a bad request into
a 500. Both are now validated against the column limits, which are defined
next to the columns so the bounds can't drift from the schema. The
`custom_name` case predates this branch but shares the line of code.

Make platform updates a true partial update. The shared API service took a
whole Platform object and sent every field, so the v1 rename drawer replayed
whatever description it happened to be holding; if another client had changed
the description in the meantime, renaming silently reverted it. The service
now takes explicit optional fields, so omitting one means "leave it alone"
rather than "write back my cached copy".

Watch the two form fields independently. Re-seeding both whenever either
canonical value changed meant a socket update touching only the name threw
away an unsaved description edit, and vice versa.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 20:01:05 +00:00
Spinnich
98e8ae7599 feat(platforms): add editable platform descriptions
Custom platforms could only be distinguished by name, which is often not
enough context (e.g. a "Sega - Genesis/Mega Drive (Unofficial)" folder
holding aftermarket and unlicensed dumps). Platforms now carry an
optional free-text description, mirroring collections.

The column is nullable and defaults to "", matching custom_name, so a
rescan (which merges a freshly scanned Platform over the existing row)
leaves it untouched. update_platform patches only the fields sent, so an
omitted description is preserved and an empty string clears it.

Surfaced in the v2 UI only: the Settings tab name form now covers both
custom_name and description, and PlatformHead renders the description as
a chip alongside the metadata chips. v1 is frozen and gets no new UI, but
round-trips the field unchanged through the shared API service.

Closes #3402

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 19:00:30 +00:00
Georges-Antoine Assi
191cd1f24c feat(config): editable v2 UI for scan settings
Expose the scan.* section of config.yml (metadata & artwork priority,
per-field artwork overrides, region priority, language priority, media
types, gamelist and pegasus export) in an editable v2 Settings page.

Backend:
- Add PUT /api/config/scan (platforms.write) with a validated
  ScanSettingsPayload and ConfigManager.update_scan_settings().
- Expose GAMELIST_AUTO_EXPORT_ON_SCAN and PEGASUS_AUTO_EXPORT_ON_SCAN
  in ConfigResponse / GET /api/config.
- Preserve the streaming section on runtime config writes (previously
  dropped on every write).

Frontend:
- New Settings/ScanSettings.vue page + ScanPriorityList.vue reorderable
  list (drag + up/down for keyboard/gamepad); region/language use
  RComboboxField.
- Wire the scan-settings route, permissions, and sidebar entry.
- Regenerate OpenAPI types; add all new strings to every locale.

Closes #3849

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 11:24:31 -04:00
Georges-Antoine Assi
8ddcf01330 Merge pull request #3852 from rommapp/fix/gamepad-phantom-pad-nav-loop
fix(v2): ignore phantom/non-standard gamepads in nav polling
2026-07-20 11:18:09 -04:00
Georges-Antoine Assi
ebc0046a1b Merge pull request #3853 from rommapp/fix/hidden-rom-authorization-bypass
fix: enforce hidden-ROM/platform visibility on asset download and streaming endpoints
2026-07-20 11:17:02 -04:00
Georges-Antoine Assi
f223da4fe1 cleanup 2026-07-20 11:15:57 -04:00
Georges-Antoine Assi
c9a8ceedd7 fix: enforce hidden-ROM/platform visibility on asset download and streaming endpoints
Several endpoints authorized cross-user access by the is_public flag (or
by scope alone for streaming) without re-checking whether the parent ROM
or platform is hidden from the caller. A user blocked from a ROM/platform
could still download a public save/state/screenshot attached to it, or
claim a streaming session for it, by supplying the asset/ROM id directly.

Route all four through the existing assert_rom_visible() 404-masking
helper, right after loading the record and before any file access or
broker launch, matching the ROM detail/content endpoints.

- saves.py / states.py / screenshots.py download_* : public sharing no
  longer overrides the hidden-resource boundary.
- streaming.py claim_session : hidden ROM/platform can no longer be
  launched via its id; broker is never contacted.

Regression tests cover hidden-ROM and hidden-platform cascade for each
endpoint, plus a positive control that public sharing still works when
the ROM is visible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 11:04:49 -04:00