Commit Graph

4629 Commits

Author SHA1 Message Date
Spinnich
ccf3582b1a fix(v2): mirror the stale pick failure guard in the collection gallery
The collection gallery carried the same unconditional error handler, so a
request that rejected after the user switched collections raised a snackbar
for the one they left.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 23:09:36 +00:00
Spinnich
65db3a0c2d fix(v2): keep a stale random pick failure quiet
A request that rejects after the user switched platforms reached the
unconditional error handler, so an abandoned platform could still raise a
snackbar. Gate it on the same staleness check the success path uses.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 23:09:36 +00:00
Spinnich
b4519eda71 fix(v2): drop a random pick after leaving the platform
The platform gallery's Random ROM button never re-checked which platform
was on screen when its request came back, so a pick started before
switching platforms still navigated, landing the user in a game from the
gallery they had left. Capture the platform id at click time and abandon
the pick once it no longer matches, the same guard the collection gallery
already carries.

Fixes #4104

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 23:07:16 +00:00
Georges-Antoine Assi
5f61452865 Merge pull request #4110 from Spinnich/fix/home-rows-skip-total
perf(home): stop counting the whole library for the two home rows
2026-08-04 17:57:03 -04:00
Spinnich
dbd213c6c9 perf(home): stop counting the whole library for the two home rows
The "Recently added" and "Recently played" rows each ask for 15 games and
render 15 covers, but both requests still made the server count every game
in the library and then discarded the number. On a large library that count
is the expensive part of the request, so opening the home page paid for two
whole-library counts nobody sees.

Both rows now send with_total=false, the option added for the gallery in
#4062.

The flag has to reach the request and the cache-clear pattern together: the
pattern is matched against the cache key by substring, so adding it to only
one side would leave the row permanently stale. The cached service now
builds both from a single parameter map per row so they cannot drift, and
the tests assert the clear pattern still matches the key the request writes.

Fixes #4099

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 17:20:23 +00:00
Spinnich
5521b851b8 perf(gallery): resolve the random rom button in one request
The platform and collection "Random ROM" buttons asked the API for the
scope total, then for the single row at a random offset, and neither call
opted out of the char index, the filter values or the rom id index. All
three cover the whole result set, so picking one game did about as much
work as loading the entire gallery. Scoped requests are never cached
either, so the full cost came back on every click: on an 83,000-game
instance, 7.19s and 878KB against 0.27s and 16.9KB for the same request
with the sidecars off.

Both buttons now call GET /api/roms/random, which samples on the primary
key and returns one row. The scope parameters it already accepts cover
the platform id and all three collection kinds, so the collection view
keeps its kind split unchanged and null stands in for an empty scope.

The v1 RandomBtn / ContextualRandomBtn share the old shape and are left
alone, since v1 is frozen.

Fixes #4068

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 13:21:54 +00:00
Georges-Antoine Assi
d874cc1738 Merge pull request #4071 from Spinnich/fix/random-pick-constant-time
perf(roms): pick a random rom without paging to a random offset
2026-08-04 08:25:07 -04:00
Georges-Antoine Assi
042a36240f Merge pull request #4069 from Spinnich/fix/home-setup-library-scan
fix(home): stop scanning the library filesystem on every home page load
2026-08-04 08:24:39 -04:00
Spinnich
b6d43ce73c chore(roms): drop the comment on the random rom api wrapper
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 11:24:06 +00:00
Spinnich
c8ab8dda9d fix(v2): order the ROM metadata hashes like the rest of the UI
The files list and the firmware list both read SHA-1, CHD SHA-1, MD5, CRC,
RA. The metadata tab led with CRC instead, so the same hashes appeared in a
different order depending on which tab the user was on.

Covers the ordering with a unit test, including the CHD SHA-1 position: the
mock library holds no CHD, so that branch cannot be reached in a browser.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 16:15:35 +00:00
Spinnich
959e5c0db9 fix(v2): label the ROM metadata hash row SHA-1 to match every other surface
MetadataTab was the only place labelling the row SHA1, while FileRow,
FilesSummary and the firmware list all use SHA-1. It was also inconsistent
within its own list, sitting directly beside a CHD SHA-1 row.

