The setup wizard's metadata step showed "API key invalid" for any
enabled provider that failed its heartbeat probe, including flag-only
providers like PlayMatch and Hasheous that have no API key. This
contradicted the Settings > Metadata sources view, which already adapts
its wording per provider.
Mirror that behavior: add a `requiresKey` flag to each source and use
connection-oriented wording for flag-only providers ("Unreachable" on a
failed probe, "Provider disabled" when off) instead of key-oriented
wording. Reuses existing locale keys, so no new translations are needed.
Fixes#3795
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Only auto-bind a default save as the "Save & Quit" write-back target when
the choice is unambiguous (a single save, or no compatible state armed).
With multiple saves and a state armed, loading the state injects a
different SRAM timeline, so binding an arbitrary user_saves[0] let
Save & Quit PUT over a named slot the user never selected. In that case
leave the save unbound and require an explicit slot pick.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds tools/benchmark_generated_metadata.py, which times the representative
roms_metadata read workload (rating/date sorts, player-count filter) and,
by default, flips between revision 0097 (derive-on-read view) and head
(generated columns) to print a before/after speedup table against the
same data.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The STORED generated columns backing roms_metadata used a terse rm_
prefix. Rename them to an explicit generated_ prefix (generated_genres,
generated_average_rating, etc.) and update the alembic autogenerate
filter in env.py to match.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The g-prefix sequences and the / search shortcut listened during play,
so pressing common game keys (g then h/p/c, or /) navigated away and
killed the session. Gate the handler on the playing store flag.
EmulatorJS set the flag on play but never cleared it on unmount, leaving
pad and hotkey navigation dead after exiting a game. Ruffle never set it
at all, so Flash sessions had no protection. Both players now flag the
session on play and release it on unmount.
useGamepad gates its pad-to-UI translation on the playing store flag, but
the v2 Stream player never set it, so button presses kept navigating the
app (and a Back/Start press could tear the session down mid-game). Flag
the session while launching or playing and clear it on unmount.
A self-hosted PLAYMATCH_API_URL on a LAN IP, localhost, or a Docker
service name is rejected by the shared HTTP client's SSRF defense before
connecting, so health checks and lookups fail. Add a narrowly scoped
allowlist, derived from the admin-configured provider URL, that both SSRF
gates (the static URL hook and the connect-time backend) honor. The
exception is matched by exact host and port, and the public default URL
is unaffected since public addresses already pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
failed_items was just the length of failed_ids. Remove the redundant
counter from the delete endpoints (roms + firmware) and the response
type; callers that need the count derive it from failed_ids.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Decouple save-file and savestate selection in the v2 player so they are no
longer mutually exclusive. When a compatible savestate exists, the config
screen still opens on the States tab, but the origin save now stays bound
instead of being nulled. This keeps "Save & Quit" updating that save file in
place (PUT) rather than spawning a new slot-less save (POST) that named-slot
sync clients never see.
Surface the save slot as a chip wherever a save renders (config-screen list,
resume preview, and the in-game save picker), guarded so states and slot-less
web saves show nothing. Adds the `play.slot` key across all locales and wires
`slot` into the story fixtures.
v1 (frozen) is left untouched; the change is v2-only.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The delete handler re-read the dialog refs (roms, platform, exclude flag)
after the request resolved. Because the dialog is a singleton, a fresh
showDeleteRomDialog event arriving mid-request could swap those refs, so
the completed request would prune the new dialog's IDs instead of the
ones it processed. Snapshot the state at entry and act on the snapshot.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The bulk delete endpoint deletes per-ROM and can partially fail, but the
v2 dialog pruned every requested ROM from the selection and gallery. A
ROM that failed to delete stayed in the library yet lost its selected
state, so the user couldn't retry the failed subset.
Return the failed IDs from the delete endpoints (roms + firmware, both
via BulkOperationResponse) and, on the client, only prune the ROMs that
were actually removed. Failed ROMs stay selected and visible for retry;
the single-ROM route only navigates away when its ROM was deleted.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The v2 delete flow cleared only the legacy v1 selection store
(romsStore.resetSelection()), leaving the v2 gallerySelection store
untouched. Since v2 multiselect and the SelectionBar read from
gallerySelection, the deleted ROMs stayed selected: the bar remained
open with stale rows and re-running a bulk action 404'd.
Drop the deleted IDs from gallerySelection via removeIds so a full
delete closes the bar while a partial delete keeps the rest selected.
Fixes#3822
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a PLAYMATCH_API_URL env var (defaulting to the public instance) so
users can point RomM at a self-hosted Playmatch deployment. The handler
now derives all endpoints from this configurable base URL.
Fixes#3820
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The roms_metadata VIEW re-derived its facet columns by JSON-parsing up to
eight raw provider-metadata blobs on every roms row, on every query, making
galleries, search, and sorts CPU-bound on large libraries.
Move the per-row derivation into STORED generated columns on roms (rm_*),
maintained automatically by the database engine (no application hook, no
background job). roms_metadata is redefined as a thin projection over them,
so the RomMetadata model, every handler query, and the virtual_collections
view are unchanged and inherit the speedup. Indexes on the release-date,
rating, and player-count columns back the corresponding sorts and filters.
On a 75k-row MariaDB library: release-date sort 1.15s -> 0.05s, facet-value
scan 3.35s -> 0.18s, player-count filter 0.54s -> 0.04s; virtual_collections
4.2s -> 1.3s. Generated columns match the old view byte-for-byte across all
rows except the quoted-string dates the old view silently truncated to 0.
Cross-engine correctness:
- MariaDB JSON_UNQUOTE before every numeric CAST avoids strict-mode INSERT
truncation on quoted values.
- PostgreSQL to_timestamp()/jsonb_build_array() are only STABLE and illegal
in generated columns; the gamelist date and age-ratings derivations run
through IMMUTABLE wrapper functions. Gamelist dates are parsed as UTC on
both engines so the stored value is time-zone independent.
Fixes#3768.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A window fetch that was interrupted mid-apply (filter / sort / scan
refresh / context switch clearing `pendingWindows` during a frame yield)
still fell through to `loadedWindows.add(offset)`, so later viewport
syncs skipped the offset and left its cards as permanent skeletons.
`pendingWindows` membership is also ambiguous: a replacement fetch for
the same offset re-adds it, so the stale fetch's `finally` could delete
the new fetch's controller / pending entry.
Guard the whole post-await path by AbortController identity
(`inFlightControllers.get(ctrlKey) === controller`), mirroring the
bootstrap fetch: bail before applying metadata, use it as the
batched-apply relevance signal, re-check before marking the window
loaded and before recording a failure/retry, and only clear our own
bookkeeping in `finally`.
Adds a regression test: invalidating the context mid-apply must not mark
the window loaded, and the fresh context must be able to refetch it.
Replace the English placeholder for refresh-update-desc and
refresh-update-desc-bulk with a proper translation per locale, reusing
each language's established terms for "metadata" and "provider".
Also strengthen the frontend-i18n skill to require real per-locale
translations (not English copies) and add the missing tr_TR entry to
its locale list.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Set refresh-update-desc and refresh-update-desc-bulk to the same
English sentence ("Re-fetch metadata from the selected providers") in
every locale, replacing the old unmatched-flavored strings. The keys
stay separate.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The v2 gallery hydrated each visible card with its own
GET /roms/{id}/simple request. Fast-scrolling a large library (900+),
especially with multiple users at once, fires dozens of concurrent
requests that funnel through a backend defaulting to a single worker,
overwhelming it until the container recycles/restarts.
Re-batch hydration through the store's windowed fetch:
- Replace per-card fetchRomAt/cancelFetchAt with fetchWindowAt /
syncVisibleWindows. Each visible position aligns to its shared 72-item
window and loads via one paginated getRoms; positions in the same
window collapse to a single request, deduped against loaded/pending
windows, with out-of-view windows cancelled and failed ones retried.
- GalleryShell.collectVisiblePositions now covers both grid (row) and
list (list-row) items, so both layouts route through the debounced
syncFetches -> syncVisibleWindows path.
- GameListRow no longer self-fetches on mount; the shell drives it.
Cap concurrency (MAX_CONCURRENT_WINDOWS = 4): windows over the ceiling
queue and drain as slots free up, so no scroll speed can flood the
backend. The list path is now debounced too (previously grid-only).
Adds a store unit test for the batching and the concurrency cap.
Fixes#3800
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The v2 RefreshMetadataDialog wired its "Update metadata" option to the
`unmatched` scan type instead of `update`. UNMATCHED only fetches from
providers that haven't matched a ROM yet, so an already-identified ROM
missing derived fields (summary, cover, screenshots) got nothing
repopulated. UPDATE re-fetches by existing provider id and fills those
gaps, which is what the option's label promises.
Repoint the option to `update`, update the type union, default, and
disabled-reset fallback, and correct the two subtitle strings that
described the old unmatched behavior.
Fixes#3801
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use the generated SimpleRom type for the verification helpers instead of
an ad-hoc structural type.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The v2 details "Verified ROM" badge was gated on `crc_hash` being
present, but a hash is computed for essentially every ROM (including
compressed archives that never matched any database). This made the
badge appear on unverified ROMs (#3806).
Introduce `romVerification` as the single source of truth, mirroring
the backend's `_filter_by_verified`: a ROM is verified only when a
Hasheous signature match flag is set. Drive the header badge, the
Metadata-tab per-database chips, and (fixed) the RetroAchievements chip
(`ra_match`, not `ra_id`) from the same shared list, and add the
previously missing WHDLoad / PureDOS databases.
Also clarify what the badge means (#3807): the header tooltip now spells
out that it is a database hash match (Hasheous / RetroAchievements), with
the short label kept as the icon's accessible name.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The v2 RSelect/RTextField only render a visible label when `prefix-label`
is set; with just `:label` the text degrades to a placeholder + aria-label.
Because these fields always hold a value, the placeholder never shows, so
no label was ever visible.
Add `prefix-label="stacked"` to:
- the "Token expires in" select (and the "Device name" field beside it) on
the device authorization screen (DevicePair.vue)
- the "Expiration" select in the create-client-token dialog, which had the
same latent issue
Fixes#3814
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Series titles like "Metal Gear Solid: Portable Ops Plus" and the Pokemon
Ranger games were resolved to the same IGDB (and, downstream, SteamGridDB)
entry as their base game, so distinct ROMs became siblings.
The first `_search_rom` pass filters by game_type, which excludes types like
EXPANSION, so a more specific variant is often absent from its candidates.
Jaro-Winkler scores the base title against the searched variant at ~0.99
(well above the 0.75 threshold), so the base was accepted and returned before
the broader search passes ran.
Only trust a first-pass hit outright when it is an exact match or not a
prefix/superset near-miss of the search term. Otherwise widen the search:
re-query without the game_type filter (the reliable recovery for excluded
types) alongside the existing expanded search, then re-rank across the union
so an exact variant outranks the base near-miss. The base stays in the pool,
so it remains the fallback when no better match exists.
Fixes#3805
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>