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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>