* fix: confine provider media paths to the rom's own folders
Media paths in ScreenScraper and LaunchBox metadata sent through
PUT /api/roms/{id} are now kept only when they point at a PNG or video
file in the rom's own folder for that media type. Malformed provider
metadata is rejected with a 422.
nginx serves /assets/romm/resources/ with nosniff and a sandbox CSP,
except for PDFs, so the browser's PDF viewer still opens them.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix: code-review pass on media path confinement
Reject non-string media URLs with a 422, limit stored media file names
to [A-Za-z0-9_-]{1,64}, build the LaunchBox path test from the fixture
rom's ids, and trim the new docstring and nginx comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: simplify pass on media path confinement
Raise the 422 directly instead of through a self-caught TypeError, pull
the path check into a predicate, and share the media I/O patches between
the new tests through a class fixture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: keep only stored media URLs from raw provider metadata
A media URL in client-supplied ScreenScraper or LaunchBox metadata is
kept only when the rom's stored metadata for that provider already holds
it. Otherwise the URL key, or the whole later-disc entry, is dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Drop the unused backend-dev-build, dev-slim and dev-full stages. No
workflow or compose file targets them (the dev image is ./Dockerfile),
and because dev-full was the last stage, build_local_image.sh (no
--target) was building an image with the dev extras. full-image is now
the default target.
- Fetch argosy-sigil, mod_zip and nginx with BuildKit's git ADD (which
also pulls submodules) instead of git clone/checkout, as the gme stage
already does, so those stages no longer install git. RALibretro keeps
its clone: its Makefile builds RA_BuildVer.h from .git/HEAD and
`git describe --tags`, which ADD strips.
- Hardcode /var/www/html in place of WEBSERVER_FOLDER: nothing sets the
ARG, and the entrypoint and nginx template hardcode the path anyway.
- Stop copying the CPython headers into the runtime image; nothing
compiles there.
- Remove a no-op chmod and a mislabelled comment.
Claude-Session: https://claude.ai/code/session_01NH5s4fzfhupfVnuw2VKdog
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Gunicorn writes /tmp/gunicorn.pid only once its arbiter starts. On a slow
cold start the watchdog found no pid file and started another gunicorn
every 5s without stopping the earlier ones, until the host ran out of
memory. Record $! at launch, as the RQ workers already do.
Cold starts were slow because the image ships no bytecode while setting
PYTHONDONTWRITEBYTECODE=1, so every process compiled every module from
source. Compile the venv during uv sync and /backend at build time.
Fixes#5246
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(docker): bump nginx to 1.30.6 and drop pip from the runtime image
nginx 1.30.5-r1 carries CVE-2026-15176, CVE-2026-93479 and
CVE-2026-97205, fixed in 1.30.6-r0. The package comes from the pinned
nginx base image, so apk upgrade cannot pick it up.
Trivy also flags urllib3 2.7.0, msgpack 1.1.2 and setuptools 70.3.0
from pip 26.2.2's vendored copies in the system Python. pip 26.2.2 is
the latest release, and nothing in the running image uses pip (the app
runs from the uv venv), so remove it in python-runtime. Build stages
still get the upgraded pip from python-alias.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Apply suggestion from @greptile-apps[bot]
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
The pinned python:3.14-alpine3.24 image (Python 3.14.7) installs pip
from CPython's bundled ensurepip wheel, which is pip 26.2.1. pip 26.2.2
was released on 2026-10-20 for the eMudhra CA compromise. The shipped
image copies /usr/local/lib/python3.14 and /usr/local/bin from that
base, so the old pip landed in every RomM image, and the sigil-build
stage used it to fetch cffi and setuptools from PyPI.
Upgrading in python-alias covers both, since sigil-build and
python-runtime derive from it.
Claude-Session: https://claude.ai/code/session_01MH7wFM9YCxzurL1kP7vvLA
Co-authored-by: Claude <noreply@anthropic.com>
Node 24.22.1 distrusts the compromised eMudhra intermediate CAs, updates
the bundled root store to NSS 3.131.1, and fixes the TLS hostname
verification bypasses (CVE-2026-105483, CVE-2026-106069) and the Brotli
decoder out-of-bounds write (CVE-2026-111497).
Moves .nvmrc (CI and dev-setup), the pinned node:24.22-alpine3.24 build
image and its digest, and the dev container's nvm pin.
Claude-Session: https://claude.ai/code/session_01MH7wFM9YCxzurL1kP7vvLA
Co-authored-by: Claude <noreply@anthropic.com>
uv 0.13.4 distrusts the compromised eMudhra intermediate CAs
(https://emudhra.we-have-a-problem.com/) in its bundled webpki roots.
required-version moves to >=0.13.4,<0.14, so local checkouts need
scripts/dev-setup.sh (or uv self update) after pulling.
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>
* 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>
report_task_failure can run in the worker parent when a work horse is
killed, so it now enqueues notify_task_failure on the default queue
instead of loading the notification stack there.
enqueue_task defaults to the queue its spec names. The streaming worker
runs as PreloadingWorker, which imports the enabled scheduled tasks of
its queues, so the reaper's per-minute horse inherits its stack. Spec
tests now read config in a fresh interpreter instead of comparing a
value with itself.
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>
The test checks the one line the watchdog relies on, next to the keepalive
pair instead of between it, and the comment states RQ's late write once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds a test that start_rq_worker records $! instead of passing --pid, and
moves the comment next to the line it explains.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watchdog restarts any process whose PID file is missing, and RQ's --pid
writes that file only after importing the worker class. Since RomMWorker
imports tasks.tasks (and with it config, SQLAlchemy and the auth and socket
handlers), reaching that point takes seconds on a cold, bytecode-less image,
so on a slower host the watchdog started a fresh pair of workers every 5 s
and each one lived on as a duplicate. The init script now writes $! like it
does for the cron scheduler and the watchers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
master refreshed the Alpine 3.23 digest and added the python-runtime
stage; this branch moves the same pins to Alpine 3.24 and nginx 1.30.5.
Kept 3.24 and re-resolved every tag to its current manifest-list digest,
so the base images carry the patches master was reaching for.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The image logs a spurious notice on every start:
[notice] 113#113: js vm init njs: 00007F16E1CA0B00
njs logs one line per config VM it initialises (nginx/ngx_js.c) and the
config imports a single VM at the http level, so it is noise rather than
a symptom. njs 0.9.7 removed the line (nginx/njs#1042, nginx/njs#1047),
but nginx:1.29.8-alpine was built six days earlier and ships njs 0.9.6.
nginx:1.30.5-alpine3.24 ships njs 1.0.1.
1.30 is nginx's stable branch: 1.29.8 was the last mainline of that tree
and 1.30.0 the same code a week later. Both branches carry the same-day
CVE-2026-90439 fix, so the move gives up no security fix.
The nginx tag is what forces the Alpine move: each nginx release ships
one Alpine flavour and there is no 1.29.8-alpine3.24. Alpine 3.24 is
supported to 2028-06-01, 3.23 only to 2027-11-01.
Verified: the repo's own config logs the notice on 1.29.8-alpine and
does not on 1.30.5-alpine3.24; mod_zip compiles against release-1.30.5
on the new base; every apk add list in this file resolves on 3.24.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Release builds import a persistent registry cache, and an `apk upgrade` off a
fixed base digest has no changing input, so the layer would be reused from a
previous release and reship its package set.
`no-cache-filters` forces both upgrade stages to run on every release. The
Python-side upgrade moves into its own `python-runtime` stage so that busting
it does not also rebuild the venv and the sigil bindings.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The base images are pinned by digest, so the image ships whatever packages
were current when upstream last rebuilt them. Alpine backports fixes to its
3.23 repo well ahead of that, leaving known-vulnerable curl, openssl,
libexpat, util-linux, libpng and nghttp2 in the published image.
`apk upgrade` in production-stage takes those patches, and the same call in
python-alias keeps the /usr/lib copy from putting stale libs back. The Alpine
digest is also refreshed to 3.23.5, for the builder stages.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The vite plugin parsed the COOP/COEP patterns out of the nginx template at
config load, but the Dockerfile's frontend-build stage copies frontend/
alone, so the config threw ENOENT and the image build failed.
Restate the two patterns in the plugin and let its test assert they still
match the template's map, which also drops the dev container mount that
existed only to feed that read.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The dev server now parses the isolated URLs out of the nginx template
instead of restating them, and refuses a template that yields none.
js-dos skips the runtime preload on the leg it is about to reload away,
records its play session on pagehide, and takes the relaunch marker from
the composable that defines it.
Also drops a redundant parameter and a duplicated derivation from
applyLaunchIntent, collapses the repeated id checks in isLaunchIntent,
gives the js-dos asset bases one home, and trims the comments.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Findings from the review pass over the SPA launch change, plus the two bot
reviews on the PR.
Correctness:
- Presence stops were addressed to the device, not to a rom, so a view that
never announced anything could clear what another tab was playing. A stop now
needs a started session, and happens once; `useActivityPresence` grows the
`stop()` the two call sites were spelling out by hand.
- The EmulatorJS exit read `window.EJS_emulator`, which a departure taken while
the loader was still injecting would not see yet, so the runtime could be left
in a document a later launch then failed to load into. It tracks the injection
itself.
- js-dos resolved its asset base per view: a second launch in a document whose
runtime came from the CDN looked for the payloads locally. Two views mounting
at once could also both inject the runtime. Both now go through one
document-level loader, which resolves with the base it served from and lets a
later mount retry a failed load.
- A blocked sessionStorage threw while every EmulatorJS view was initialising.
Storage that cannot be read is an absent intent, and one that cannot be
written cancels the relaunch rather than losing the selection to it.
- Outside a secure context the headers cannot expose SharedArrayBuffer, so the
reload only delayed the same error by a round trip. It is refused up front.
- The dev server mirrored one of the two nginx isolation entries, leaving the
console player unisolated there.
Reuse and cover:
- `usePlayerExit` owns the whole rule again: `departing` moved in, so both views
use `guard` rather than one of them restating it, and the `leaving` flag it
never needed is gone.
- Resolving an intent back into a selection is a pure pair in `launchIntent.ts`
with its own tests, rather than closures the view kept to itself.
- The Vite plugin is a script beside `precompress`, so the regexes that have to
track nginx are tested.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R1VFUvsR5wYK3axxR1gebc
In the http block gzip_static was inherited by every location, including
the internal /library/ and /cache/ ones that serve downloads. RomM handles
.gz and .tar.gz ROMs, so a library holding both Game.nes and Game.nes.gz
answered a request for the first with the second's bytes under
Content-Encoding: gzip. Reproduced against nginx with a real upstream
issuing X-Accel-Redirect: the download returned 73 bytes of gzip instead
of the 3000-byte ROM. Clients that do not transparently decode, and Range
resumes over /cache/, would have written the wrong file to disk.
It now sits in the three locations that serve the frontend build, where a
.gz sibling can only be one the build wrote. Verified both directions: the
ROM download returns the plain 3000 bytes with no Content-Encoding, and a
fingerprinted asset is still served from its precompressed sibling.
The test now guards the invariant rather than the directive's presence:
gzip_static must be absent from the http block and from every location
serving files the build did not produce.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
open_file_cache keyed descriptors by path, so a cover replaced via
os.replace() kept serving the old inode until the validity window expired,
and the ?ts= buster does not change the filesystem key. The comment beside
it claimed the opposite. The benefit was never measured either: the cache
saves an open() and an fstat() per request, which is microseconds on a
local file, and covers are served immutable so repeat hits are rare.
Removing it is simpler than scoping it away from the one tree it was
supposed to help.
The keepalive test asserted gunicorn outlives nginx's idle timeout without
checking that nginx pools upstream connections at all, which it only does
by default from 1.29.7, so a downgrade would have left the test green and
the pooling silently gone. It now checks the pinned version too.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
The SPA bundle was compressed on every cold page load. Writing a .gz
sibling at build time and turning on gzip_static moves that work to the
build: serving the 1.6 MB main bundle drops from ~71ms to ~9ms per
request, measured over 25 requests against a local nginx.
Level 9 is affordable when it runs once, though it lands within a percent
of what nginx produces at runtime, so the win is the CPU rather than the
bytes. Anything without a .gz sibling still compresses on the fly.
The step is chained into build rather than a postbuild hook because
frontend/.npmrc sets ignore-scripts, which stops npm running pre and post
hooks at all. Node's zlib does the work, so no new dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
The comment and test docstring said a short keep-alive makes nginx reuse a
connection gunicorn is closing and return 502. Reproducing the race says
otherwise: across 320 requests timed against the close boundary, GET and
POST alike, nothing failed and nginx logged nothing. It notices the closed
idle connection and opens a fresh one.
What the short value does cost is the connection pool. Measured with a
counting upstream behind nginx, eight requests three seconds apart opened
eight upstream connections at a 2s idle close and one at 65s, so below
nginx's idle timeout the keepalive it now enables by default never pays off.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
The build pinned 0.11.2, a full minor series behind. uv is a build-time
tool here: it lands in the backend-build stage and the shipped image
takes only /src/.venv from it, so this does not change the runtime image.
0.12.0 carries breaking changes, but none reach this project. Locking
from scratch with 0.11.2 and 0.12.13 resolves the same 178 packages and
writes byte-identical files apart from how a relative exclude-newer is
recorded, and each version reads a lock written by the other.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
The emulator cores are the largest assets the image serves and nginx maps
them to application/wasm, which is not in gzip_types, so they went out
uncompressed. Player logos (image/svg+xml) had the same problem.
A cover grid opens hundreds of small files and writes an access log line
for each, so cache the descriptors and buffer the log writes. Negative
lookups stay uncached so a freshly scraped cover still appears at once.
Also drop TLSv1/TLSv1.1 from ssl_protocols, which scanners flag even
though this nginx never terminates TLS, and raise worker_connections off
the old Debian default.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
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
The release and preview image workflows build docker/Dockerfile for
linux/amd64 through the same sigil path, so they hit the same zstd asm
link failure the dev image did.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fetch EmulatorJS, Ruffle, js-dos and FAKE-08 in the dev Dockerfile, on the
same pins and checksums as the emulator stage of docker/Dockerfile, into
/opt/romm/emulators. The ./frontend bind mount hides anything the build
writes under /app/frontend, so entrypoint.sh links each runtime into the
assets tree the dev server serves, leaving names held by checked-in art
alone. The runtime directories join the dev watcher's ignore list so
chokidar does not crawl them.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Cut the comment that compared the pixel loop to the byte-store version it
replaced, and the two three-line notes on the runtime fetch and the script
loader, keeping only what a reader cannot recover from the code.
Rename padButtonMap, padAxisMap and mouseButtonMap to *Bits: they are pair
lists of masks, not records like keyboardMap next to them.
Give the test's fake canvas context a real ImageData return so it fails if
the runtime starts reading width or height, and drop the imports that
change orphaned.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>