The label is hardcoded rather than translated, so no locale changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 16:05:55 +00:00
Spinnich
f815c77ca0 fix(v2): make hashes recoverable without HTTPS and show all firmware hashes
The Clipboard API only exists in a secure context, so over plain HTTP the
copy button on a hash chip always failed. Because the displayed value is
abbreviated in JavaScript, the rest of the hash was never in the DOM
either, leaving the full value unreachable on any HTTP install.

Clicking a chip now reveals the full value as selectable text whenever a
copy cannot land, so Ctrl+C works as a fallback. On HTTP the click no
longer attempts the doomed copy, so the misleading error toast is gone.
Behaviour over HTTPS is unchanged apart from revealing when a copy throws.

The firmware tab only ever showed the MD5, as an unselectable chip with no
copy affordance, while the stored CRC and SHA-1 were never displayed. All
three now render as copyable chips, matching the ROM files tab.

Fixes #4082

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 15:35:41 +00:00
Spinnich
1ee6cea070 perf(roms): pick a random rom without paging to a random offset
The Home "Random Pick" widget asked the API for the library total, then
for the single row at a random offset. Paging to offset N makes the
database walk and discard the N rows before it, so the pick got slower
the bigger the library: measured on an 83,000-game instance, 1.7s at the
median offset and 6.9s deep into the list, on every home page visit.

Adds GET /api/roms/random. It offers the query a batch of random primary
keys and takes any that exist, which is one index lookup per candidate
and unbiased, since every id in the table is equally likely to be
offered. A batch only misses when the query matches too little of the id
space, and it then falls back to counting the set and taking the row at a
random position, reading index entries rather than rows because the
statement selects nothing but the id. Both paths are uniform.

On the same 83,000-game library: 2.9ms median for an unscoped pick
(0.6% of picks take the fallback, 236ms), 19-25ms scoped to a platform.
The widget now resolves a pick in one request.

