A scraped bezel can be misaligned or oversized and obscure the running
game, with no way to turn it off. Add a per-game "Show bezel" switch to
the player's Setup panel, shown only when the game has a bezel. The
choice persists in localStorage (player:<romId>:bezel); bezels stay on
by default and only the hidden state is stored.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The v2 player never drew a game's bezel overlay. Add it to the v2 shell
(v1 is frozen), building the image URL from the resources base like
covers / box-art so the relative bezel_path resolves to the real PNG
instead of the SPA's HTML fallback.
EmulatorJS fullscreens its own #game container, which the browser
promotes to the top layer, so a sibling overlay vanishes there. Teleport
the bezel into that container while fullscreen so it keeps framing the
game, and keep its z-index below the EmulatorJS controls.
Fixes#3939
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The v2 player restored the per-game disc choice from localStorage
(player:<romId>:disc) with a bare parseInt and never checked the id still
existed. After a rescan the rom's file ids change, so the player kept
requesting a missing file; the download endpoint 404s and EmulatorJS
surfaces it as a generic "Network Error". Single-file games were hit
hardest since they have no disc picker to recover.
Add a resolveStoredDisc helper that keeps the saved id only when it still
matches a current rom file, otherwise falls back to the first file and
flags the entry as stale so the caller drops it from localStorage. Ports
the v1 guard (d1696cd0) to v2.
Fixes#3938
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The detail response listed a ROM's smart collections by loading every
own/public smart collection and scanning its cached rom_ids list in
Python. rom_ids grows with library size, so this got heavier on large
libraries on every detail load.
Push containment + visibility into the query via the existing cross-DB
json_array_contains_value helper (JSON_CONTAINS on MariaDB/MySQL, @>/?
on Postgres), returning only the matching rows with id/name/is_public.
The schema mapper no longer filters, so smart_for_user becomes the plain
from_smart_collections mapping. Behavior is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The overview's Collections row enriches each tile (cover mosaic + rom
count) from the collections store, but the v2 AppLayout only hydrated
regular collections. On direct navigation to a ROM, a smart-collection
tile therefore fell back to a countless, coverless entry ("0 games", no
cover). Fetch smart collections alongside the regular ones so the tiles
resolve their real count and covers.
Fixes#3934
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The ROM detail response only filled `user_collections` from a rom's
standard collections (the collections_roms join), so smart collections
were silently omitted from the detail overview's Collections row.
Add smart-collection membership to the response: `UserCollectionSchema`
gains an `is_smart` flag and a `smart_for_user` builder that keeps the
smart collections whose cached rom_ids include the rom (respecting own /
public visibility), and `DetailedRomSchema` appends them alongside the
standard ones. The v2 overview renders them with the smart kind badge and
routes them to the smart-collection view.
Fixes#3934
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
MariaDB/MySQL auto-commit each DDL statement, so a failure partway
through 0100/0101/0103 committed the CREATE TABLE / ADD COLUMN but never
advanced alembic_version. Every reboot then re-ran the migration from the
top and died on "Table ... already exists", wedging the boot loop
permanently.
Guard the schema changes so a re-run after a partial failure recovers:
- 0100: CREATE TABLE ... if_not_exists, catalog-check the index, make the
backfill idempotent with an anti-join, DROP TRIGGER IF EXISTS before
each CREATE TRIGGER (both MySQL and Postgres paths).
- 0101: same treatment; backfill uses INSERT IGNORE / ON CONFLICT DO
NOTHING, triggers dropped before recreation, view already drops first.
- 0103: skip add_column for provider ids that are already present.
0102 already used if_not_exists / catalog checks; this brings the rest of
the batch in line. Verified by reproducing the wedged state (version at
0099 with the later tables already present) and confirming upgrade head
now recovers cleanly to 0103, plus the rom_facets and stats test suites.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On MariaDB/MySQL a foreign key between VARCHAR columns requires both
sides to share a collation. Migrations 0082 and 0089 added referencing
columns that inherit their table's collation, which can differ from
devices.id on databases whose older tables predate the MariaDB 11.6+
utf8mb4_uca1400_ai_ci default. The FK creation then fails with errno
150 (Foreign key constraint is incorrectly formed).
Look up devices.id's collation from information_schema and create the
referencing column with it, and re-pin the collation when a previous
partial run left the column behind with a mismatched one. No behavior
change on PostgreSQL.
Fixes#3915
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the hardcoded `build.cssTarget` version list with a single source
of truth. The browser baseline (Tailwind v4's floor) now lives in
`.browserslistrc` as `>=` floors, and vite.config derives the esbuild-style
`cssTarget` Lightning CSS needs from it. Version data comes from
caniuse-lite instead of being pinned in the build config, and any other
tool reads the same file.
No behavior change: the derived targets resolve to the same set, so the
production build still emits both `-webkit-backdrop-filter` and the
standard property for every glass surface.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Scan Settings was reachable only through the settings sidebar. Add it
to the user dropdown's Library group, mirroring the sidebar's order,
icon, and platforms.write gate.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Vite 8 switched the default CSS minifier from esbuild to Lightning CSS,
which treats `backdrop-filter` and `-webkit-backdrop-filter` as the same
property and keeps only the last declared one. Every v2 glass surface
declared the standard property first and the `-webkit-` twin second, so
the minifier dropped the standard `backdrop-filter` and kept only the
`-webkit-` alias. Chrome, Edge and Firefox do not support that alias, so
the blur silently disappeared on the navbars, RMenus and every other
glass surface in the built image (dev was unaffected because it does not
minify CSS).
Fix by letting Lightning CSS manage the prefixes:
- Add `build.cssTarget` so the minifier auto-prefixes from the standard
property. This is the only knob that drives the minify path
(`css.lightningcss.targets` is ignored there).
- Remove all hand-written `-webkit-backdrop-filter` declarations, which
were the trigger and are now generated automatically for Safari.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Non-string region_mode values (YAML list/mapping) now take the
warn-and-fallback path instead of raising TypeError on the frozenset
membership check during startup.
get_preferred_regions only applies prefer_config reordering when
selecting media (for_media=True); name and release-date selection keep
the rom-tags-first ordering, matching the documented scope.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
EmulatorJS' preGetSetting short-circuits to the saved-settings
localStorage object once any setting or control was changed, returning
undefined for every key the user never touched. That silently dropped
the config.yaml defaults passed via EJS_defaultOptions (webgl2Enabled,
rewindEnabled, core options) while the settings menu still displayed
them as active. Trap the EJS_emulator assignment and patch the
instance so unsaved keys fall back to the defaults per-setting, then
recompute the values the constructor captured before the patch could
take effect.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
EmulatorJS keeps the netplay player name in memory only and shows its
name popup whenever netplay.name is unset, forcing users to retype a
name every session. Preset it from the logged-in RomM username in the
existing netplay override block, so the popup is skipped and the
account name is used automatically.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ScreenScraper scraping added the fanart and title-screen URLs to
url_screenshots even though the same images are persisted to their
dedicated fanart/ and title_screen/ media folders, downloading and
storing every image twice. Restrict url_screenshots to the actual
screenshot media type; the dedicated media still renders in the artwork
gallery. The gamelist handler had the same pattern with title_screen
and gets the same fix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New opt-in config key scan.priority.region_mode with values
prefer_rom_tags (default, current behavior) and prefer_config. With
prefer_config, the configured region priority outranks the rom's
filename region tags when selecting ScreenScraper media, and the rom's
own tags remain the fallback when the configured regions have no media.
Unknown values warn and fall back to prefer_rom_tags, and the key
survives runtime config-file rewrites.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Playmatch /api/v2/health endpoint returns the plain-text body
"Healthy", but heartbeat() routed it through the JSON-parsing
_request(), so decoding always failed and the Metadata Sources page
showed "Connection failed" for a healthy service. Do a raw GET and
treat any 2xx response as healthy, matching the Hasheous handler.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The v2 Server Stats view loads the summary first, then the heavier
per-platform breakdown as a second request. A rejection from that second
request propagated out of the async lifecycle hook as an uncaught error
instead of leaving the summary and platform rows usable. Catch it so the
page degrades to partial data.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Server Stats page ran two full scans of the multi-gigabyte `roms`
table on every visit: the metadata-coverage breakdown counted eleven
provider-id columns per platform, and the region breakdown pulled every
row's regions into Python. Both were returned in the same request as the
cheap summary counts, so the whole page stayed blank until they finished.
Mirror the provider match ids into the narrow `roms_facets` table
(migration 0102, kept in sync by the same triggers as the existing facet
columns) and read both breakdowns from it, so neither query touches
`roms`. Split the v2 Server Stats view into a summary-first request and a
separate breakdown request so the six top cards render immediately.
Fixes#3901
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>