Commit Graph

10971 Commits

Author SHA1 Message Date
Georges-Antoine Assi
a93799720e Skip missing packages and reuse real title ids in the FPKGi feed
Files marked missing_from_fs were still advertised, so FPKGi listed a
package whose download URL no longer resolves.

Title ids now come from a CUSA/PPSA id in the rom or package file names
when present, falling back to the generated RomM id. It is resolved once
per rom so a base game and its updates/DLC stay grouped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 08:20:49 -04:00
Georges-Antoine Assi
f896c2cc8c List each PKG file as its own FPKGi entry
FPKGi installs one package per entry, but the feed served a single entry
per rom pointing at the rom download URL, which zips multi-file roms.

Each .pkg file now gets its own entry with its own size and download URL,
named after its category (or file name) when a rom holds several packages.
Adds an optional content_type filter so FPKGi's per-category content URLs
can each point at RomM.

Fixes #3962

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 07:58:52 -04:00
Georges-Antoine Assi
ce49cd0c55 Merge pull request #3961 from rommapp/fix/virtual-collection-type-selector
Always allow changing the virtual collection type in v2 settings
2026-07-26 22:16:19 -04:00
Georges-Antoine Assi
3b9ac86c83 Always allow changing the virtual collection type
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>
2026-07-26 18:43:11 -04:00
Georges-Antoine Assi
8fd2e7d4d0 Merge pull request #3960 from rommapp/fix/rom-child-route-visibility
Enforce hidden-rom visibility on rom child routes
2026-07-26 17:02:20 -04:00
Georges-Antoine Assi
78c8550883 cleanup 2026-07-26 16:47:00 -04:00
Georges-Antoine Assi
9b0f281df1 Bind note update/delete to the rom in the path
update_rom_note and delete_rom_note selected on note_id and user_id only,
so the rom resolved from the path never constrained which note was
touched. Pairing a note id with any other rom id in the path reached that
note regardless.

Both handlers now filter on rom_id as well, and the endpoints pass the
rom they resolved.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 16:42:58 -04:00
Georges-Antoine Assi
b1ac647322 Enforce hidden-rom visibility on rom child routes
The screenshot, soundtrack, manual and note routes looked up the rom by
path id but never ran the visibility gate that the core rom routes and
roms/files.py already apply, so a hidden rom stayed reachable through its
child resources.

