The #3954 fix is about what a read-only user can SEE, which the Vitest
specs can't reach: visibility depends on grants the backend resolves and
`useCan` projects. These drive a real instance instead.
frontend/e2e/rom-actions.spec.ts ⋯ menu items + divider collapse
frontend/e2e/profile-role.spec.ts no self-editable role control
frontend/e2e/game-media-files.spec.ts Media/Files upload + delete
Every spec asserts both sides -- absent for `e2e_viewer`, present for
`e2e_admin` -- so it can't pass against a page that failed to render, and
notices a fix that over-hides. Verified by reverting the fix: 8 of 15 fail,
and the 6 admin-side guards stay green.
`backend/tools/seed_e2e_users.py` seeds the two fixture users idempotently.
Specs live in e2e/ so Vitest's src/** and test/** globs skip them, and
tsconfig now covers them so they're typechecked.
Not wired into CI: that needs a backend, a database and a library fixture
in the runner.
A bare DELETE grant projects to no OAuth scope (`grants_to_scopes` has no
(ROMS, DELETE) row), but the delete endpoints gate on the matching *_WRITE
scope. So a group granted delete-without-write got the delete affordance,
a 403, and the interceptor's logout.
Require both grants at every delete gate: ROM delete (more-menu and bulk
selection bar), ROM file delete, and platform delete.
A read-only user was shown ROM write actions and a role picker that the
backend refuses. Both fail badly: the role PUT reports success and then
silently reverts (the backend ignores self-role changes), and every other
action 403s, which the axios interceptor treats as an expired session and
turns into a logout.
Gate them on the grants instead:
- useGameActions exposes canEdit / canDelete / canMatch / canRefresh so
every ROM action surface shares one permission source.
- GameActionsList hides match / refresh / edit / delete, with conditional
dividers so the menu doesn't trail stray separators.
- The Media and Files tabs hide their upload / delete affordances for
manuals, soundtracks, shared ROM screenshots and ROM files. The
per-user "Mine" screenshot section is untouched: it writes user assets,
not the ROM.
- The profile page drops the role select. Nobody can change their own
role, so it only ever reverted; the role already shows as a chip in the
identity row, and admins change other users' roles from Administration.
Fixes#3954
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Game details now titles the tab with the game name, and the three
players (EmulatorJS, Ruffle, Stream) with "Play <game name>".
Adds a usePageTitle composable so titles that depend on fetched data
stay in sync: the router's meta.title is resolved in the navigation
guard before the data lands, and doesn't re-run on param-only
navigations like /rom/1 -> /rom/2.
Also fills the remaining v2 gaps: /pair and /pair/device had no title,
the platforms and collections index routes had untranslated English
ones, and platform / collection / profile set theirs imperatively so
they went stale after a rename and leaked the previous page's title
onto a not-found route.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Smart collections silently ignored several filters at both ends:
- The backend never applied has_soundtrack, has_saves, has_states, or
player_counts from stored criteria, so a "has soundtrack" smart
collection contained every game. get_roms_scalar also dropped
has_soundtrack before it reached filter_roms.
- The v2 criteria serializer had no fields for has_saves/has_states and
only stored tri-state filters when true, so "unmatched" or "has
saves" produced empty criteria and the no-filters guard blocked the
save.
Criteria now carry saves/states filters and explicit false states, the
backend applies them, and summaries render negative states with the
existing "show-not-*" labels.
Fixes#3888
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per-page styles now always hold a concrete style; changing the
gallery-wide style resets both to match. Legacy stored "inherit"
values display and resolve as the gallery style. The advanced
disclosure starts collapsed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The shared measured-ratio cache keys by rom id on the assumption that
every surface renders the same artwork for a rom. With per-context
styles a details/player cover would seed from the gallery image's ratio
(wrong shape until load) and overwrite the entry the gallery packer and
back-nav morph read. Key by URL only when the resolved style differs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The boxartStyle setting is shared across UI versions, so a value picked
in v2 reaches v1 galleries. Teach v1 to render it (square ratio, ss-only
art resolution, hover video) without adding it to the v1 selector.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
EmulatorJS drops the EJS_defaultOptions passed from config.yaml in two
places. preGetSetting short-circuits to the saved-settings localStorage
object once any setting or control was changed, returning undefined for
keys the user never touched. getCoreSettings, which writes the RetroArch
core options file during boot, returns an empty string when localStorage
is enabled but holds no saved entry yet, so core options such as
mupen64plus-FXAA never reach the core on a fresh launch.
Install a trap on the window.EJS_emulator assignment that patches both
methods and recomputes the constructor-captured values (rewindEnabled,
videoRotation, webgl2Enabled) right after the constructor returns,
before the async core download and boot consume them. Patching in
EJS_onGameStart (where the previous fix ended up after a cleanup) is
too late: by then the GL context exists and retroarch.cfg and the core
options file are already written.
The console player installs the same trap, and the web player now looks
up core options by the resolved core instead of the nullable core prop.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds two ui_settings keys (boxartStyleDetails, boxartStylePlayer)
defaulting to "inherit", resolved in useCoverArt via a per-surface
context. The v2 UI settings Gallery section gains an advanced
disclosure with two override selects.
Closes#3943
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extends the v2 BoxartStyle union with miximage_v2_path (ScreenScraper
mixrbv2 art, square ratio, hover-video like miximage), adds it to the
cover style selector in UI settings, and translates the new label in
all locales.
Closes#3942
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>