Commit Graph

11097 Commits

Author SHA1 Message Date
Georges-Antoine Assi
2bdd1956fc Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-01 17:58:43 -04:00
Georges-Antoine Assi
674b7f22dc fix(rom-details): render the manual viewer on mobile
Two independent faults left the Media tab's Manual panel as an empty frame
on phones:

* vue3-pdf-app wires its toolbar controls by `id` on mount and abandons the
  whole viewer when one is missing, so hiding the prev/next page buttons with
  `v-if` at the xs breakpoint stopped any page from ever being laid out. The
  buttons now always render and are hidden with CSS instead.
* RDropzone declares `inheritAttrs: false` without ever binding `$attrs`, so
  the sizing class its consumers pass was dropped. On desktop the fixed-height
  chain hid that; on mobile, where the details view scrolls as one document,
  nothing gave the viewer a height and it collapsed to the toolbar.

The dropzone now forwards attrs, the manual viewer takes an explicit viewport
slice on mobile, and the soundtrack panel opts out of the zero-basis fill
there so it keeps sizing to its content.

Fixes #4046

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 17:43:32 -04:00
Georges-Antoine Assi
0c06c19d2d Merge pull request #4056 from rommapp/feat/random-pick-widget-polish
feat(home): make the random pick widget clickable and denser
2026-08-01 17:21:50 -04:00
Georges-Antoine Assi
a5ec7e9e55 fix(home): stop reporting a failed random pick as an empty library
The widget nulled its pick on any error, so a transient failure on
reroll swapped a good pick for the "No games loaded yet" copy. Failures
now keep the current pick and surface an error snackbar, the card's
fallback text distinguishes a failure from an empty library, and a page
that comes back empty (the cached id index drifting from the database)
is retried once before it counts as one.

Both calls also opt out of the char index, filter values and rom id
index, which the endpoint returns by default and which span the whole
library: a reroll drops from ~463KB to ~15KB on a 75k-rom library.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 16:49:43 -04:00
Georges-Antoine Assi
4a19f65b81 fix(home): disable the reroll button while a pick is in flight
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 16:28:33 -04:00
Georges-Antoine Assi
cf44d5174a Merge pull request #4055 from rommapp/fix/scan-firmware-already-known
fix(scan): report only newly discovered firmware
2026-08-01 16:27:48 -04:00
Georges-Antoine Assi
84b1155a71 fix(home): only turn the die on a reroll that runs
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 16:25:14 -04:00
Georges-Antoine Assi
3ca53d3a35 feat(home): make the random pick widget clickable and denser
Drop the "Open" button: the cover and title now link to the rom. The
freed space shows the platform and the release year / region so the
pick is identifiable when a library holds several variations of the
same title. Reroll moves to the card's top-right action slot and
shows a readable die face that changes on every roll.

Closes #4048

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 16:20:12 -04:00
Georges-Antoine Assi
372d34752d fix(scan): report only newly discovered firmware
The scan:scanning_platform payload carried the platform's total
firmware_count, so the scan view showed a firmware chip and expanded the
panel on every re-scan of an unchanged library. The panel body only lists
ROMs, leaving an empty card.

Emit the firmware count scoped to the running scan instead, and key the
auto-expand off the ROM list alone.

