The gallery store keeps `romIdIndex` alive after the user leaves the gallery,
so membership in that list wasn't evidence the user was still browsing it: a
ROM opened from Home, Activity or a scan result could inherit the previous
gallery's neighbours and offer to step through a list it has nothing to do
with. Track how the details chain was entered and require a gallery
click-through, while leaving rom-to-rom hops and play sessions armed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Restores the v1 gallery-stepping affordance in the v2 details view. A new
PrevNextNav composite reads the current ROM's position from the v2 gallery
store's ordered `romIdIndex`, so the order matches whatever gallery the user
came from (filters, sort, grouping included), and hides itself when the ROM
isn't part of a list (direct link, related-game jump, Home row).
Fixes#3998
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Settings -> Library Management -> Missing made three whole-library passes
per request, two of which produced data the page never renders, and none
of which could be cached because "missing" counts as a filter.
- The tab now opts out of the char index, the filter values and the
ordered id index, so the endpoint serves its total from a plain COUNT.
- `missing_from_fs` gets a composite index with `name_sort_key`, and the
filter compiles to an equality: MariaDB does not treat `IS NOT FALSE`
as indexable, so the index would otherwise only ever be scanned end to
end. The column is NOT NULL, so both forms match the same rows.
- The filter-value list is keyed on the scope (search / platform /
collection) alone. It is built from a query that never applies the
row-level filters, so a filtered request now answers with, and warms,
the same whole-library entry an unfiltered one does.
Fixes#3992
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The grid flow-packs rows in JS from each card's real width
(cardHeight * coverRatio), and rows render nowrap with flex-shrink: 0 —
so an underestimated width overflows the viewport instead of wrapping.
Ratios are measured on cover load, but a rom with no cover paints its
placeholder at the boxart style's ratio and never measures, so the
packer's hardcoded 2/3 under-reserved its width and let an extra card
into the row.
The packer now takes the style ratio as its fallback for any position
without a measured cover, which also covers the pre-load paint of every
card in a non-2/3 gallery.
Fixes#3984
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The list was fetched once at app boot, inside a bootstrap that runs
before anyone is logged in. /tasks needs the tasks.run scope, so any
session established after boot (any login without a reload) left the
watcher, scheduled and manual lists empty for the rest of the page load,
in both UIs. For a logged-in non-admin the same call 403'd on every page
load and tripped the interceptor's redirect to login.
Fetch on mount from the pages that need it instead.
Fixes#3981
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mdi-select-all is a marquee-selection glyph, so it read as an action
rather than a filter state. mdi-asterisk carries the wildcard
"everything" meaning the segment actually has.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
LaunchBox cloud lookups read from a Redis store that only the metadata
update task fills, but nothing surfaced when that store was empty. The
provider reported healthy, every search returned zero results, and the
logs said nothing.
- heartbeat now reports unhealthy until the store is populated, and an
empty store logs what to set to fix it
- the update task can be run manually whenever LAUNCHBOX_API_ENABLED is
on, instead of also requiring the scheduled-update flag
- the ~600k entry dump was buffered into a single pipeline, peaking at
1.7GB of RSS and writing nothing at all if the job was killed part way
through. Writes now go out in batches and parsed elements are dropped
as they are consumed, which caps the run at ~260MB. The task also gets
its own timeout, since the default 5 minutes does not cover a 100MB
download plus a 500MB parse
- alternate name lookups ignored the platform, so "Super Mario World" on
PlayStation matched Super Mario Bros.
- Coleco ADAM was spelled wrong, and Famicom / Super Famicom pointed at
platform names LaunchBox does not use
Fixes#3981
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`router.replace` is async, so `route.query` keeps reading the pre-navigation
value. Two URL-backed controls changing in the same flush each built their
next query from that stale snapshot, and the second navigation won with a
query that never saw the first one's key.
Reachable today on the Collections index: picking the "virtual" kind also
clears the visibility filter in the same flush, and the clear dropped
`?kind=virtual`.
Route every writer (search, view mode, Platforms and Collections filters)
through `patchQuery`, which merges patches and issues one navigation per
tick.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Platforms index switched to allPlatforms, so every leftover 0-game
platform row rendered in the grid, burying real libraries under hundreds
of stubs.
Empty platforms are hidden again by default and surface through a new
segmented toolbar cluster, URL-synced as ?show=all. They stay reachable
(and deletable) that way, so they don't become stranded in the database
again.
Fixes#3979
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The v2 details view scooped every image/video inside a multi-file ROM
folder into the artwork resolver, so a Wii U dump shipping cutscenes as
content/Movie/*.mp4 rendered dozens of <video preload="metadata">
elements at once. The resulting burst of Range requests saturated the
backend and hung the page for minutes.
Library media now has to sit at the top level of the game folder, which
is what "a trailer or artwork dropped next to the ROM" meant all along.
Nested files are game data; nested assets that are genuinely media
(screenshots, soundtrack, manual) already have their own surface via
their category.
Fixes#3975
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The selector was gated on `showVirtualCollections`, a home-page toggle
that defaults to off, so the control was disabled out of the box. The
grouping type is not home-only: the collections index and the collection
gallery read it and fetch virtual collections regardless of that toggle.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every spec drove the login form, which is 15 UI logins to test something
login.spec.ts can cover on its own.
auth.setup.ts now runs first as its own project, logs each fixture user in
once and saves the session (cookies plus localStorage) to playwright/.auth/.
Specs pick an identity with `test.use({ storageState })` and start signed in.
That is preferred over building a context by hand, which would silently drop
the project's options -- baseURL, the blocked service worker, viewport.
login.spec.ts is the one place the form is exercised, on a deliberately
unauthenticated page, and it gained cover the suite never had: a rejected
password and the redirect for an anonymous visitor.
Suite: 33s -> ~19s, with 18 tests instead of 15. Verified three times against
the build and once against the dev server.
Replaces the global-setup warm-up. The warm-up existed to absorb Vite's
on-demand compilation and its "optimized dependencies changed. reloading"
force-reload; serving a static build means neither happens, so the workaround
is unnecessary rather than merely cheaper.
`vite preview` inherits `server.proxy` (`proxy: preview?.proxy ?? server.proxy`),
so /api and /ws still reach the backend -- an earlier comment claiming preview
ignores the proxy was wrong. Build is ~5s and the suite drops from ~3.7min to
~35s. Local runs stay on the dev server so a change is picked up without a
rebuild; `CI=1 npm run test:e2e` opts into the CI path.
Repetition against the build then exposed two races the dev server had been
masking, both real bugs in the specs rather than infrastructure:
* Assertions ran before `/permissions/me` hydrated the grants store, so an
admin's menu was read pre-hydration and looked like a permissions bug.
`gotoHydrated()` now waits for that response and for the app bar to render,
and the presence assertions use `expect.poll` instead of a one-shot read.
* The PWA service worker precaches ~9MB, re-installed on every fresh context
and caching between runs. Blocked via `serviceWorkers: "block"`.
Six consecutive runs against the build: 15/15, no flakes, ~33s each.
They exist to stand up a disposable instance for the Playwright suite, so
they belong with the workflow that runs them rather than in backend/tools/
next to the library-generation utilities.
Their sys.path bootstrap now points at backend/ explicitly (it relied on
being one level below it), the workflow invokes them from the repo root
instead of backend/, and .github/scripts/** joins the workflow's path
filters so editing a seeder still triggers the suite.
Adds .github/workflows/e2e.yml: MariaDB + Valkey services, migrations, an
offline library scan, the fixture users, the backend, then Playwright --
whose webServer starts the Vite dev server. DEV_PORT (5000) is both what
main.py binds and what Vite's /api proxy targets, so neither side needs
configuring. Report and test-results upload as an artifact on failure.
`tools/seed_e2e_library.py` scans backend/romm_test/library with an empty
metadata_sources list, so CI never reaches out to a provider. It exits
non-zero on an empty library rather than leaving a confusing Playwright
timeout later.
Also fixes the flakiness that a CI-shaped rehearsal exposed. Root cause was
not slowness: the Vite dev server force-reloads the page when it discovers a
new dependency to pre-bundle, wiping the half-filled login form so the submit
never lands. Defences are a passive warm-up pass in global-setup.ts (absorb
the reload before anything depends on the page, then compile the routes under
test) and a retry in login(). Two smaller real bugs fell out of the same
investigation: `button[type="submit"]` matched two elements, because the
collapsed reset-password form has its own, and the warm-up's best-effort
`.catch()` calls inherited a 120s timeout, making setup take 8 minutes.
Verified from a cold Vite cache against a throwaway database and the fixture
library: 15/15 pass, no flakes, 2.7 minutes.
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>