* fix(demozoo): send an API key with every Demozoo request
Demozoo's API has required an API key since 2026-11-01. Add
DEMOZOO_API_KEY, sent as an Authorization: Api-Key header, and enable
Demozoo when it is set, like the other key-based providers. It replaces
DEMOZOO_API_ENABLED, since requests without a key are refused.
Fixes#5698
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(env): quote empty values in env.template so Compose reads them as empty
Docker Compose's dotenv parser only treats ` #` as an inline comment
after a value. For `KEY= # comment` it takes the comment text as the
value, both for env_file and for ${KEY:-default} interpolation in
docker-compose.yml. A .env copied from the template therefore hands 46
settings their description instead of an empty string, and the dev
backend fails at startup on OIDC_AUTH_PARAMS ("not valid JSON").
Quoting the empty values (`KEY="" # comment`) parses as empty in both
Compose and python-dotenv. The docs generator already strips surrounding
quotes, so the env var reference renders unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(env): fail when env.template leaves an empty value unquoted
Docker Compose reads `KEY= # comment` as the value "# comment", so a
new setting added in that shape would break .env files copied from the
template again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(env): code-review pass on env.template quoting
Tell users to single-quote JSON values, since double-quoted JSON inside
"" breaks Compose's .env parsing. Point REDIS_SAVE_POLICY at "" for
disabling snapshots, and widen the guard test to catch KEY=#comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(env): humanizer pass on env.template comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(saves): add save channels and snapshots
* feat(saves): close spec gaps in save channels and hash with sigil
* feat(saves): play snapshots in the v2 player, which pushes snapshots
* fix(saves): code review: authorization, retention losses, held-save sync, batched responses
* refactor(saves): simplify pass
* refactor(saves): review-polish pass
* docs(saves): humanizer pass
* feat(saves): run every EmulatorJS page on the v2 player
* feat(saves): per-user snapshot pins
* feat(sigil): store the identity a save restore needs and pin sigil 0f05f25
* fix(saves): meet type-aware lint in the v2 player
* feat(sigil): store N64 header and playlist title ids, pin sigil 0847fda
* feat(saves): convert saves for a core on download and list save layouts
* feat(saves): prune unreachable archival snapshots and empty detached channels on delete
* feat(saves): device sync from the token, held snapshots and shared-card pushes
* feat(saves): arc restores past abandoned snapshots and color channels by age
* fix(saves): code-review and security-audit fixes
* refactor(saves): simplify pass
* chore(saves): review-polish pass
* docs(saves): humanizer pass
* fix(sync): file RetroArch autosave versions as their channel's next snapshot
* fix(saves): address review findings and trim docstrings
* fix(saves): share-lock planned rows by id so PostgreSQL accepts the lock
* test(saves): stub the detached-channels fetch in SaveDataTab stories
* feat(saves): carry the full current snapshot in a 409, pin sigil 2071dff
* chore(sigil): pin 5d4ddb4, which reads .cue and .gdi sheets
* docs(saves): drop v2 wording now that one UI remains
* chore(sigil): pin 0190443, which reads PS2 raw BIN images and cue sheets
* fix(sigil): treat a file too short for its format as routine during scans
* chore(migrations): renumber save channel migrations after upstream's 0154
* fix(snapshots): a hardcore switch on unchanged content makes a new current
* fix(sync): decide a channel's slot from its history and the device's snapshot
* chore(docker): pin sigil at 794d99f for PSP Store release save prefixes
* refactor(db): squash the save channel migrations into 0161
Fold the slot linking (0162) and the rom_files sigil identity columns (0163)
into 0161_save_channels, so the feature ships as one revision.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(saves): close visibility and input gaps found in review (pr-ready step 2)
code-review --fix:
- negotiate_sync drops channel slots on ROMs hidden from the caller
- channel PATCH/attach/DELETE answer 404 when the channel's ROM is hidden
- a push copying a save from a hidden ROM answers 404
- _own_device applies require_token_device to bound client tokens
- adopting a legacy save syncs its sharing with the channel it joins
security-audit follow-ups:
- another user's detached public save or state is no longer downloadable
- profile and option values must be a single path segment
- companions are de-duplicated and capped at 8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(saves): share channel and asset lookups, drop duplicates (pr-ready step 3)
simplify:
- readable_channel_or_404 and channels_on_files replace four copies of the
channel 404 check and two copies of the file-fed channel listing
- readable_rom_asset_or_404 serves both public save and state downloads
- _own_device resolves through require_device; _clone_origin takes the source
- reuse _unprocessable, DESCRIPTOR_EXTENSIONS, SAVE_SLOT_MAX_LENGTH, uniqueBy
and uuidv7; neutral forms default their required pattern to the allowed one
- RetroArch delete checks held rows in one query, a guarded upload lists the
slot only without a channel head, and uploads are read off the event loop
- snapshotSession builds push requests once; player comment cleanups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(saves): trim two docstrings to two lines (pr-ready step 4)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(saves): answer held RetroArch paths with 423, mirror slot labels
- RetroArch Cloud Sync answers 423 Locked for a PUT over a held unslotted save
and for a DELETE where only held rows sit at the path, instead of 409 and 404
- channelLabelForSlot returns null for blank and state_ slots, as the backend's
channel_label does, so the player files them under no channel either
- document that sharing a channel lets every user read and push into it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(docker): pin sigil at 85f88a8 for Switch .nup containers
* fix(snapshots): a save pushed in another shape or format makes a new current
* refactor(saves): drop the always-true SAVE_SYNC.SNAPSHOTS heartbeat flag
Nothing reads it, and the SAVE_SYNC block's presence already tells a
client the server speaks the snapshot API. Also trim the rom detail
channel field comments to one line each.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(frontend): use uuidv7 for every client-generated id
Drop the randomToken wrapper and the notification inbox's Math.random tab
id, so uuidv7 is the one helper that works outside a secure context.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(saves): trim redundant snapshot API surface, dead code and duplicate logic
API:
- Drop PUT /snapshots/{id}/devices/{device_id}; GET /snapshots/{id}?hold=true holds.
- GET /snapshots is history only (channel_id required); GET /channels serves currents.
- A snapshot carries channel_id instead of an embedded channel.
- POST /saves/{id}/content takes the same query parameters as the GET, plus container_path.
Backend:
- Remove the archival write path, clone.py, DBStatesHandler.get_state, the sigil
identity-hash path, unused relationships and composite snapshot indexes.
- One held/frozen lookup, one bulk-delete guard, SQLAlchemy dialect upserts, and
the shared reserve_version_name in the writer.
- The writer takes a visibility filter and checks the channel and parent itself.
- The restore handler picks per-game or merge; fewer wrapper types and tables.
Frontend:
- Channel delete uses the shared typed confirm; DeleteChannelDialog is gone.
- Held offline pushes go through a per-channel SnapshotSession.
- Remove the slot-based pending upload path.
- The timeline shares the fan's badge logic.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* refactor(saves): release archival backups through module functions
The saves and states handlers each built a private DBSnapshotsHandler to
call release_backup and refresh_backup_digests, since they can't import
the shared instance. Both only ever ran inside the caller's session, so
they are now module functions taking it, like channel_for_slot.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* refactor(saves): share one deleted-assets handler instance
The saves handler built its own DBDeletedAssetsHandler because it can't
import the package's instance. The instance is now built in
deleted_assets_handler.py and re-exported by the package, so both use it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
---------
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): hash compressed ROMs by their content in every format
Files inside a game folder and standalone single-stream files picked a
reader from a hand-written extension/MIME chain that treated plain .gz as
tar, missed .tgz/.txz/.xz and the application/gzip MIME spelling, and
called max() on empty archives. One suffix-then-MIME lookup in
utils/archives now picks the reader, plain gzip/bz2/xz streams are
decompressed (or read as a tarball when they hold one), and an empty or
unreadable archive falls back to hashing its raw bytes.
Fixes#5328
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): don't read a zero-prefixed compressed stream as an empty tar
Addresses Greptile review on #5537: tarfile.is_tarfile accepts a
zero-filled opening, so a plain .iso.bz2 or .iso.gz starting with zeros
fell back to its compressed bytes. A tarball now needs a first member.
Also moves hash_largest_member's failure contract into Returns:.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): fall back to raw bytes on more unreadable archives (code-review)
Catch ValueError from corrupt Deflate64 members and undecodable zip
names, treat an archive with empty content as unreadable, route zips
with methods zipfile can't decode through 7zz, and drop the zlib.error
handlers no reader raises any more.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(scan): route 7z and undecodable zips through one largest-member reader (simplify)
Replace hash_largest_7z_member with a read_7z_file iterator built on the
shared 7zz listing and streaming helpers, probe zips with
_undecodable_zip_method instead of inspecting the exception cause, share
one decompression error tuple, snapshot only the ROM-level accumulators,
and reuse the archive-writing test helpers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): bound, single-pass and RAR-aware largest-member hashing
- Every Python-side archive read (zip, tar, gzip, bz2, xz, and the
composite zip/tar readers) now shares the SEVEN_ZIP_TIMEOUT budget the
7zz and bsdtar paths already had, so a decompression bomb falls back to
the raw bytes instead of tying up a scan thread.
- Compressed tarballs are read in one streaming pass: each member larger
than every one before it is hashed into a copy of the hashers as it
passes, instead of listing the whole archive and then decompressing it
again to reach the largest member.
- gzip is decompressed member by member and ignores trailing bytes the
way gunzip does, instead of discarding the content when padding follows
the last member.
- RAR members inside game folders hash by their largest member through
bsdtar.
- ARCHIVE_FORMAT_BY_SUFFIX moves to utils.filesystem and is the single
suffix list: COMPRESSED_FILE_EXTENSIONS, RAR_FILE_EXTENSIONS and the
handler's ARCHIVE_READERS are built from it.
- _calculate_rom_hashes detects the MIME type once per file and reads the
embedded CHD hash in the same thread, so libmagic no longer runs twice
per file or on the event loop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(oidc): add OIDC_AUTH_PARAMS for extra authorization request parameters
Lets admins send provider options such as prompt=select_account on the
OIDC login redirect. Authlib's authorize_params override its generated
state, nonce and PKCE values, so the parameters RomM manages are
rejected at startup.
Closes#5406
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(oidc): trim parse_oidc_auth_params docstring
Addresses Greptile review on #5431.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Setting OIDC_PROVIDER to Plex or Jellyfin now shows that provider's
logo on the login button. Also clarifies in env.template that the
value is the button label.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): let a container's broker_secret override STREAMING_BROKER_SECRET
STREAMING_BROKER_SECRET replaced every container's broker_secret, so a pool
of containers with different BROKER_SECRETs could not authenticate: each
broker after the first answered 403 "bad broker secret". A container's own
broker_secret now wins, and the env var is the fallback for containers that
set none. A blank broker_secret also falls back instead of becoming the
literal secret "None".
* test(streaming): cover a blank broker_secret with no env secret
Addresses Greptile review on #5259: the fallback cases all set the env
secret, so none pinned that YAML null no longer becomes the secret "None".
* Update examples/config.example.yml
---------
Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
* docs: list the ROM patcher env vars in env.template
ROM_PATCHER_TIMEOUT, ROM_PATCHER_MAX_FILE_SIZE_BYTES and
ROM_PATCHER_MAX_CONCURRENCY are read by the config but were missing
from env.template, so the generated env var reference in the docs
does not list them. A test now checks that every env var the config
reads is in env.template.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: say ROM_PATCHER_MAX_CONCURRENCY is per API worker; skip the env.template test without it
Each API worker process has its own patch semaphore, so the limit applies
per worker, not server-wide. The dev container only mounts backend/, so
the env.template test now skips there instead of failing on a missing file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(oidc): match any of the comma-separated groups in OIDC_ROLE_*
OIDC_ROLE_ADMIN/EDITOR/VIEWER were read as one raw string and checked
for membership in the roles claim, so a value like
"romm-admin,platform-admins" never matched and the login was rejected
with 403. Parse each variable into a set of stripped, non-empty values
and grant the role when it intersects the claim. A single-valued string
claim is matched whole rather than by substring.
Fixes#4302
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(oidc): reject a string role claim that only contains a mapped group
Addresses Greptile's review on #5203: the string-claim case only covered a
match, which the old substring check would also have passed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(docker): boot when the container runs as a non-default UID
Unraid runs the container as 99:100, which can't write to the image's
/romm (owned by 1000, mode 755), only to the mounted subfolders. The
PSP pending dir at /romm/cache/retroarch_sync was created at import
time, so every gunicorn worker failed to boot.
- Buffer pending PSP save files under the user's assets folder
(assets/users/<user>/retroarch/psp_pending/), beside the other
RetroArch Cloud Sync files and outside the client-reachable blob
categories.
- Move the zip and rom-converto download caches to /tmp/romm/cache,
and point nginx's internal /cache/ alias there.
- Put gunicorn's control socket in /tmp/gunicorn instead of
$HOME/.gunicorn, since HOME is / for that UID.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(docker): honor ROMM_TMP_PATH for caches, explain an unwritable sync folder
- The download caches live under $ROMM_TMP_PATH/cache when it's set,
so installs with a small Docker disk (Unraid's docker.img) can point
them at a share. The entrypoint exports the same path for nginx's
/cache/ alias.
- With ENABLE_SYNC_FOLDER_WATCHER on and /romm/sync not writable, /init
warns and skips the watcher instead of dying on mkdir under errexit.
- The compose example lists the /romm/sync mount the sync features need.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(sync): cover reading back and clearing buffered PSP files
Addresses Greptile's review on #5189.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(sync): apply code-review findings to PSP pending buffer
Remove the emptied psp_pending folder after a merge, define the sync
folder path once in init, update the architecture doc's PSP and blob
locations, and drop a stale .gitignore entry.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(sync): apply simplify findings to PSP pending cleanup
Clear the buffered folder with remove_directory, let the startup check
own creating the sync folder, and reword the test fixture docstring.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(sync): cap buffered PSP files and drop them on delete
Buffered files for an unresolved save folder now count against the
bundle limits, so a folder can't fill the assets share and then fail
every merge once it resolves. A DELETE also removes the buffered copy,
so a deleted file isn't merged back when the folder resolves.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(docker): check the sync folder for push-pull sync too
ENABLE_SYNC_PUSH_PULL keeps SSH keys and device saves under /romm/sync
as well, so an unwritable folder now disables it with the watcher and
warns at boot instead of failing when the task runs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(docker): strip whitespace from env vars like the backend does
The backend strips every variable it reads, while the init script and
nginx templates used raw values, so a padded ROMM_TMP_PATH sent nginx's
/cache/ alias somewhere the backend never writes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(config): drop the CACHE_BASE_PATH comment
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(docker): say which backend config strips env whitespace
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* revert(docker): drop the entrypoint env whitespace trimming
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(sync): apply pr-ready code-review findings
Gate push-pull on its SSH keys path rather than a writable sync folder,
accept the same truthy values as the backend, and clear only the merged
PSP pending files so another worker's buffered file survives.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor: apply pr-ready simplify findings
Share one truthy pattern across init's flag checks (the watcher gates
now accept the same values as the backend), disable gunicorn's unused
control socket instead of placing it, derive the converts redirect from
its own cache path, and factor the unknown PSP folder in tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(docker): apply pr-ready humanizer pass to the sync mount note
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(fs): create handler base folders on first write, skip leftover temp files
FSHandler no longer mkdirs its base path when constructed, so a module-level
handler rooted at an unmounted or unwritable folder can't take down boot;
every write path already creates its parent folders. Blob listings skip
.romm_tmp_ files a crashed write left behind, so they are never merged into
a PSP bundle or advertised in the sync manifest. The prefix now lives in one
TEMP_FILE_PREFIX constant.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A client that drains installs by polling claim (Argosy) never holds the
/devices socket, so the install dialog showed it offline while awake.
Each claim now sets a presence key that lapses after the same 90 seconds
as a socket's.
Also add TZ to env.template, since save version names and log
timestamps follow the container's time zone.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(player): play RPG Maker 2000/2003 games in the browser with EasyRPG
Embed the EasyRPG web player for extracted game folders on the rpg-maker
platform. The backend generates the player's index.json from the scanned
files and merges in the free EasyRPG RTP under every name the official
and fan RTPs give its assets, so games that lean on the RTP find them.
In-game saves sync with the user's RomM saves through the player's
IndexedDB storage.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(easyrpg): read the free RTP from a fixed path instead of an env var
The full image always keeps the RTP at /var/www/html/assets/easyrpg/rtp,
so the path is a constant beside the web path nginx serves it under. The
dev container links its copy there at startup.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(easyrpg): code-review fixes for the save sync and asset endpoint
- Wait for an in-flight push before the quit push, so the newest save uploads
- Keep Play disabled until the fresh rom (and its saves) is fetched
- Stop onPlay and the rom fetch from acting after the view unmounts
- Leave through usePlayerExit like the other players
- Handle a rejected IDB commit when the run itself fails
- Track uploads by the browser's file name
- Load only visibility and files per asset request, not the full rom
- Serve DEV_MODE files as octet-stream, matching nginx
- Make the traversal test actually reach the endpoint
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(easyrpg): simplify pass over the player and asset endpoint
- Load only file paths per asset request, and look up RTP folders in O(1)
- Reuse RomFile.file_name_for_download and usePlayerFullscreen
- Share one dev/prod serve helper for game and RTP files
- Derive the save sync's game key from the rom
- Have the RTP table tool reuse normalize_name
- Make save-module internals private and tidy the prepare/read loops
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(easyrpg): flag RPG Maker game folders on the rom schemas
Gallery lists carry no files, so the frontend guessed that every multi-file
rom on the rpg-maker platform was playable, including RPG Maker XP/VX/MV
folders. Rom now has a deferred `is_easyrpg_game` subquery (an RPG_RT.ldb at
the folder root), loaded with the other gallery file stats and derived from
loaded files on the with_files path, and the frontend reads it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(easyrpg): drop server save sync, keep saves per user in the browser
Server sync moves to a follow-up that puts the web players on device sync.
Saves now stay in the player's IndexedDB, as js-dos does, with the same note
on the start page. The player is launched as `<rom id>-<user id>` so each
RomM account sharing a browser profile keeps its own saves; nginx and Vite
drop the user id when routing to the backend.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(easyrpg): address Greptile review
- Start timing the play session once the player page loads
- Use object-form props in the view test's button mock
- Keep the RTP table tool's docstring to one sentence
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(easyrpg): keep the RTP table in a fixtures folder
Matches handler/metadata/fixtures, where the other bundled data files live.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(converto): integrate rom-converto for title id extraction and download conversion
* fix(docker): ship rom-converto in the production image
Only the dev Dockerfile installed the binary, so the integration could
never enable on a released image. Fetch the same pinned, checksummed
musl build in a dedicated stage and copy it next to RAHasher.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): skip the update check and batch info calls
The CLI asks api.github.com for a newer release on every run unless
told not to, so pass --no-update-check on each invocation. Inspect a
rom's files in one `info --paths-file` run instead of one subprocess
per file, and read the inspectable extensions from the capabilities
manifest so scans skip files info cannot recognize.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(scan): keep sigil authoritative for title ids
rom-converto ran first and overrode the ids sigil read. Sigil now runs
first and records its per-file ids; rom-converto only fills files sigil
left unset, on new or changed files, in one batch. Restore the base-id
selection for sigil extractions on every platform, as on master.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(downloads): make conversion opt-in and bound the cache
The download endpoint returned a converted file to every client once a
platform had a target, including the browser player and apps that check
hashes against RomFile. Conversion now needs ?converted=true.
A pre-warmed copy is served whatever its size; the in-request size cap
only gates starting a conversion. ROM_CONVERTO_CACHE_MAX_SIZE_GB
(default 20, 0 unbounded) caps the cache: conversions and the pre-warm
task stop when it is full, and cleanup evicts the least recently served
copies.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(types): regenerate frontend types for the converto schema
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): address code-review findings (pr-ready step 2)
- Fall back to rom-converto's stored ids only when it ran this pass, in
disc order, so a rescan that skipped extraction keeps sigil's save target
- Persist per-file title ids that extraction writes onto reused rows
- Only authenticated callers may start an in-request conversion; past a
240s deadline serve the original and let the conversion finish into the
cache instead of nginx returning 504
- Treat a probe OSError or timeout as a failed probe; kill the subprocess
when the caller is cancelled
- Give the pre-warm task the scan timeout and report progress in the
ConversionStats shape the task UI reads
- Reuse zip_cache constants, walk the cache off the event loop, tolerate
files vanishing mid-cleanup, and trim long comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): simplify conversion code (pr-ready step 3)
- Move the converted-download policy (target lookup, cached-first, sync
size cap, deadline) from the endpoint into utils/conversion_cache and
share conversion_target with the pre-warm task
- Share one path lookup between get_cached_converted and get_or_convert;
the pre-warm walks the cache once and tracks a running byte budget
instead of walking it twice per rom
- One normalize_platform_formats beside TARGETS_BY_PLATFORM for the
config loader (via _validated_platform_map) and the settings endpoint;
update_converto_settings takes a ConvertoConfig and is written back
with dataclasses.asdict
- read_infos owns its never-raise contract, so the scan drops its blanket
except; drop the unused RomConvertoInfo.kind and error attributes
- Sort files for the rom-converto identity only when it is used; stat
each cached file once during cleanup
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(converto): trim comments (pr-ready step 4)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): convert on first download instead of pre-warming
A library pre-warm fought the TTL: cleanup dropped every copy nobody
downloaded within a day. Remove the Convert library task and convert on
demand only. Files over ROM_CONVERTO_MAX_SYNC_SIZE_MB now start their
conversion in the background while the original is served, so the next
download within the TTL gets the converted copy at any size.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): drop decrypt and encrypt download targets
Downloads now only change a rom's container or compression (CHD, RVZ,
CSO, NSZ, ...); serving decrypted files is left for a separate decision.
NDS and PS3 have no remaining targets. Also note that the conversion
concurrency limit applies per process.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): move the cache limits into converto.*
cache_max_size_gb and max_sync_size_mb join cache_ttl_hours in
config.yml and PUT /api/config/converto_settings, replacing the
ROM_CONVERTO_CACHE_MAX_SIZE_GB and ROM_CONVERTO_MAX_SYNC_SIZE_MB env
vars, so every eviction knob is edited in one place at runtime. The
loader takes its defaults from ConvertoConfig and one table holds each
integer's minimum for both the loader and the payload.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): lock conversions with flock instead of a sentinel
A conversion now holds a non-blocking flock on its key dir, which the
kernel releases if the worker dies. That replaces the .partial sentinel,
its 6-hour staleness guess (which a long ROM_CONVERTO_TIMEOUT could
outlive), and the rename-aside takeover. Cleanup skips locked dirs, and
partial output gets a hidden name so it never counts as a served copy.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(converto): parametrize repeated test cases
Collapse the per-platform info parsing, operation resolution and
converto_active cases into parametrized tests, so a new platform or
target is one row.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(scan): run rom-converto first with sigil as the fallback
rom-converto reads each rom's new or changed files first, in one batch,
and its title ids win. sigil still reads what it can, since it alone
provides save targets and Switch content types, and fills the ids
rom-converto left unset.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(converto): store per-file metadata read by rom-converto during scans
* fix(scan): keep the stored save target when sigil reads nothing
* fix(converto): read Xbox 360 disc ids and Wii title versions, store content type as text
* feat(converto): save file icons, banners and backgrounds read by rom-converto
* chore(converto): bump rom-converto to v0.23.0
* fix(converto): address review findings in the conversion cache, scan metadata and settings
* refactor(converto): move per-file metadata out of the conversion PR
Scan-time metadata (title ids, the 17 rom_files columns, artwork and
converto.scan_metadata) moves to its own PR so its columns land with the
UI that reads them. This PR keeps conversion only.
The conversion cache no longer has uncompressed_size_bytes to budget
with, so a conversion to an uncompressed target reserves a fixed
multiple of its input and the cleanup pass after it evicts any overshoot.
Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ
* feat(converto): let the client pick the download format with ?format=
`?format=zso,iso` lists the formats a client can read. The stored file is
served whenever its format is listed, even with conversion off, so most
emulator clients never trigger a conversion. Otherwise the first listed
format with a cached copy is served, then the first one rom-converto can
produce.
A conversion that outlasts a short wait answers 202 with Retry-After
instead of falling back to the original, so a URL never serves two
different files and a client never gets bytes it can't read. 406 means
no listed format can be served. HEAD reports the same without starting
a conversion. This replaces `?converted=true`, the per-platform download
target and `max_sync_size_mb`; `cache_ttl_hours` stays config.yml-only.
Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ
* feat(converto): convert the library in place with a manual task
`converto.platform_formats` now names the format a platform's library is
stored in, and the new "Convert library" task brings every matched rom
to it. Each output is staged in a `.romm_tmp_` directory beside the
original, moved into place, and only then are the originals (and a cue's
tracks) deleted. Single-file roms take the new name, folder roms keep
theirs and get their .m3u entries rewritten, and the file rows refresh,
so a rom keeps its id, saves and collections.
Only lossless conversions qualify, so xbox (xiso trims the dump) has no
library format. Unmatched roms are skipped because a converted file no
longer hash-matches a DAT. `/api/config` now carries the library targets
and, per input extension, the formats a download can be converted to.
Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ
* fix(converto): address Greptile and Copilot review findings
- Publish a converted library file with a no-replace link, so a file that
appears during conversion is never overwritten.
- Delete originals only after the rom row or its playlists point at the new
file, and keep them if that update fails. Playlists are rewritten atomically.
- Refuse a cue conversion whose tracks another rom or another cue holds.
- Remove stage dirs a killed conversion left behind.
- Try later ?format= targets when a conversion fails, treat any locked key dir
as converting, and cap how many conversions downloads can start.
- Drop the unsupported iso target for CD platforms from the example config and
list the ROM_CONVERTO_* variables in env.template.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): address code-review findings (pr-ready step 2)
Serve converted outputs at 0644, read cue sheets and playlists with a BOM,
stage folder rom conversions outside the rom folder, keep one rom's failure
from stopping the convert library task, accept alias extensions as the stored
format, probe running conversions with a shared lock, and bound the timeout.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): simplify conversion code (pr-ready step 3)
Check and chmod rom-converto output once in the adapter, canonicalize
requested format aliases, reuse LINK_FALLBACK_ERRNOS and the handler's atomic
write, make the download format table a constant, skip the probe lock once
cached, and fold duplicated name checks and cache stat passes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(converto): trim comments (pr-ready step 4)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): find rom-converto on PATH instead of ROM_CONVERTO_PATH
Both images install the binary on PATH, the variable was undocumented,
and RAHasher is already resolved the same way.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Yukine <devyukine@gmx.de>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: DevYukine <20647088+DevYukine@users.noreply.github.com>
Adds ENABLE_SCHEDULED_CLEANUP_ZIP_CACHE, SCHEDULED_CLEANUP_ZIP_CACHE_CRON,
ENABLE_SCHEDULED_CLEANUP_SYNC_SESSIONS and SCHEDULED_CLEANUP_SYNC_SESSIONS_CRON,
defaulting to the previous hardcoded behavior.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
OIDC_TLS_CACERTFILE was handed to httpx as verify=<path>, which builds a
context trusting only that file. A directory needed OpenSSL hashed names,
and DER or .p7b bundles failed to load, so two-tier PKI setups got a 500
on SSO. Build an SSL context from certifi and the system store, then add
every certificate found in the file or directory (PEM, DER, or PKCS#7).
Fixes#1589
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sixty seconds cut off extraction of mid-sized disc images, so their scan
fell back to hashing the archive itself.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Setting DEV_PROXY_TARGET in .env points the Vite dev and preview proxies
(/api, /ws, /openapi.json) at another RomM instance and also proxies
/assets/romm there, since covers only come from the local symlink when
developing against the local backend. Unset keeps today's behaviour.
The Set-Cookie rewrite from the original proposal is not needed: RomM
never emits a Domain attribute, and browsers accept Secure cookies from
plain-http localhost.
Closes#4663
Co-Authored-By: Stuart Anderson <andest01@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- Rewrite the RetroArch Cloud Sync architecture section: add the PSP,
kiosk, size cap and missing-file behavior, drop the stale hash note
- Document SYNC_RETROARCH_PSP_SERIAL_MAP in env.template and the env table
- Trim two docstrings and reuse CLIENT_DEVICE_IDENTIFIER for the device type
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- A failed login keeps the attempted username only when it names an
account, so a password typed into the username box is never stored.
- Gunicorn trusts X-Forwarded-For only from loopback and private ranges
(FORWARDED_ALLOW_IPS, documented in env.template), so a client can no
longer choose the address the audit log and rate limits see.
- A player's fetch (purpose=play) is recorded as rom.player_load instead
of being skipped, so the marker can't hide a download.
- Play-session ingest treats a rom hidden from the caller as unknown, so
its session and rom.play event don't name it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A persistent record of what users, or RomM itself, did. Admins read
everyone's events through GET /api/audit-events; anyone else gets only
their own. Events older than AUDIT_LOG_RETENTION_DAYS (90 by default,
0 keeps them) are pruned nightly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A channel's min_level is its own enum (info, warning, error), so the
API refuses `success` and neither the list nor the dialog maps it.
- One home each for the admin-reaches-the-LAN rule (the DB handler now
returns the owner's role) and for describing a failed delivery.
- One webhook config builder for create and update, which drops the
secret of a Discord webhook on both.
- SMTP_SECURITY outside starttls/tls/none leaves email off, so the
heartbeat says so, with a warning at startup.
- The attempts counter gets its TTL in the same round trip as INCR.
- Deliveries group channels by user and serialize a notification only
when a channel wants it.
- The v2 side reuses errorMessage (now with a fallback) instead of its
own detail parsing, mirrors the backend length limits as constants,
shares one channel test factory, and derives `created` on save from
the list instead of carrying it on the event.
- Drop RBadge's inline override, which nothing needs now that an inline
badge gets no anchor class, and trim docstrings to one sentence.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit carried only the renames of this change, when staging
the rest failed on a path the rename had already moved. This is the change
itself.
A reset link only ever went to the server log, for an admin to pass on. It
now goes to the user's email address when SMTP is set up, the user has one
and ROMM_BASE_URL is shareable, falling back to the log otherwise or when the
server refuses the message. The link is built from ROMM_BASE_URL alone, never
the request's Host, so a forged header can't aim it at another server; it
goes out after the response, so its timing doesn't reveal whether the
username exists; and a user's inbox gets at most one a minute.
The SMTP sender moves from the notification channels to
handler/email_handler.py now that it has a second caller. The v2 reset form
says the link is on its way when the server sends email.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An operator who sets `ROMM_CORS_ALLOWED_ORIGINS=*` re-opened the credentialed
echo this branch closed: Starlette answers a wildcard with the caller's own
Origin, and pairing that with `Access-Control-Allow-Credentials` grants every
site credentialed access again. Deriving `allow_credentials` from the origin
list keeps the wildcard usable as an open (unauthenticated) origin policy
without the session cookie travelling with it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
`ROMM_CORS_ALLOWED_ORIGINS` defaulted to `*` while the middleware enabled
credentials. Starlette does not send a wildcard in that case: it echoes the
caller's own Origin with Access-Control-Allow-Credentials, so any site could
make credentialed cross-origin calls and read the response. An empty or unset
value now allows no cross-origin request; list origins to opt back in.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
`--forwarded-allow-ips="*"` made uvicorn trust every proxy hop and take the
leftmost X-Forwarded-For entry, which the caller supplies, so a client could
choose its own `request.client.host`. That host is the rate-limit key and part
of the web device fingerprint, so it was both evadable and forgeable.
The bundled nginx is the only peer gunicorn has, so the default is now
127.0.0.1, overridable with FORWARDED_ALLOW_IPS for a further reverse proxy.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Named slots kept every version, so a slot written once per session grew
without bound. `MAX_SAVES_PER_SLOT` (default 50, 0 disables) now caps
every slotted upload: after a new version lands, the slot is pruned to
the tighter of the server cap and the client's autocleanup limit, files
and screenshots included. Slot-less archives are never touched.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
nginx 1.29.7 is a security release (CVE-2026-27654, CVE-2026-27784,
CVE-2026-32647, CVE-2026-27651, CVE-2026-28753, CVE-2026-28755) and also
enables upstream keepalive by default, defaulting proxy_http_version to
1.1. That removes a TCP connect and teardown per /api request, which the
config never opted into.
It also makes the gunicorn keep-alive too short: nginx now holds idle
upstream connections for up to 60s while gunicorn closed them after 2,
so nginx could send a request on a connection gunicorn was closing and
return 502. Raise the default past nginx's idle timeout.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
`UPC_LOOKUP_ENABLED`, `UPC_LOOKUP_API_KEY`, `UPC_LOOKUP_URL`,
`ENABLE_SCHEDULED_BUILD_RECOMMENDATIONS` and
`SCHEDULED_BUILD_RECOMMENDATIONS_CRON` all ship in 5.3 and are read in
`backend/config/__init__.py`, but none of them reached `env.template`.
The docs generators treat `env.template` as the source of truth, so the
five were missing from the environment-variable reference, and
`gen_scheduled_tasks.py` fails outright rather than print a default it
cannot verify for the recommendations task.
Defaults match `backend/config/__init__.py`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Drop the `0` to `-1` remap and hand SQLAlchemy whatever the operator set,
so the knob means exactly what the pool means by it. `-1` is now the
documented way to never recycle, in both `env.template` and the env var
table.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The engine sets `pool_pre_ping` but no `pool_recycle`, so a connection
the database closed for being idle is still handed out, and the ping on
that half-closed socket blocks the worker until TCP gives up: tens of
seconds to minutes of an unresponsive API for every request that draws
it, while a fresh connection to the same server answers instantly.
Default to 300s, under the lowest `wait_timeout` MariaDB is commonly
configured with, and make it settable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add v2 browser playback for .p8 and .p8.png cartridges, backed by the
FAKE-08 WebAssembly runtime, with canvas rendering, audio, fullscreen and
keyboard, gamepad, mouse and touch input. Wires up platform detection,
play actions, routing, localization, gallery navigation, play-session
tracking and lifecycle cleanup.
The runtime is fetched in the emulator stage of docker/Dockerfile, pinned
by source commit and verified with sha256, so it is provisioned the same
way as EmulatorJS, Ruffle and js-dos rather than committed to the repo.
DISABLE_PICO8 gates the player, matching the existing DISABLE_EMULATOR_JS,
DISABLE_RUFFLE_RS and DISABLE_JSDOS toggles.
Based on #4383.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Hashing 1.96 GiB of real ROM files is 2.2x faster at 4 concurrent
workers than at 1 (108 -> 240 MiB/s on 16 cores, 108 -> 264 MiB/s
pinned to 4 cores). Pinned to 2 cores it is still 1.6x, so the new
default costs nothing on small hosts.
Metadata providers cap themselves independently of this value, so the
extra workers queue rather than exceed an allowance: ScreenScraper holds
a concurrency limiter set to the account's advertised thread count, and
the other adapters pace their own request rate. Database work in the
scan path is synchronous on the event loop, so it serializes regardless
and the connection pool is unaffected.
The compose example advised one worker per CPU, which overshoots on a
large host. Both it and env.template now say what raising this actually
buys, since metadata is paced no matter how many workers there are.
Only installs that never set SCAN_WORKERS move; any explicit value is
preserved.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
"2 x CPU cores + 1" is gunicorn's guidance for sync workers. RomM runs
UvicornWorker with sync endpoints served from Starlette's threadpool, so
the rule does not transfer: on a 16-core host it measured 3x slower than
4 workers and cost 5.31 GB PSS.
The variable also only reaches the gunicorn API server; background tasks
run in the separate RQ worker processes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
Extends the streaming container config so one container can serve many
platforms, adds the webstation protocol and subfolder keys, and warns
when a config still uses the deprecated per-emulator broker mods.
Also pins DB_NAME to a dedicated test database so the autouse
clear_database fixture can never wipe a real dev database.
Renumber the two migrations onto master's head: 0108/0109 collided with
0108_roms_primary_region and 0109_rom_files_category_index, leaving the
chain with two heads. They are now 0114 and 0115 behind 0113.
Both rebuild the roms_facets sync triggers from a hardcoded column list,
so add the publishers and developers columns 0112 introduced. Without
them the rebuilt triggers would have silently stopped mirroring the two.
Adopt master's provider taxonomy. METADATA_PROVIDER_GROUPS now carries
demozoo, pouet, and csdb as catalogs, which replaces the branch's own
GENERAL_PROVIDER_KEYS set and feeds the setup wizard, the scan dialog,
and Settings from one registry. CSDb reaches the scan explainer for the
first time; it was already selectable there.
Regenerate the frontend types: DetailedRomSchema was missing the three
metadata blobs the backend has always declared on RomSchema, and the
blobs are now typed rather than Record<string, unknown>.
Correct the setup strings that still called the three sources enabled by
default, and sort the locale keys.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Security review follow-ups on the Demozoo, Pouet, and CSDb handlers.
Default the three sources to off, matching every other provider. They
were the only ones defaulting to on, so an upgrade began contacting
demozoo.org, pouet.net, and csdb.dk on the next scan with no operator
opt-in, reachable through the unauthenticated metadata heartbeat.
Guard the bare id conversion in scene_id_or_none. str.isdigit() accepts
superscripts and other digits int() rejects, so a pasted "²" raised out
of the Edit ROM endpoint as a 500.
Filter the remote demozoo_url through http_url(). It was the only one of
the three URL fields taking a string from the API rather than building
one from a hardcoded template and an integer id.
Match a YouTube id against an explicit ASCII class. isalnum() is
Unicode-aware, so it accepted ids the embed URL never can.
Stream the CSDb response against a byte budget. The cap ran after the
whole body was already buffered, so it bounded the parse but not memory.
Catch defusedxml's refusals. EntitiesForbidden derives from ValueError
and ParseError from SyntaxError, so the existing handler caught neither
and an entity-declaring document raised out of production_from_xml.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>