Commit Graph

4891 Commits

Author SHA1 Message Date
f0rthelulz
8af8ca8735 docs(player): the seed fires a save tick, so the subscription stays below it 2026-09-06 14:18:08 -05:00
f0rthelulz
949d0e0adb fix(player): review fixes for periodic save sync
Fall back to a JS hash when WebCrypto is unavailable (non-secure
contexts) and never let a hash or upload error escape the emitter or
the game-start hook. Comments trimmed to the style guide (no em-dashes,
one or two lines of why).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 12:19:59 -05:00
f0rthelulz
e1e4663521 feat(player): optional periodic upload of changed save files
Behind a new config flag, emulatorjs.auto_save_sync (default false), the
EmulatorJS player uploads the in-game save (.srm) to the server on
EmulatorJS' own "System Save interval" tick, without Save & Quit.

EmulatorJS already runs that timer (default 300 s) and its
gameManager.saveSaveFiles() fires a "saveSaveFiles" event carrying the
SRAM bytes, but nothing listens to it, so today an in-game save reaches
the server only from Save & Quit or the Export Save File button (#4201).
This subscribes to that event from Player.vue and uploads through the
existing saveSave() when the SRAM hash is unchanged since the previous
tick (a save the core is still writing is never uploaded — the corruption
the earlier automatic upload was removed for, #2349) and differs from the
last upload (an idle session uploads nothing). The tracker is seeded from
the SRAM the core holds after the server save is applied, so a launch
never uploads the server's own file back, and the subscription is turned
off before Save & Quit, Quit and unmount.

The bytes EmulatorJS hands out are views onto the emulator heap, a
SharedArrayBuffer on threaded cores; they are copied into a plain
ArrayBuffer before hashing or uploading.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 11:37:33 -05:00
Georges-Antoine Assi
c31e4f6935 Merge pull request #4369 from rommapp/fix/no-reload-during-active-play
fix(v2): don't reload the page on reconnect while a game is running
2026-09-06 10:31:41 -04:00
Georges-Antoine Assi
4cbdc29c46 Merge pull request #4373 from rommapp/feat/v2-cover-zoom-and-lightbox-backdrop
feat(v2): zoom the game cover, and dismiss the lightbox from anywhere on the backdrop
2026-09-06 10:30:21 -04:00
Georges-Antoine Assi
b73cd0fae8 style(v2): stand the artwork assets on a shelf instead of in grey slabs
The uniform 16/9 cells letterboxed every asset into an identical tinted
box, so a 42x680 box spine and a 2:1 marquee both read as mostly empty
background. Assets now keep their real proportions under a shared height
cap and sit on a common baseline, with a drop-shadow that follows the
artwork's own silhouette (most scans are transparent PNGs) and a lift on
hover.
2026-09-06 10:11:22 -04:00
Georges-Antoine Assi
6cba1d2494 feat(v2): list the cover in the artwork gallery instead of zooming it
The details cover goes back to being inert. The Media tab's Artwork
subtab now leads with the rom's own cover, so every piece of artwork the
page holds sits in one grid and one lightbox.
2026-09-06 09:55:53 -04:00
Georges-Antoine Assi
29de40f28d style(v2): drop the em-dashes, and the no-op click in the inert-cover test
Review follow-ups. CLAUDE.md bans em-dashes in anything we write, and
Vue Test Utils already refuses to dispatch on a disabled button, so the
click asserted nothing the surrounding expectations did not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:54:24 -04:00
Georges-Antoine Assi
9627d8d950 fix(v2): zoom the cover artwork that is actually on screen
GameCover swaps to the external `url_cover` when the primary image fails,
but the zoom re-resolved the chain itself and kept pointing at the failed
URL — clicking a visible fallback cover opened broken artwork.

Have GameCover expose the src it is rendering and ask it at click time, so
there is one home for "which artwork is on screen". The affordance keys off
`hasArtwork`, which is the separate question of whether there is anything
to zoom into at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:51:57 -04:00
Georges-Antoine Assi
8792e51ee5 refactor(v2): give the search pivot one home
GameHeader and InfoGrid each built the same search location object; move
it to a shared `searchLocation` util so the query schema lives in one
place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:46:47 -04:00
Georges-Antoine Assi
3eeda1f210 fix(v2): dismiss the lightbox from anywhere on the backdrop
Only the outer wrapper and the stage dismissed on click, but the item box
between them fills the stage while the image letterboxes inside it. At
1440x900 the item measured 1280x774 against a 421x680 cover, so nearly
everything that read as backdrop was the item div and swallowed the
click. Give the item its own .self handler; the image itself still keeps
the lightbox open.

Fixes #4362

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:39:52 -04:00
Georges-Antoine Assi
b58e0c2306 feat(v2): open a lightbox when the game cover is clicked
The details page cover was inert in the v2 UI. Clicking it now opens the
same fullscreen RCarousel lightbox the screenshot and artwork grids use,
sourced from the resolution GameCover already runs so the zoom shows
whatever artwork is on screen (box art, physical, mix image).

A magnify hint fades in on hover and focus, and stays visible on touch
and gamepad where there is no hover. A rom with no artwork at all keeps
its procedural placeholder and the hero stays inert. The 3D box hero is
untouched: it is already interactive.

Closes #4361

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:39:44 -04:00
Georges-Antoine Assi
a1c3b7f476 feat(v2): make game header tags clickable
Region, language and custom tags in the details header now link into a
filtered search, the same pivot the Overview info grid already offers on
genres, companies and franchises.

Closes #4363

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:34:19 -04:00
Georges-Antoine Assi
7d2822ef6f fix(v2): wait for a quiet network before the held-back refresh
Leaving a player fires teardown requests the reload would abort (the
stream save + release among them), and the backend can drop again while
the refresh waits. Trigger the refresh off the api layer's
`network-quiesced` event, capped for an app that has gone silent, and
skip it when the connection is gone again so the next reconnect handles
it instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:30:53 -04:00
Georges-Antoine Assi
add6a16aab fix(v2): don't reload the page on reconnect while a game is running
The reconnect recovery refresh fired on every offline -> online
transition, so a transient network blip during play tore down the page
and killed the running emulator along with any progress it had not
synced yet.

Hold the refresh back while the playing store reports an active session
and run it once the player is left, after a short grace period so the
player's teardown requests reach the backend first.

Fixes #4356

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:24:39 -04:00
Georges-Antoine Assi
7443b690be fix(streaming): keep the container's answers inside its own origin
A broker's launch, join and desktop replies name the URL the browser loads
in an iframe, and urljoin keeps an absolute (or `javascript:`) URL verbatim,
so a container that answered with one could run script in RomM's origin
instead of its own. The three sites now share one resolver that drops a room
URL leaving the configured host, the stage refuses a source that is not
http(s), and the frame is sandboxed without allow-top-navigation so a
container page cannot steer the tab it sits in.

Also drop the shared secret from the config entry a resolution warning
prints, which named the misconfigured container by dumping it whole.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 14:53:43 -04:00
Georges-Antoine Assi
e85fce8e80 fix(streaming): close the holes a review pass found
Session ownership and lifecycle, mostly around who a teardown belongs to:

- file the exit state, save states and state frames under the session's
  owner rather than the caller, so an admin driving someone else's session
  no longer collects their saves
- beat the heartbeat from the admin desktop view, which the stale sweep was
  tearing down three minutes in
- take the claim through release_own_session when a launch aborts, instead
  of deleting a key another player may already hold
- require the same claim to stamp a launch, so a late activate cannot revive
  a drain marker with a six hour TTL
- pull the in-game save archive on every teardown path, not just the two
  that remembered to
- skip draining keys in the admin force-release sweep

Plus: pool members must share a protocol, since the head's capabilities are
what the frontend renders; a claim clears terminations across the whole pool;
multiplayer is only recorded where the broker can actually seat a joiner; and
an unserializable config no longer caches forever on a repr() that repeats.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 14:33:44 -04:00
Georges-Antoine Assi
eccafd13d1 refactor(streaming): polish pass over the new modules
- The five new modules each defined `log = logging.getLogger("romm")`, which is
  what `logger.logger` already exports; they import it now.
- `ACK_TIMEOUT` had two homes. It is a protocol fact, so `protocol.py` owns it
  and the endpoint imports it from there; the unused
  `BROKER_LOAD_STATE_TIMEOUT` copy goes.
- Module and function docstrings trimmed to what the code cannot say: the
  change history and the justifications belong in the commit messages they came
  from.
- `asset_store` takes the union `write_file` accepts rather than `Any`.
- Four hand-rolled `setInterval` pairs (presence beat, session poll, exit
  chord, live sessions, activity tick) become `useIntervalFn`, which also
  cleared a real gap: the presence composable's timer had no scope teardown.
- The launch pushes are matched on the container the claim's 202 named, not on
  the platform: a pool serves one platform from more than one container, so a
  second tab could otherwise act on the first's launch.
- Test helpers typed: the push capture and the resume-claim tuple carry real
  types, and an unused `_claim_ready` helper goes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 13:13:02 -04:00
Georges-Antoine Assi
74c77d0bb2 feat(streaming): answer the claim before the launch, and push what happens
`POST /streaming/sessions` blocked for up to STREAMING_LAUNCH_TIMEOUT (10
minutes) while a broker unpacked a pkg or archive, and four mechanisms existed
to keep that survivable: a 3s status poll the client ran alongside it purely
for progress, `launch_timeout` shipped through /config so the client could size
its own axios ceiling, and a cancel-then-undo branch that re-released a session
the player had already abandoned, because a blocking POST cannot be cancelled.

The claim now answers 202 as soon as the container is reserved and everything
that can fail synchronously has (404, 409, 428 are all still the claim's own
status). The launch runs detached and pushes to the user room the
force-release notice already used:

- `streaming:launch-ready` carries the room URL and the resume outcome
- `streaming:launch-failed` carries the reason; the claim is already freed
- `streaming:launch-phase` carries the broker's extraction phase

The backend polls the broker for that phase itself, once, however many tabs are
watching, and only pushes changes. `GET /sessions/{platform}/status` stays as
the fallback for a tab that missed a push.

That retires the client's launch poll, the `launch_timeout` plumbing and the
cancel-then-undo branch. Leaving during a launch is now just a release, and the
launch-ready handler hands the container back if the player has already gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 12:04:58 -04:00
Georges-Antoine Assi
1e716b381d feat(streaming): give the streaming routes typed responses
Every streaming route returned a bare `JSONResponse`, so none of their shapes
reached the OpenAPI schema and `services/api/streaming.ts` hand-maintained a
parallel copy of all eleven of them. A response-shape change was a silent
frontend break with nothing to catch it.

`endpoints/responses/streaming.py` declares the shapes and the routes return
them, so they generate like every other endpoint. The 428 a claim raises when a
container still holds an undecided memory card is declared too, through
`responses=`, rather than staying an undocumented `detail` dict.

The frontend types are regenerated and the hand-written interfaces become
aliases onto them. The typecheck immediately found two places they had already
drifted: the hand-written `PlatformCapabilities` was missing `has_memory_card`,
and `LiveSessionCard` passed a possibly-undefined host username where a
nullable string was expected. The termination notice had drifted on the backend
side too: it records `ended_at`, `rom_id` and `rom_name`, which the first draft
of the schema did not carry.

Releasing a session now hands its teardown to FastAPI's `BackgroundTasks`
rather than attaching it to a hand-built response, which is what lets the route
return a model.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 11:15:36 -04:00
Georges-Antoine Assi
3cacb59ee4 refactor(streaming): give the duplicated rules one home each
Backend:
- One session-scan iterator (`_iter_session_keys` / `_iter_live_sessions`)
  replaces three copies of the Redis scan-and-decode loop, and
  `_get_live_session` replaces five independent "a drain marker is nobody's
  session" checks.
- `_abort_claim` replaces seven inlined claim-abort cleanups, so a new failure
  branch can no longer wedge a container and orphan a blank card.
- `_quiesce_container` and `_collect_exit_state` replace the stop-evacuate-wipe
  and guarded state-pull blocks written out in all three teardown paths. The
  `_record_termination` calls stay at the call sites: the three order it
  differently and each has its own reason.
- `_hold_reservation` / `_drop_reservation` collapse the two
  release-after-state-pull helpers into one, and absorb the third copy of that
  branch inlined in the released-session teardown.
- `_load_state_broker`'s two protocol branches were byte-identical, so it now
  takes its route from `_transfer_route`; `_raise_broker_http_error` and
  `_raise_broker_unreachable` replace the error translation copied into
  `_call_broker` and `_webstation_activate`.
- `_container_labels` builds the label map once per request rather than
  re-reading and re-parsing config.yml for every listed row.
- The joinable listing fetches each ROM once, through `get_rom_simple` rather
  than the `@with_details` query, for five columns.
- `store_memory_card_version` hands the hash it computed in memory to the scan,
  which was reading the archive back off disk to recompute it.
- `_prune_state_history` takes the history its caller already fetched.
- `playlist_files` in utils/m3u.py is now the one home for "which files are
  discs", shared by the download endpoint, the m3u generator and the swapper.

Frontend:
- `useActivityPresence` replaces the presence block copied verbatim from
  EmulatorJS.vue into Stream.vue.
- `MemoryCardNameDialog` replaces three copies of the same name-entry dialog.
- The two private axios error extractors give way to the `errorMessage` util,
  three hand-rolled spinners to `RSpinner`, six manual listener pairs to
  `useEventListener`, and five copy-on-write Set/Map trackers to `reactive`.
- `keepaliveHeaders` moves next to the interceptor that owns the CSRF header.
- The exit chord polls at 10Hz instead of every frame, the stage measures its
  offset once instead of per mousemove, `postToStream` reuses the frame list
  the attach pass walked, and the admin/home polls skip a hidden tab.
- `containerLabelForPlatform` on the store replaces the two `streamLabel`
  definitions that answered differently, and the stream/join action labels move
  onto useGameActions so the button and the menu cannot word them differently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 08:54:32 -04:00
Georges-Antoine Assi
15233afcb1 Merge branch 'master' into feat/streaming-webstation
Conflicts and how they were resolved:

- `useGameActions`: master renamed `useCanPlay`'s `canPlay` to `canPlayLocal`
  and kept a local `canPlayStream`, while this branch moved `canPlayStream`
  into `useCanPlay` and folded it into `canPlay`. Kept this branch's shape and
  took master's `useScanTrigger()` call.
- `Player/Stream.vue`: kept this branch's force-release and session-poll block,
  and re-placed master's `useUnloadGuard(sessionActive)` next to the
  `sessionActive` watch.
- `locales/*/play.json`: kept both sides' keys, re-sorted.
- `__generated__/index.ts`: kept both sides' model exports, re-sorted.
- `test_config_loader.py`: kept both sides' tests.

Master took 0114 through 0118 while this branch was open, so its three
migrations are renumbered 0119-0121 and rechained after
`0118_rom_category_cheat_pg`, leaving alembic with a single head.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 07:49:12 -04:00
Georges-Antoine Assi
76f0fc6cd8 i18n: mention the collections page in the autogenerated toggle
The en_US/en_GB description gained the collections page; carry that into
the other 16 locales so the toggle doesn't describe two of its three
surfaces everywhere but English.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:08:58 -04:00
Georges-Antoine Assi
4166ca6477 test(collections): pin the ?kind=virtual reset to the URL
The fallback test only read the rendered list, so it passed whether the
view cleared the query param or merely reset its local filter, and it
seeded the preference before mount so the runtime flip went uncovered.

Hold the setting in a live ref the tests can flip after mount, assert the
router.replace that drops the param, and add the turn-it-off-while-
filtered case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:08:13 -04:00
Spinnich
69501c00a8 fix(collections): honor "Show autogenerated collections" on /collections
The v2 collections index fetched and rendered virtual collections
regardless of the `showVirtualCollections` UI setting, so users who
turned the toggle off still got them on the page the v2 UI makes the
primary home for collections. The v2 home page already gates on it,
leaving the two sibling views disagreeing about the same preference.

Read the setting (and the virtual collection type) from useUISettings
rather than raw localStorage, skip the fetch and the list entries when
it is off, drop the virtual option from the toolbar's kind cluster, and
snap a stale `?kind=virtual` back to `all`.

Fixes #4348

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:31:40 +00:00
Georges-Antoine Assi
5837ac3df9 refactor(config): name the two default dir lists for what they exclude
DEFAULT_EXCLUDED_DIRS only ever seeded EXCLUDED_PLATFORMS, but its name
implied it was the general directory list, which is how the media folders
came to be added to it in the first place. Rename it and its superset to
DEFAULT_EXCLUDED_PLATFORM_DIRS and DEFAULT_EXCLUDED_MULTI_FILE_DIRS, and
spell out what a multi-file ROM is.

DEFAULT_EXCLUDED_FILES and DEFAULT_EXCLUDED_EXTENSIONS keep their generic
names: each still feeds both a single-file and a multi-file-parts exclusion.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 16:42:43 -04:00
Georges-Antoine Assi
65b2a050c1 refactor(gamelist): give the ES-DE media folder names one home
Fold the exporter's folder map and the importer's ESDE_MEDIA_MAP into a
single GAMELIST_MEDIA_DIRS, so writing, reading and skipping a media type
is one edit. This also picks up thumbnails/, which the scan exclusions were
missing, and drops the hand-appended "images" literal.

Serve the multi-file defaults pre-unioned as DEFAULT_EXCLUDED_MULTI_DIRS so
neither UI has to re-join two lists; v1 was still mapping EXCLUDED_MULTI_FILES
to DEFAULT_EXCLUDED_DIRS and rendering the media dirs as deletable.

Collapse the per-tag asset loop and the bespoke <mix> block into one table
keyed by tag, and skip fnmatch for the exclusion patterns that hold no glob
characters, now that the multi-file list is more than twice as long.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 16:19:55 -04:00
Georges-Antoine Assi
aff25e5013 Merge branch 'master' into claude/github-issue-4226-eab53e 2026-09-04 16:06:33 -04:00
Georges-Antoine Assi
5cc6a98c1b refactor(v2): name the rom refetch for what it touches
`refetchCurrentRom` no longer reads or writes `currentRom`: `syncCachedRom`
owns that write and applies the identity guard. The name promised a function
that acts on the open rom; it fetches the rom it is given and applies it
wherever it is cached, so `refetchRom` is what it does.

Also trims the two comments that had grown past what they explain.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 15:54:44 -04:00
Georges-Antoine Assi
ccc950f72e refactor(scan): let the terminal event own the progress flush
`scan_platforms` ends in four places, and three of them had to remember to
flush the counters a coalesced increment held back. The fourth, the early
return on a folder structure it cannot read, did not, and was correct only
because it sits above the first report. `finish` pairs the flush with the
emit so every exit gets both, including that one.

The failure path's guard around the flush goes with it. It was protecting
against an emit that fails, one line above an emit that would fail the same
way and is not protected, and `update_job_meta` already swallows its own
errors, so it bought nothing.

Also: `refetchCurrentRom` wrote `currentRom` twice, once directly and again
through `syncCachedRom`, which owns that write and applies the same identity
guard. `useRomScanRefresh` kept an `alive` check that `useSocketEvent`'s
unsubscribe already covers; its test was passing on the check rather than the
unsubscribe, so the socket mock now actually unsubscribes. DeleteManualDialog
was the tenth surface still spelling out the refetch by hand, and seven
components kept a rom store binding nothing reads any more.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 15:42:20 -04:00
Georges-Antoine Assi
51e0f0fc2e Merge remote-tracking branch 'origin/master' into perf/scan-progress-coalesce
# Conflicts:
#	backend/endpoints/sockets/scan.py
2026-09-04 15:23:43 -04:00
Sam Dornan
ca4e6d28b4 fix(config): keep scraper media folders out of platform exclusion
DEFAULT_EXCLUDED_DIRS feeds both EXCLUDED_PLATFORMS and
EXCLUDED_MULTI_FILES, so listing the gamelist media folders there also
hid any platform directory that happened to share a name. The media
folders now live in DEFAULT_EXCLUDED_MEDIA_DIRS and only join the
multi-file exclusions.

The config response exposes the new list so the settings UI keeps
treating those entries as read-only defaults instead of offering a
remove action that the next config load would undo.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-04 10:24:15 -05:00
Georges-Antoine Assi
8db38f3322 Merge remote-tracking branch 'origin/master' into feature/sigil-title-ids-followups
# Conflicts:
#	backend/handler/filesystem/roms_handler.py
#	backend/tests/endpoints/sockets/test_scan.py
2026-09-04 10:33:45 -04:00
Georges-Antoine Assi
e186710d82 Merge pull request #4322 from sdornan/claude/github-issue-4321-54e972
fix(v2): read the date picker's value in UTC, not local time
2026-09-03 22:32:10 -04:00
Georges-Antoine Assi
0e0e4fefa9 Merge branch 'master' into fix/threaded-core-https-error-message
Conflict in the v2 EmulatorJS player was an import collision only: master
added useUnloadGuard where this branch added useSnackbar. Kept both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 22:05:10 -04:00
Georges-Antoine Assi
55a1152256 cleanup 2026-09-03 22:01:56 -04:00
Georges-Antoine Assi
97db058105 Merge pull request #4308 from rommapp/feat/confirm-before-leaving-player
feat(player): confirm before leaving a running game
2026-09-03 21:45:42 -04:00
Georges-Antoine Assi
7b3b537f22 fix(player): disarm the unload guard when a launch fails
A failed EmulatorJS loader (both attempts exhausted) or a Ruffle launch
that cannot create a player left gameRunning set, so the browser asked
for a leave confirmation with no game behind it and input stayed muted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 21:36:17 -04:00
Georges-Antoine Assi
1113387fd0 Enhance useUnloadGuard with server-side check
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-03 21:35:49 -04:00
Georges-Antoine Assi
a80858bb2b refactor(v2): give the post-write rom refetch one home
Nine surfaces each spelled out "fetch the rom, write it to currentRom,
sync the caches", and they had drifted: the notes tab never synced the
gallery cache, the walkthrough subtab updated the v1 store instead of it,
and only the scan refresh guarded against the user opening another game
while the request was in flight. `useRomSync.refetchCurrentRom` does it
once, with the guard, so every asset write reconciles the same way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 21:21:33 -04:00
Georges-Antoine Assi
102c5737e1 fix(v2): write the ascii range with escapes so git reads the file as text
The character class held a raw NUL and a raw DEL byte, and a NUL in the
first 8000 bytes makes git treat the whole file as binary: GitHub renders
no diff for it and a merge cannot go three ways. The class is unchanged.

Also drop the second paragraph of the quick scan description.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 20:40:54 -04:00
Georges-Antoine Assi
53ac1d9711 fix(scan): announce a restored rom from the platform loop
The platform sync clears `missing_from_fs` before the batch loop runs, so
a rom being scanned can no longer tell that it was missing, and the fold
left the skip path (which could tell) unreachable for a quick scan. A rom
whose file came back byte for byte therefore emitted nothing and kept its
stale badge. Collect the restored roms from the snapshot the loop already
takes, for the ones it visits as well as the ones it skips.

Cleanups on the same paths:
- hoist the quick reconcile above the metadata prelude it never reads,
  which was a config file parse and a tag parse per rom
- drop the unreachable quick clause from `_should_hash_incrementally`:
  `refresh_rom_files` owns that policy
- drop `RomFilesRefresh.files`, which nothing reads
- take the refresh lock without a guard that had nothing to protect
- fold the single-caller upload destination helpers into one
- give "a quick scan needs no metadata source" one home, and read the
  refresh title from the key rom.json already owns

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 20:32:30 -04:00
Georges-Antoine Assi
72580fc5b2 refactor(scan): fold the files scan into the quick scan
A quick scan skipped every rom it already knew, so a file dropped into a
game folder went unnoticed until a complete or hashes rescan. This branch
answered that with a seventh scan type; letting quick reconcile the files
of the roms it knows says the same thing with less to learn.

Quick now visits every rom. New ones take the metadata pipeline as
before; existing ones only have their files reconciled against disk,
keeping the stored hashes of files whose size and mtime are unchanged. No
provider is contacted for an existing rom, so quick no longer needs a
metadata source picked, in the scan view, the platform dialog and the per
rom refresh alike.

The watcher schedules a quick scan again, and the per rom "Refresh files"
action sends quick scoped to that rom.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 20:14:46 -04:00
Georges-Antoine Assi
24b6870485 fix(v2): let a files scan start without a metadata source
A files scan contacts no provider, but the scan view and the per platform
dialog both kept their start button disabled until one was picked, so the
option they had just gained could not be used. The refresh dialog already
exempted the type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 19:06:45 -04:00
Georges-Antoine Assi
bf5a7a9e64 chore(review): cut the scan comments back to what the code cannot say
The per-ROM scan type list restated each option's own subtitle, and the
useScanTrigger header named two callers when four now share it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 18:06:47 -04:00
Georges-Antoine Assi
13ac6668b7 chore(review): tighten the files scan and folder upload code
Backend:
- Drop the HashPolicy enum: FULL had no caller and INCREMENTAL was the
  default, so refresh_rom_files uses the existing_files knob directly.
- Narrow RomFilesRefresh to the counters callers read.
- Build ParsedRomFiles once so the incremental return stops dropping the
  title id fields.
- Give the assembling suffix one home in config, read by both the
  assembler and the scanner's excluded extensions.
- Fold the duplicated destination collision check into one helper, and
  branch /start on the upload target itself.
- Load the lighter rom for the refresh emit and the upload endpoints,
  keep the flat file stat off the event loop, and reuse the directory
  listing for the RA hash lookup.

Frontend:
- Route the platform scan dialog and the scan view through
  useScanTrigger, so a scan started while one runs is refused rather
  than emitted and rejected by the backend.
- Rename the socket payload type to ScanRequest, away from the
  useScanProviders type of the same name.
- Drop the dead uploading prop and folder icon, reuse singleRomTitle,
  and resolve each file's relative path once per listing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 18:00:01 -04:00
zurdi
ac2980fe9f fix(v2): keep the bottom nav pinned to the bottom on short views
`.r-v2-shell__app` had no minimum height, so a view shorter than the
viewport left the BottomNav anchor short and the sticky pill floated above
the real bottom edge. Match the shell's min-height so it always reaches it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
682e06c2f6 fix(v2): tidy the files-tab selection actions and add per-row delete
The selection actions become icon-only (download, copy link, delete, clear)
so they sit on the checkbox row instead of wrapping off-screen on narrow
viewports, and each file row gains a delete button gated on the delete grant.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
d09016a485 refactor(upload): keep the start headers and take the rom target as a JSON body
`POST /api/roms/upload/start` keeps its X-Upload-* headers so existing
clients are unaffected; the new rom_id and folder travel in an optional
JSON body instead of extra headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
452f0a41de refactor(upload): take the chunked upload start fields as a JSON body
`POST /api/roms/upload/start` reads platform_id, filename, total_size,
total_chunks and the optional rom_id and folder from a JSON payload instead
of X-Upload-* headers. Header values are limited to ISO-8859-1, which also
rejected non-Latin filenames in the browser.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00