Commit Graph

10824 Commits

Author SHA1 Message Date
Georges-Antoine Assi
57e207cff2 fix(db): don't use STR_TO_DATE in a generated column
MariaDB 12.3 enforces that STR_TO_DATE (which reads lc_time_names) cannot
appear in a GENERATED ALWAYS AS clause, so migration 0098 failed with
error 1901 and RomM could not start. Earlier releases up to 12.2 accepted
it, which is why the problem only surfaced on 12.3.

The gamelist value is already pinned to a fixed-width "YYYYMMDDThhmmss" by
the regex guard, so it is reshaped into a canonical datetime literal with
SUBSTRING/CONCAT and fed to the existing TIMESTAMPDIFF. Stored values and
their time-zone independence are unchanged.

Fixes #3873

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 07:25:35 -04:00
Georges-Antoine Assi
ace658306e Merge pull request #3867 from rommapp/feat/v2-launch-status-and-confirm
feat(v2): auto-mark now-playing on launch + confirm launching shelved games
5.1.0-alpha.1
2026-07-21 18:11:22 -04:00
Georges-Antoine Assi
e87571d7f5 fix(v2): send exit-time play session with keepalive so it survives reload
Leaving EmulatorJS triggers a full page reload (to reset COOP/COEP) that
aborts the in-flight play-session POST. Add an ingestPlaySessionsKeepalive
variant using fetch with keepalive (plus the session cookie and CSRF header),
and have usePlaySession.flush() use it so the session is recorded even as the
document unloads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 16:51:57 -04:00
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
2baf81914b Merge pull request #3871 from rommapp/fix/collection-settings-visibility-toggle-revert
fix(v2): keep collection visibility toggle in sync after save
2026-07-21 15:46:37 -04:00
Georges-Antoine Assi
ed811c7c51 Merge pull request #3870 from rommapp/fix/collection-mosaic-lazy-loading
fix(collections): lazy-load collection mosaic artwork
2026-07-21 15:46:01 -04:00
Georges-Antoine Assi
55f9eb6165 fix(collections): lazy-load collection mosaic artwork
The Collections tab renders every collection tile's artwork through
CollectionMosaic, but its <img> tags lacked loading="lazy"/decoding="async".
With hundreds of virtual collections the browser eagerly fetched every cover,
flooding the server with image requests for off-screen tiles.

Add the same lazy hints GameCover already uses to both image branches so
artwork is only fetched near the viewport. CollectionListRow reuses this
component, so grid and list layouts both benefit.

Fixes #3865

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 15:00:21 -04:00
Georges-Antoine Assi
098672395d fix(v2): keep collection visibility toggle in sync after save
The collection Settings tab re-snapshotted the form from `props.collection`
right after a successful PUT, but that prop only receives the fresh value
on the next microtask (store array-replace + parent ref reassign). So the
snapshot read the pre-save object and reverted `form.isPublic` to its old
value, leaving `dirty` true and the Apply button visible even though the
change was persisted.

Snapshot from the update response instead: `snapshot()` now accepts an
optional source collection, and `save()` passes the returned `data`.

Fixes #3864

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 15:00:19 -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