Fixes #4049

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 16:19:58 -04:00
Georges-Antoine Assi
ea8a076ea2 Merge pull request #4051 from rommapp/claude/open-bug-fixes-uankie
fix: batch of open bug fixes (#4027, #4034, #4035, #4038, #4040, #4043, #4045)
2026-08-01 16:19:26 -04:00
Georges-Antoine Assi
06ebacad5a chore(settings): shorten heartbeat refresh comment
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 16:09:41 -04:00
Georges-Antoine Assi
eaa1d52de2 Merge pull request #4047 from Spinnich/fix/kiosk-mode-logged-in-permissions
fix(backend): scope the kiosk read-only cap to the anonymous visitor
2026-08-01 15:43:17 -04:00
Georges-Antoine Assi
bf29259b0e cleanup 2026-08-01 15:36:16 -04:00
Georges-Antoine Assi
629e1c2b83 Merge pull request #4039 from Spinnich/perf/smart-collection-gallery-query
perf(collections): serve smart and standard collections from a composed query
2026-08-01 15:17:05 -04:00
Georges-Antoine Assi
f4aaa6bf23 fixes 2026-08-01 15:10:56 -04:00
Georges-Antoine Assi
e464ce765a test(collections): resolve hash smart collections through the gallery query
The hash search tests reached membership through
`get_smart_collection_roms`, which no longer exists now that a smart
collection is served as a composed query. Ask for the collection the way
the gallery does instead, so the criterion is still exercised end to end.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 15:08:42 -04:00
Georges-Antoine Assi
33d68c32a5 Merge branch 'master' into perf/smart-collection-gallery-query 2026-08-01 15:02:58 -04:00
Georges-Antoine Assi
f4eaf7c795 more cleanup 2026-08-01 14:52:55 -04:00
Georges-Antoine Assi
c951b6eb46 some clenaup 2026-08-01 14:49:58 -04:00
Georges-Antoine Assi
06556fcc79 fix(gallery): show region and language flags on v2 covers
v2 exposed the "Show regions" and "Show languages" settings but nothing
consumed them, so covers lost the region and language emblems that 4.x
showed. Add a CardFlags overlay to GameCard: up to three emoji per chip
with the full list in the hover title, fading out under the hover overlay
so it never collides with the action row.

Fixes #4027
2026-08-01 14:12:41 -04:00
Georges-Antoine Assi
bcbf771d3f fix(settings): refresh filesystem folders when opening folder mappings
The folder-mapping table lists FS_PLATFORMS from the heartbeat snapshot
taken at app init, so a folder created after that only showed up after a
full page reload. Refetch the heartbeat when the section mounts.

Fixes #4035
2026-08-01 14:12:41 -04:00
Georges-Antoine Assi
b475196327 fix(frontend): reload once when a stale chunk fails to load after a deploy
Hashed asset names change on every deploy, so a tab left open across an
upgrade 404s on its next lazy import and goes blank until the user
reloads by hand. Listen for `vite:preloadError` and for router
dynamic-import failures, and reload once. A session-scoped timestamp
guards against a reload loop when an asset is genuinely missing.

Fixes #4034
2026-08-01 14:12:41 -04:00
Georges-Antoine Assi
286ccff5a1 feat(match): show the ROM file name in the match dialog header
The match dialog covers the gallery card it was opened from, hiding the
file name, which is the one piece of ground truth when re-matching a
mismatched game. Show it next to the dialog title, truncated to a single
line with the full name in the hover title.

Fixes #4038
2026-08-01 14:12:41 -04:00
Georges-Antoine Assi
48c2a75192 fix(platform): show tooltips on passive metadata provider chips
Provider chips without a link (HowLongToBeat, Libretro, Flashpoint) were
styled with `pointer-events: none`, which also suppressed the native
`title` tooltip, leaving those icons unlabelled. Drop only the pointer
affordance and keep the chip hoverable.

Fixes #4040
2026-08-01 14:12:40 -04:00
Georges-Antoine Assi
f26c3234d7 fix(auth): return 401 for unauthenticated requests, keep 403 for missing scopes
Protected routes answered 403 both when there was no session and when the
authenticated user lacked the required scope. The frontend read every 403
as session expiry, cleared the session cookie and redirected to /login, so
a permission denial (for instance saving a state without the save scope)
tore down whatever the user was doing, including a running emulator.

`protected_route` now uses its own scope guard that raises 401 with a
`WWW-Authenticate` header when the caller is unauthenticated, and 403 when
the caller is authenticated but under-scoped. The axios interceptor only
redirects on 401 and lets 403s surface inline to the caller, refreshing the
CSRF cookie when the backend rejected the CSRF token.

Endpoint assertions for unauthenticated requests move from 403 to 401;
authenticated under-scoped cases stay 403.

Fixes #4045
2026-08-01 14:12:40 -04:00
Georges-Antoine Assi
7939831c4b fix(scan): ignore #recycle and tolerate unreadable library folders
Synology NAS shares carry a `#recycle` folder at the root of every share,
which RomM picked up as a platform directory. Add it to
DEFAULT_EXCLUDED_DIRS, and make the exclusion list match glob patterns so
the long-standing `.Trash-*` entry actually excludes anything.

Exclusions are now applied before the directories are stat'ed, and a
directory that raises OSError during Structure B detection is skipped with
a warning instead of propagating. An unreadable folder used to bubble a
500 out of `/api/heartbeat`, which the frontend retried in a loop during
first-time setup.

Fixes #4043
2026-08-01 13:56:39 -04:00
Georges-Antoine Assi
dea964f17e Merge pull request #4033 from XenuIsWatching/fix/scheduler-not-started-blocks-scans
fix(docker): always start the RQ scheduler
2026-08-01 11:14:34 -04:00
Georges-Antoine Assi
ae74f8de53 chore(docker): trim the scheduler comment
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 11:04:36 -04:00
Georges-Antoine Assi
9f8179bcdc Merge pull request #4032 from Spinnich/fix/search-by-hash
fix(roms): search the gallery by CRC32, MD5, SHA-1 and RA hash
2026-08-01 11:00:24 -04:00
Spinnich
16b2f80722 fix(auth): scope the kiosk read-only cap to the anonymous visitor
KIOSK_MODE stripped every non-READ grant from all non-admins after group
and override resolution, so a logged-in user with "Saves & States: Write"
still got a 403 from POST /api/states|saves|screenshots. The permission
UI saved grants the server then silently discarded.

The cap now applies only to the synthetic guest KIOSK_MODE hands out
(User.is_kiosk_guest). It has to stay for the guest: with no permission
group of its own it falls back to the server default group ("Viewer
(legacy)" = WRITE_SCOPES), so dropping the cap outright would let
anonymous visitors upload assets and edit collections.

Fixes #4044

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 14:49:09 +00:00
Georges-Antoine Assi
6362091bb4 remove unnecessary admin page 2026-08-01 10:44:35 -04:00
Spinnich
7399c19479 fix(collections): refresh smart collections on per-user state changes
Removing the read-time recompute left the cached membership blind to
everything that is not a ROM edit. A save, a state, a status, or moving
a ROM in or out of a regular collection all change what `has_saves`,
`has_states`, `statuses`, `collection_id` and `favorite` match, so the
stored counts, covers and ROM-detail chips went stale until an unrelated
edit or the next scan.

Refresh from those paths too: save and state upload, delete and
visibility toggle, `update_rom_user` when a status is set, and adding or
removing collection members. Sharing an asset is included because
`has_saves` matches other users' public saves, so it moves collections
that are not the uploader's.

These changes leave the ROM row alone, so they pass `membership_only`
and only recount a collection when the ROM actually joined or left.
Autosaves land constantly, and without it every one of them would force
a full recount of any collection the ROM already belonged to.

Reported by Greptile on #4039.

Implemented with Claude Code (Opus 5), tests first, then reviewed and
verified by me.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 22:18:53 +00:00
Spinnich
b5d276e2ed fix(collections): refresh smart collections per ROM, not per request
Recomputing every smart collection after a delete scanned the library
once per collection, synchronously on the event loop and inside a single
write transaction. Ask instead which of the changed ids each collection
matches: that resolves as a primary-key lookup, so only the collections
actually holding one of them pay for a recount.

Follow the same refresh into `update_rom` and the metadata reset. Both
change exactly the fields the saved filters match on, so cached counts
and cover mosaics no longer wait for the next scan to catch up.

Guard every call site. The ROM write is already committed by the time
the refresh runs, so a failure there must not be reported back as a
failed edit, and must not cost a bulk delete its per-ROM report.

Drop the handler-level test for leaving a collection untouched on read;
the endpoint test covers that invariant through the route the bug was
reported against.

Follow-up review of f4ac78c46 (#4029). Implemented with Claude Code
(Opus 5), then reviewed and verified by me.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 21:11:11 +00:00
Spinnich
f4ac78c46b perf(collections): serve smart collections from a composed query
A smart collection re-ran its filters across the whole library on every
request, loaded every match into memory with its joined metadata, wrote
the membership back, and only then asked for the page being displayed.
The cost tracked library size rather than collection size, was paid twice
on first load and again on every scroll, and the write bumped updated_at,
which the covers embed as a ?ts= cache-buster.

Translate the stored filter_criteria into filter_roms keyword arguments
and apply them to a bare Rom.id select instead, so membership stays in
SQL and the database returns just the rows being rendered. The criteria
vocabulary is filter_roms' own, so this composes with the gallery's
filters. smart_collection_id is dropped from the criteria: the v2 create
dialog records the route it was opened from, so a collection built while
viewing another one carries its id, which would nest and could cycle.

Bind parameters for the MATCH clauses are now named after the term they
carry. A statement can hold two of them (the collection's search term and
the gallery's), and SQLAlchemy does not uniquify explicitly named text()
parameters, so a fixed name let one term overwrite the other.

The cached rom_ids / rom_count / path_covers_* columns still back the
collections list and the ROM detail page, so refresh them on write --
smart collection create and update, after a scan, and after ROMs are
deleted -- rather than as a side effect of browsing. They are computed
for the owner: the row is shared, so a per-user criterion like favorite
would otherwise describe whoever opened the collection last.

Regular collections and the favorites filter get the smaller half of the
same treatment: an indexed subquery over collections_roms instead of an
IN list built in Python. An unknown collection or smart collection now
returns nothing rather than falling through to the entire library.

Fixes #4029

AI assistance: implemented with Claude Code (Opus 5), tests first, then
reviewed and verified by me.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 20:23:31 +00:00
Ryan McClelland
0ae753e4fe fix(docker): always start the RQ scheduler
The scheduler only started when one of four ENABLE_SCHEDULED_* flags was
true, but nothing else respects that condition. startup.py registers the
netplay, upload-tmp and zip-cache cleanups unconditionally, three more
flags gate periodic tasks that are absent from the list, and the
filesystem watcher defers its rescans through the scheduler as well.

Any of those leaves jobs sitting in the scheduler registry with no
process to run them. On a default install the three cleanups never fire
at all. A watcher running with none of the four listed tasks enabled
leaves a delayed scan_platforms entry that nothing will execute, and the
concurrent scan guard reads it as a scan already queued, so every manual
scan is refused with "A scan is already in progress". Restarting does not
help, because the entry is persisted state rather than a running process.

Start the scheduler unconditionally, matching entrypoint.sh, which never
gated it. A stuck entry then clears on its own, since the scheduler
enqueues past-due jobs as soon as it comes up.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 12:13:37 -07:00
Spinnich
b1ee3a9f6e fix(roms): search the gallery by CRC32, MD5, SHA-1 and RA hash
The search box offered "name, filename, hash", but the term only ever
reached roms.name and roms.fs_name. A term that is hex of exactly a
digest length now also matches the hash columns on roms and rom_files,
the latter being what makes multi-disc games findable by a file's hash.

The two sides are unioned rather than OR'd. No engine merges a full-text
index with a B-tree index, so OR-ing them costs the name side its index
and scans roms end to end (3.306s against 0.005s on 300k rows). Neither
table had an index on any hash column, so 0106 adds them.

Fixes #4008

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 18:49:28 +00:00
Georges-Antoine Assi
80e58d59b3 Merge pull request #4025 from rommapp/fix/player-resume-source
fix(player): skip the save load a state immediately discards
2026-07-30 21:47:31 -04:00
Georges-Antoine Assi
702aa00a2d fix(player): drop the resumeFrom prop and let the state win
Keep the save prop as the write-back target for "Save & Quit" without
adding a second prop to say which asset boots: when both a save and a
state are selected, the session resumes from the state.

The save is no longer loaded right before a state overwrites it, so the
outcome is the same but without the discarded SRAM injection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:43:51 -04:00
Georges-Antoine Assi
b7d0625c21 Merge pull request #4022 from rommapp/feat/autofocus-search-field
feat(frontend): autofocus the search field on the Search view
2026-07-30 21:32:24 -04:00
Georges-Antoine Assi
84290f7f02 Merge pull request #4024 from rommapp/fix/gamelist-epoch-invalid-dates
fix(backend): tolerate calendar-invalid gamelist dates on PostgreSQL
2026-07-30 21:32:10 -04:00
Georges-Antoine Assi
61919abceb Merge pull request #4023 from rommapp/fix/v2-infogrid-pivot-to-search
fix(v2): pivot to a filtered search from the overview info grid
2026-07-30 21:29:38 -04:00
Georges-Antoine Assi
9884dfe68c Merge pull request #4026 from rommapp/fix/scan-language-priority-default
fix(backend): scope ScreenScraper French fallback to taxonomy fields
2026-07-30 21:27:37 -04:00
Georges-Antoine Assi
091749976f chore(frontend): trim autofocus-search comments in GalleryShell
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:26:59 -04:00
Georges-Antoine Assi
844661960e Merge pull request #4021 from rommapp/fix/fpkgi-unique-entry-names
Give each FPKGi package a unique name within its rom
2026-07-30 21:24:07 -04:00
Georges-Antoine Assi
3b3aebc64b fix(backend): scope ScreenScraper French fallback to taxonomy fields
The scan language priority defaulted to ["en", "fr"], and get_preferred_languages
appended ["en", "fr"] unconditionally on top of whatever was configured. French
was therefore impossible to remove, and a user asking for a single language still
got French descriptions.

That fallback originally existed only for ScreenScraper's `familles` and `modes`
taxonomies, which are French-authored and frequently untranslated. It was lifted
into a general language preference when the setting was introduced, at which point
it started applying to the synopsis as well.

Split the two concerns: get_preferred_languages now honors the configured order
verbatim (falling back to English only when the list is empty) and drives the
synopsis, while the new get_taxonomy_languages appends the en/fr fallbacks for
franchises and game modes. The config default drops to ["en"].

Configuring ["de"] now yields a German description or none, rather than a silently
French one, while French franchise and mode names are still used where no English
entry exists.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:21:35 -04:00
Georges-Antoine Assi
20e416e752 fix(player): resume from the picked asset instead of always the state
The v2 player armed a save and a state independently and handed both to
<Player>, which applied the save and then the state. A savestate restores
the whole machine (SRAM included), so the save was always discarded when
any compatible state existed.

Split the two roles the `save` prop was serving: it stays the write-back
target for "Save & Quit", while a new `resumeFrom` prop says which asset
actually boots. The v2 shell passes the visible tab, so the AssetPreview
("Resume from save/state") and what loads can no longer disagree.

v1 keeps save and state mutually exclusive, so it leaves `resumeFrom`
unset and falls back to the previous precedence.

Fixes #4010

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:03:54 -04:00
Georges-Antoine Assi
56a57da11e fix(backend): tolerate calendar-invalid gamelist dates on PostgreSQL
The gamelist branch of generated_first_release_date is gated on an
8-digits/T/6-digits regex, which does not prove the digits form a real
date. EmulationStation, ES-DE and Skyscraper write "00000000T000000" for
an unknown release date, and make_timestamp raises on it. Because the
column is STORED, that aborts the 0098 ALTER TABLE on upgrade, and any
later INSERT of such a ROM on installs already past 0098.

romm_gamelist_epoch_ms now traps the error and returns NULL, matching the
range guard the MariaDB branch already applied. 0105 replaces the
function in place for installs that have already run 0098.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:03:54 -04:00
Georges-Antoine Assi
9509a1e355 fix(v2): pivot to a filtered search from the overview info grid
Genre / company / franchise / collection chips were plain spans with a
hover affordance but no behavior, dropping the pivot-to-search v1 offered
from the same rows. Sections now carry the gallery filter their items map
to, and the chips render as links into the search view scoped to that
value. Links rather than click handlers, so middle-click and open-in-new-
tab work and the chips join keyboard / spatial navigation.

Fixes #4011

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:03:54 -04:00
Georges-Antoine Assi
c7a2cad6ad feat(frontend): autofocus the search field on the Search view
Opening Search (navbar button or the "/" hotkey) left focus nowhere, so
typing right away did nothing. The toolbar's search field now takes focus
on mount, gated to precise-pointer, non-gamepad devices: touch would pop
the on-screen keyboard uninvited, and a focused text field swallows the
gamepad's synthetic arrow keys.

`shouldAutofocusSearch` moves out of RSelect into v2/utils, since it is
now shared policy rather than an RSelect internal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:03:40 -04:00
Georges-Antoine Assi
9fb43e4c3e fix(feeds): give each FPKGi package a unique name within its rom
FPKGi writes downloads to `[<title_id>] <name>.pkg`. Packages of a rom
share a title id, so the category label alone (`<Game> - DLC`) collided
for every rom holding more than one package of a category, and each
download overwrote the previous one on the console.

Each package now takes the first of its candidate names that no other
package in the rom claims: the category label, then the file name, then
both, falling back to the rom file id.

Fixes #4020

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:00:38 -04:00