Add assert_rom_visible() after each lookup. update_rom_note and
delete_rom_note took {id} in the path without resolving it at all, so
they now load the rom first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 16:33:38 -04:00
Georges-Antoine Assi
1647ed383a remove switchblade discord 5.1.0-beta.2 2026-07-26 15:54:23 -04:00
Georges-Antoine Assi
d3a7de7f3e oc badge 2026-07-26 15:53:28 -04:00
Georges-Antoine Assi
6312294d2d Merge pull request #3959 from rommapp/dependabot/npm_and_yarn/frontend/postcss-8.5.23
build(deps): bump postcss from 8.5.15 to 8.5.23 in /frontend
2026-07-26 15:50:51 -04:00
Georges-Antoine Assi
d8b5a193aa add aikido and greptile to footer 2026-07-26 15:40:20 -04:00
Georges-Antoine Assi
1f6b6cd1ce Merge pull request #3952 from Sunil56224972/security/harden-cors-cookies-uploads
security: harden CORS, session cookies, filename sanitization, and upload limits
2026-07-26 15:26:41 -04:00
dependabot[bot]
a34cea218a build(deps): bump postcss from 8.5.15 to 8.5.23 in /frontend
Bumps [postcss](https://github.com/postcss/postcss) from 8.5.15 to 8.5.23.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.5.15...8.5.23)

---
updated-dependencies:
- dependency-name: postcss
  dependency-version: 8.5.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-26 19:20:07 +00:00
Georges-Antoine Assi
517c3b863c Merge pull request #3957 from rommapp/fix/v2-viewer-action-visibility
Hide v2 actions the backend won't allow, with Playwright cover in CI
2026-07-26 15:18:50 -04:00
Georges-Antoine Assi
d45ace0e34 cleanup 2026-07-26 15:16:56 -04:00
Georges-Antoine Assi
cd48aa761f cleanup 2026-07-26 14:14:07 -04:00
Georges-Antoine Assi
9e5582230d Sign in once per role instead of per test
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.
2026-07-26 14:08:37 -04:00
Georges-Antoine Assi
f05c4238fd slim readme 2026-07-26 14:00:06 -04:00
Georges-Antoine Assi
33b224f2c3 Serve a build in CI instead of 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.
2026-07-26 13:46:00 -04:00
Georges-Antoine Assi
2dbb2a7fbe cleanup 2026-07-26 13:22:22 -04:00
Georges-Antoine Assi
7ceef7647a cleanup 2026-07-26 13:17:42 -04:00
Georges-Antoine Assi
474ef5b6e8 Move the e2e seed scripts to .github/scripts
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.
2026-07-26 13:05:54 -04:00
Georges-Antoine Assi
395fe93912 cleanup 2026-07-26 12:56:16 -04:00
Georges-Antoine Assi
65425c1476 Run the e2e suite in CI
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.
2026-07-26 10:29:51 -04:00
Georges-Antoine Assi
96833892ce security: enforce asset upload limits before spooling, cover screenshots
Addresses the Greptile review on #3952.

- Reject oversized asset uploads from Content-Length in middleware, before
  FastAPI parses and spools the multipart body to temporary storage. The
  handler-level check stays as a backstop for chunked requests.
- Apply the limit to screenshot fields on the save, state and standalone
  screenshot endpoints, not just the primary file.
- Clamp the autocleanup limit to at least 1 so a non-positive value cannot
  wipe every save in a slot.
- Document the new settings in env.template.

Rename MAX_SAVE_UPLOAD_SIZE_BYTES to MAX_ASSET_UPLOAD_SIZE_BYTES now that it
covers states and screenshots too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 09:24:42 -04:00
Georges-Antoine Assi
b037276bfc Add Playwright e2e cover for permission gating
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.
2026-07-26 09:07:14 -04:00
Georges-Antoine Assi
4a5e37cfc0 Require the write grant alongside delete grants
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.
2026-07-26 08:38:55 -04:00
Georges-Antoine Assi
9a032471ed Hide v2 actions the backend won't allow
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>
2026-07-26 08:23:58 -04:00
Georges-Antoine Assi
ce498d6c3e Merge pull request #3955 from rommapp/feat/v2-page-titles
Set page titles across v2 views
2026-07-25 22:40:46 -04:00
Georges-Antoine Assi
eb2c8c58a8 Drop the username from the v2 profile page title
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 22:35:24 -04:00
Georges-Antoine Assi
23c39c0480 Set page titles across v2 views
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>
2026-07-25 22:32:51 -04:00
Sunil
49e16cd2c4 security: harden CORS, session cookies, filename sanitization, and upload limits
- Fix CORS misconfiguration: replace allow_origins=[*] with configurable
  ROMM_CORS_ALLOWED_ORIGINS env var to prevent cross-origin session hijacking
- Make session and CSRF cookie Secure flag configurable via
  ROMM_SESSION_SECURE_COOKIE for deployments behind TLS-terminating proxies
- Harden sanitize_filename() with os.path.basename() to strip directory
  traversal components and reject . / .. entries
- Add upload size limit (MAX_SAVE_UPLOAD_SIZE_BYTES, default 512MiB) to
  saves and states endpoints to prevent denial of service
- Cap autocleanup_limit parameter (MAX_AUTOCLEANUP_LIMIT, default 100) to
  prevent unbounded resource accumulation
2026-07-26 01:32:59 +05:30
Georges-Antoine Assi
58efd336de Merge pull request #3950 from rommapp/fix/smart-collection-missing-filters
Fix smart collections dropping newer filters
5.1.0-beta.1
2026-07-25 14:06:47 -04:00
Georges-Antoine Assi
49d1ae71b2 Fix smart collections dropping newer filters
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>
2026-07-25 13:53:02 -04:00
Georges-Antoine Assi
12dc30b16b Merge pull request #3949 from rommapp/fix/ejs-default-options-fresh-launch
Apply config.yaml EmulatorJS defaults on fresh launches and after setting changes
2026-07-25 13:34:59 -04:00
Georges-Antoine Assi
134f97d04a Merge pull request #3948 from rommapp/feat/per-page-boxart-styles
Allow different boxart styles for the game details and play pages
2026-07-25 13:22:24 -04:00
Georges-Antoine Assi
38784e5fa4 cleanup 2026-07-25 09:49:35 -04:00
Georges-Antoine Assi
8ac5654ed8 Remove the inherit option from per-page boxart styles
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>
2026-07-25 09:42:29 -04:00
Georges-Antoine Assi
8cbb635f19 Merge branch 'master' into feat/per-page-boxart-styles 2026-07-25 09:27:52 -04:00
Georges-Antoine Assi
45f4b83c53 Merge pull request #3947 from rommapp/feat/miximage-v2-cover-style
Add miximage_v2 as an available cover style
2026-07-25 09:27:10 -04:00
Georges-Antoine Assi
8208e5f6dd Skip the rom-id ratio key when the cover style diverges from the gallery
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>
2026-07-25 09:21:04 -04:00
Georges-Antoine Assi
07eb7280ef update tests 2026-07-25 09:14:56 -04:00
Georges-Antoine Assi
7d844c735d add miximage v2 support gamelist 2026-07-25 09:13:39 -04:00
Georges-Antoine Assi
9b2a014969 Use V2 suffix in miximage_v2 cover style labels
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 09:08:33 -04:00
Georges-Antoine Assi
0e05f94894 Render miximage_v2 cover style in v1
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>
2026-07-25 09:06:50 -04:00
Georges-Antoine Assi
5570eece4e Apply config.yaml EmulatorJS defaults on fresh launches and after setting changes
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>
2026-07-25 09:05:12 -04:00
Georges-Antoine Assi
77c73eaa88 Allow different boxart styles for details and play pages
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>
2026-07-25 09:05:02 -04:00
Georges-Antoine Assi
039d06ff4e Add miximage_v2 as an available cover style
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>
2026-07-25 08:46:40 -04:00
Georges-Antoine Assi
48e580407f Merge pull request #3945 from SaveEditors/fix-empty-platforms-reachable
Show empty platforms in platform index
2026-07-25 08:38:50 -04:00