The endpoint takes the platform / collection scope parameters so the
gallery "Random ROM" buttons (#4068) can move onto it too.

Fixes #4066

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 19:25:36 +00:00
Spinnich
e85f2fe4ef fix(home): stop scanning the library filesystem on every home page load
The v2 home page requested GET /api/setup/library on every visit, which
walks every platform directory under the library path to count files.
That hint only exists for brand-new instances, but it fired for everyone:
17s per home page load on an 83k-game library, 38s on slower storage, and
the result was thrown away because the library wasn't empty.

The frontend watcher was wired to `isEmpty` with `immediate: true`, so it
ran during setup, before any of the page's data requests had started. All
the `fetching*` flags were still false and the stores were still empty, so
the library looked empty and the walk kicked off.

Frontend: onMounted now awaits the initial fetches and flips an
`initialLoadDone` flag. The watcher and the empty-state `v-if` both gate on
`initialLoadDone && isEmpty`, so the request and the render can no longer
disagree about whether the library is empty.

Backend: get_setup_library_info() returns early with an empty
`existing_platforms` once the database holds ROMs, since the on-disk hint is
meaningless then. Gated on ROMs alone, not platforms: platform rows with
zero ROMs are exactly the case the hint exists for, so those still walk.

Fixes #4063

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 16:34:15 +00:00
Georges-Antoine Assi
361b2414d3 fix(stats): pluralize the platform game count and lift meta legibility
Server Stats rendered "1 games" for a single-game platform, and the row
meta line leaned on the faint foreground tier: the middot separator, the
size percentage and the region expand toggle all sat at the edge of
readability.

- Pass the count as vue-i18n's plural choice and give every locale the
  plural forms its `collection.games-count` sibling already uses.
- Draw the separator as a 4px dot in the muted tier instead of a thin
  middot glyph, and move the size percentage off the faint tier.
- Outline the region expand/collapse control so it reads as a button,
  and label it for screen readers.
- Spell out the coverage tooltip as "IGDB matches: 159 / 227".

Fixes #4057

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 12:18:53 -04:00
Georges-Antoine Assi
4fac604e65 Merge pull request #4062 from Spinnich/fix/gallery-window-skip-total
perf(roms): let a gallery window fetch skip the library count
2026-08-02 11:00:51 -04:00
Georges-Antoine Assi
1e514ec273 chore(roms): drop redundant comments on the total opt-out
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 20:27:57 -04:00
Georges-Antoine Assi
43cdd0856a refactor(roms): resolve the page total in a helper
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 19:59:29 -04:00
Georges-Antoine Assi
79a8322470 Merge pull request #4060 from rommapp/fix/hasheous-mameredump-verified
fix(hasheous): read the CHD and DOS signature sources
2026-08-01 19:48:56 -04:00
Spinnich
0be6e3a70f perf(roms): let a gallery window fetch skip the library count
Opting out of the rom id index made the endpoint fall back to a COUNT
over the whole filtered set, so every scroll batch re-derived a total
the page already had from its bootstrap.

Add a with_total flag that skips that count, and have the v2 gallery's
window fetch pass it alongside the sidecar opt-outs it already sends.
total comes back null there, which the store's existing guard leaves
alone rather than applying over the size it knows.

Fixes #4053

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 23:00:38 +00:00
Georges-Antoine Assi
56f8a51e04 fix(hasheous): read the CHD and DOS signature sources
The match flags on `hasheous_metadata` are keyed off Hasheous'
`SignatureSourceType` names, and two never lined up with what its API
actually returns:

* `MAMERedump`, the source holding Redump's disc images in CHD form, was
  mapped to nothing at all. A CHD identified by its disc-data SHA1 matched,
  got its metadata, and still read as unverified because no flag was set.
* `puredos_match` looked for `PureDOS`; the source is named `PureDOSDAT`, so
  the flag was pinned to False for every ROM.

CHD matches now set `mame_redump_match`, which the verified filter counts and
which the Metadata tab folds into the existing Redump chip (same database,
different distribution format). Existing rows pick the flag up on their next
rescan.

Hasheous also exposes Pleasuredome, TotalDOSCollection, eXo, ScreenScraper and
Generic sources that RomM still maps to nothing; those are left alone since
folding them in widens what "verified" means.

Fixes #4030

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 18:10:16 -04:00
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
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
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
6362091bb4 remove unnecessary admin page 2026-08-01 10:44:35 -04: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
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
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
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
2b6853a221 Merge pull request #4015 from rommapp/fix/scan-region-language-reorder
Reorderable region and language priority lists in scan settings
2026-07-30 19:28:15 -04:00
Georges-Antoine Assi
7228165b6f Merge pull request #4014 from rommapp/fix/rselect-menu-overflow-and-separator
fix(v2): keep RSelect menus inside the viewport and tidy the selection text
2026-07-30 19:25:46 -04:00
Georges-Antoine Assi
8f2a361c79 Merge pull request #4012 from rommapp/fix/v2-prev-next-game-buttons
feat(v2): previous / next game buttons on the details page
2026-07-30 19:05:36 -04:00
Georges-Antoine Assi
aae4d1d9f4 fix(v2): gate prev/next arrows on real gallery provenance
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>
2026-07-30 18:37:16 -04:00
Georges-Antoine Assi
4dc3b75d30 feat(v2): reorderable region and language priority lists
The region and language fields in scan settings used a chip combobox,
which only appended at the end and removed from the end: reordering or
dropping a middle entry meant clearing the field and retyping it.

Both now use ScanPriorityList, the same ordered-row control the metadata
and artwork provider lists use, so entries can be dragged, moved with the
up/down buttons, and removed individually.

ScanPriorityList grows an `allow-custom` mode for these open sets: a
free-text field commits on Enter, splits comma or whitespace separated
input, and lowercases and deduplicates to match how the backend stores
the codes. The known codes stay available as one-click suggestions.

Fixes #3999

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