Commit Graph

11064 Commits

Author SHA1 Message Date
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
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
Georges-Antoine Assi
7d9ca7dc4e Merge pull request #4017 from XenuIsWatching/perf/single-file-hash-once
perf(scan): stop hashing single-file ROMs twice
2026-07-30 19:40:22 -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
117f420dca Merge pull request #4013 from rommapp/fix/hashes-scan-rematches-hasheous
fix(backend): re-run the Hasheous hash lookup on a hashes scan
2026-07-30 19:23:56 -04:00
Georges-Antoine Assi
50d4372b2b refactor(backend): drop redundant comment on the hashes scan gate
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 19:18:40 -04:00
Georges-Antoine Assi
11f570fede fix(backend): clear a stale Hasheous match when a rehash no longer matches
A rehashed ROM whose new hashes no longer match Hasheous kept its old
`hasheous_id` and `hasheous_metadata`: the merge loop only writes truthy
values, so an empty match cannot overwrite the values seeded from the
existing ROM, and the verification flags stayed on a ROM that no longer
earned them.

Clearing on any empty match would be wrong, though: `lookup_rom` returns the
same empty fallback whether Hasheous answered "unknown hashes" or was simply
unreachable (#2236), so an outage would silently de-verify a whole library.
Have `lookup_rom` return whether it reached a definitive answer, mirroring
`meta_ss_handler.lookup_rom`, and only clear the match on a conclusive miss.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 19:13:57 -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
1a4bf1b8dd Merge pull request #3993 from rommapp/fix/permission-gaps-5.1.0
fix(security): close three permission gaps found auditing 5.1.0
2026-07-30 18:30:58 -04:00
Georges-Antoine Assi
eba61d9d3a Merge remote-tracking branch 'origin/master' into fix/permission-gaps-5.1.0
# Conflicts:
#	backend/tests/tasks/test_cleanup_orphaned_resources.py
2026-07-30 18:22:50 -04:00
Georges-Antoine Assi
c67e49c461 fix(tasks): gate the orphaned-resources cleanup on its config flag
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 18:21:39 -04:00
Georges-Antoine Assi
fee2724a0e Merge pull request #3989 from Spinnich/feat/screenscraper-quota-awareness
feat(screenscraper): pace and report scans against the account's reported limits
2026-07-30 17:52:10 -04:00
Georges-Antoine Assi
f8bbb8af18 chore(screenscraper): tighten the quota wording and comments
Name the reset timezone by its shortcode, and drop comments that either
restate the code or explain a change rather than the behaviour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 17:43:37 -04:00
Georges-Antoine Assi
a55d50998e refactor(screenscraper): move the scan reporting into ss_handler
Priming the account, the quota lines and the end-of-scan skip list are
ScreenScraper's own bookkeeping, so they move out of the scan socket and
behind begin_scan(), log_quota() and log_scan_summary(). The scan keeps
only the decision it owns: whether this scan uses ScreenScraper at all.

The quota-line bookkeeping joins the skipped ROMs in a _ScanState
instance, so the tracking that resets together lives together and needs
no global statement.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 17:43:32 -04:00
Georges-Antoine Assi
7168f5895c refactor(screenscraper): bundle the per-scan state in one object
The account limits, the two one-shot advisory flags and the daily-quota
breaker all reset together at the start of a scan, so they now live
together in a _ScanState instance. Mutating its attributes needs no
global statement, and reset() walks the dataclass fields so a new one
cannot be left out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 17:29:56 -04:00
Ryan McClelland
b785a457f5 perf(scan): stop hashing single-file ROMs twice
Every chunk was streamed through two independent sets of hashers: one for
the RomFile and one accumulating the ROM-level hash. That second set is
only meaningful for a multi-file ROM, whose hash spans the concatenation
of its top-level files and so cannot be derived from the per-file digests.

For a single-file ROM the two sets see identical bytes and produce
identical digests, so the ROM-level pass was pure duplicate work. Nested
files inside a multi-file ROM were worse: they were fed through throwaway
accumulators whose results were discarded at the call site.

Make the accumulators optional and skip them where they are not needed,
reusing the file's own hashers as the ROM-level values for a single-file
ROM. Multi-file top-level files keep the second pass, since theirs is the
case that needs it.

Measured on a Raspberry Pi 4 against a 134 MB Nintendo 3DS ROM, page
cache warmed, best of three, comparing CPU time to exclude contention:
36.5 MB/s -> 60.3 MB/s, a 1.65x speedup, with byte-identical CRC, MD5 and
SHA1 at both the file and ROM level. Most libraries are predominantly
single-file, so this applies broadly rather than to an edge case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 13:56:10 -07:00
Georges-Antoine Assi
7ce4f1d255 Merge pull request #4005 from Spinnich/fix/missing-tab-sidecar-perf
perf(roms): stop the Missing tab scanning the whole library
2026-07-30 15:06:59 -04:00
Georges-Antoine Assi
440cc6fa2d docs(roms): drop two redundant comments
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 14:58:42 -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
Georges-Antoine Assi
6fd2d9576c fix(backend): re-run the Hasheous hash lookup on a hashes scan
A ROM's "verified" state comes entirely from the Hasheous signature match
flags in `hasheous_metadata`, but `ScanType.HASHES` was missing from both
Hasheous gates in `scan_rom`. A rehash recomputed the file hashes and then
never re-asked Hasheous about them, so the verification chips stayed dark
(#4001). RetroAchievements was already gated in, which is why its provider
icon appeared while nothing lit up.

A follow-up update scan didn't help either: that branch is gated on
`rom.hasheous_id`, which is never set for a ROM that has yet to match.

Add `HASHES` to `fetch_hasheous_hash_match` and `fetch_hasheous_rom`, and
to the "don't overwrite existing base fields" branch: Hasheous now returns
a name/cover/summary on a rehash, and `_identify_rom` short-circuits before
the cover download, so a changed `url_cover` would point at an image that
is never fetched.

Fixes #4001

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 14:53:46 -04:00
Georges-Antoine Assi
1dd36cc58d feat(v2): previous / next game buttons on the details page
Restores the v1 gallery-stepping affordance in the v2 details view. A new
PrevNextNav composite reads the current ROM's position from the v2 gallery
store's ordered `romIdIndex`, so the order matches whatever gallery the user
came from (filters, sort, grouping included), and hides itself when the ROM
isn't part of a list (direct link, related-game jump, Home row).

Fixes #3998

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 14:53:42 -04:00
Georges-Antoine Assi
8ddf855fc5 fix(v2): keep RSelect menus inside the viewport and tidy the selection text
The `size` middleware capped the panel with
`min(360px, var(--available-height, 360px))`, but `--available-height` is
never defined, so the cap was always a hard 360px no matter how much room
the activator actually had. `flip` then placed a 360px panel into a
smaller gap and the menu spilled past the viewport edge: at a 500px
viewport the search field could land 66px above the top, or the list 106px
below the bottom. Use floating-ui's real `availableHeight`, as RMenu
already does.

A multi-select without chips rendered each title and each "," separator as
a direct child of `.r-select__value`, a flex row with a 6px gap, so the
separator picked the gap up on both sides and the activator read "A , B".
Give the run its own box.

Also focus the in-panel search field with `preventScroll`: it autofocuses
on mount, which is before floating-ui places the panel, so the UA would
scroll to the panel's pre-placement box at the viewport origin.

The 2D/3D media labels disagreed in every locale ("Box art (2D)" vs
"3D box art"); settle on the parenthesised form.

Fixes #4000

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 14:53:37 -04:00
Spinnich
65a5aec5e0 fix(screenscraper): pace at the budget the account reports
ScreenScraper's FAQ gives the per-minute budget as `threads x 50`, while
`maxrequestspermin` came back as `1024 x (threads + 1)` on every account
measured. Reading the field as the unreliable one, pacing took the lower of
the two, pinning a 9-thread account to 450 requests per minute against a real
allowance of 10240.

ScreenScraper confirms the API was changed without the documentation
following it, and that the reported field is the authoritative one, so pace
at it and drop the formula.

That leaves no basis for a default rate either. Until the account reports,
the one-thread default is the guard: a single in-flight request cannot outrun
any budget ScreenScraper hands out, and priming reads the account before the
first ROM, so at most one request is ever unpaced.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 16:26:41 +00:00
Georges-Antoine Assi
2c8009dc53 Merge pull request #4004 from rommapp/fix/sgdb-skip-dmca-locked-grids
Skip DMCA-locked grids when scraping SteamGridDB
2026-07-30 10:48:12 -04:00
Georges-Antoine Assi
2882f9711a Restore DMCA placeholder comment on the grid filter
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 10:41:55 -04:00
Georges-Antoine Assi
77925db009 Drop redundant DMCA placeholder comments
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 10:41:16 -04:00
Georges-Antoine Assi
ea677be6af Align cleanup task tests with unconditional cron string
The scheduled cleanup task now always carries the configured cron string,
so assert that instead of expecting None, and set the cron string to None
explicitly to exercise the unschedule branch in init().

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 10:38:56 -04:00
Spinnich
0526ded376 test(roms): drop the tautological index assertion
Asserting the model declares the index only restates `models/rom.py`. The
migration test covers what matters: the index exists in a database the
migrations built. Also pin the predicate test to the literal it compiles
to, so an unrelated `IS NOT NULL` elsewhere in the query cannot fail it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 14:24:21 +00:00
Georges-Antoine Assi
6217235c4e Skip DMCA-locked grids when scraping SteamGridDB
SteamGridDB does not remove assets taken down under DMCA; it returns them
with "lock": true and strips the URL signature, so the CDN serves a
placeholder image reading "This asset has been removed in response to a
DMCA takedown notice" for both the full asset and its thumbnail.

Filter locked grids in _get_game_covers, the single funnel for scan
matching, ID lookups and the manual cover picker.

Closes #4003

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 10:21:00 -04:00
Spinnich
fdb000576a perf(roms): stop the Missing tab scanning the whole library
Settings -> Library Management -> Missing made three whole-library passes
per request, two of which produced data the page never renders, and none
of which could be cached because "missing" counts as a filter.

- The tab now opts out of the char index, the filter values and the
  ordered id index, so the endpoint serves its total from a plain COUNT.
- `missing_from_fs` gets a composite index with `name_sort_key`, and the
  filter compiles to an equality: MariaDB does not treat `IS NOT FALSE`
  as indexable, so the index would otherwise only ever be scanned end to
  end. The column is NOT NULL, so both forms match the same rows.
- The filter-value list is keyed on the scope (search / platform /
  collection) alone. It is built from a query that never applies the
  row-level filters, so a filtered request now answers with, and warms,
  the same whole-library entry an unfiltered one does.

Fixes #3992

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 12:13:03 +00:00
Georges-Antoine Assi
426be64dc7 fix(security): close three permission gaps from the 5.1.0 audit
Restrict ROM file deletion to the ROMS/DELETE grant. The new
DELETE /roms/{rom_id}/files/{file_id} route gated on ROMS_WRITE alone and,
unlike its manual/soundtrack/screenshot siblings, carried no category guard,
so a group holding write-but-not-delete could remove game files from disk
while whole-ROM deletion still required ROMS/DELETE.

Gate mutating streaming routes on ROMS_USER_WRITE instead of ROMS_READ,
matching the play-session routes. ROMS_USER_WRITE is always-on for
authenticated users, but absent from READ_SCOPES, which is all KIOSK_MODE
grants an anonymous visitor. Kiosk visitors all share user_id=-1, so session
ownership could not separate them and any visitor could claim sessions and
overwrite another's save states.

Restore the ENABLE_SCHEDULED_CLEANUP_ORPHANED_RESOURCES gate on the cleanup
task's cron_string. It was dropped in 06cafd4b1, whose message refers to
update_switch_titledb, leaving the documented opt-out inert and scheduling a
destructive task nightly. That commit also broke two of the task's own tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 18:28:04 -04:00
Georges-Antoine Assi
06cafd4b10 fix cron_string in update_switch_titledb 5.1.0 2026-07-29 17:41:52 -04:00
Georges-Antoine Assi
443c796f1e reduce freegosy text 2026-07-29 16:55:22 -04:00