Commit Graph

415 Commits

Author SHA1 Message Date
Bee
f50eacfcbd feat: add browser PICO-8 player
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>
2026-09-08 17:59:52 -04:00
Spinnich
424d1ebc1c fix(server): default to 4 API workers instead of 1
A single worker was the reason a lone user loading a gallery measured
6.474 s worst-case TTFB against 1.939 s at 4 workers. The multi-worker
path is already supported: the log forwarder takes a Redis lock so
exactly one worker relays.

Only installs that never set WEB_SERVER_CONCURRENCY move; any explicit
value is preserved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 16:56:48 +00:00
Georges-Antoine Assi
a3aecdf045 chore(python): restore the C accelerators lost on 3.14
The runtime moved to 3.14 but the pinned versions did not, so packages
without cp314 wheels silently resolved to their pure-Python universal
wheels. Bump each to the first release that ships cp314 wheels, all
within the existing pyproject specs:

- SQLAlchemy 2.0.41 -> 2.0.52 (cyextension, and greenlet is back so
  sqlalchemy.ext.asyncio is functional rather than merely importable)
- multidict, propcache, frozenlist (aiohttp/yarl accelerators)
- wrapt 1.17.2 -> 1.17.3 (OpenTelemetry instrumentation proxies)
- coverage 7.9.2 -> 7.16.0 (CTracer, and CI runs the suite under --cov)
- mysql-connector-python 9.3.0 -> 9.7.0 (C extension protocol)
- debugpy 1.8.14 -> 1.8.21 (pydevd accelerators)
- pyinstrument 5.0.3 -> 5.1.3 (no longer compiled from sdist on every
  `uv sync --all-extras`, which broke the no-toolchain dev setup)
- anyio 4.9.0 -> 4.14.2, dropping a PEP 765 SyntaxWarning printed on
  every process start

Run pytest and the migrations workflow when the runtime or the lock
changes: nothing in the 3.14 bump lives under `backend/`, so neither
workflow triggered on it. `e2e.yml` already listed those paths.

Make `.python-version` the single home for the version: `uv python
install` and `actions/setup-python` both read it. In the dev Dockerfile
that also fixes the interpreter layer not being invalidated when the pin
changes, and the sigil install now derives site-packages from the venv.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 21:48:52 -04:00
Sam Dornan
3c547dfbd0 chore(python): move the backend to Python 3.14
Bumps the runtime everywhere it is pinned: requires-python, the
.python-version uv reads, both Dockerfiles (with the python:3.14-alpine3.23
and uv 3.14 image digests), the six workflows that install Python, and the
contributor docs.

Several locked C-extension versions had no cp314 wheels, so the Alpine
image fell back to building them from source and failed on the missing
C++ and Rust toolchains. Those packages are upgraded within their existing
pyproject ranges: pydantic 2.11.7 -> 2.13.5 (pydantic-core 2.46.5), uvloop
0.22.1, grpcio 1.83.1, httptools 0.8.0, inflate64 1.0.4, markupsafe 3.0.3,
pyyaml 6.0.3 and streaming-form-data 1.20.0. The lockfile also drops the
3.13-only resolution branches.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 08:57:10 -05:00
Georges-Antoine Assi
dc7d14f31d refactor(scan): let RQ discard the scan dispatch, and say the guard once
The dispatch job was hidden from the task list by a meta flag the endpoint
had to look for on every job in every queue and registry. RQ already has
the rule the flag was implementing: `result_ttl=0` deletes a job the moment
it succeeds, while a failed one still lands in the failed registry under
its own TTL. Registering the scan entry with it drops the marker, the
predicate, its four filter sites and the two Redis reads each one cost.

The concurrency guard is now one call. `get_blocking_library_scans()` says
which scans a second one has to wait for, so the socket handler no longer
assembles that rule out of two helpers in two shapes, and `ALL_QUEUES` sits
with the queues it lists rather than in the API layer.

Also merges the finished and failed registry sweeps, which were the same
loop, trims comments that explained the design rather than the code, and
drops two socket tests that duplicated their neighbours.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 12:29:58 -04:00
Georges-Antoine Assi
ffc8dffc20 Merge upstream master into claude/rq-scan-queue-split
Master landed #4274 with the review changes that came out of it, and those
moved the code this branch was built on. Scan job bookkeeping now lives in
`handler/scan_jobs.py`, every enqueue goes through `enqueue_task`, cron
entries carry their own name and result TTL, and the watcher builds its two
rescans from one helper.

Resolved by putting this branch's changes where that code now lives:

- The scan queue, the scoped-scan check and the second scheduled registry
  moved into `handler/scan_jobs.py`, keeping master's single-round-trip
  reads (`get_job_ids` plus one `fetch_many`, and `get_jobs_to_schedule`
  for the stale sweep) across both registries.
- `enqueue_scheduled_scan` sits next to `enqueue_task` in the registry and
  is built from it, rather than hand-rolling the same enqueue in
  `tasks/tasks.py`. Its tests moved with it.
- Cron keeps master's per-entry name and result TTL, and adds the scan
  dispatch on top: `TASK_TIMEOUT` for the dispatch, the task's own timeout
  (now `SCAN_TIMEOUT`) for the scan it enqueues.
- The watcher's `schedule_rescan` helper enqueues on the scan queue with
  the abandoned-job callback.
- `PeriodicTask.func` is gone from master, so the scheduled rescan declares
  only its timeout. `tasks.registry.enqueue_scheduled_scan` joins the func
  paths an RQ worker has to be able to import.
- The job stubs shared by the discovery tests grew the scan queue and a
  scoped-scan job; the duplicated stale-sweep tests are master's.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 12:16:44 -04:00
Georges-Antoine Assi
32f9e338e7 Merge pull request #4274 from sdornan/claude/rq-native-scheduler
refactor(tasks): schedule with RQ instead of rq-scheduler
2026-09-03 11:50:20 -04:00
Georges-Antoine Assi
787bbba2b4 refactor(tasks): give every enqueue one home
Scheduling moved onto RQ, which left the task catalog with two identity
schemes: the registry key a job payload now carries, and the dotted func
path each PeriodicTask still declared. Nothing read the latter, so it is
gone, along with the test that guarded paths no payload names.

Four sites built the same enqueue by hand and had already drifted: the
startup backfills passed the global timeout and no result_ttl, so an
auto-enqueued conversion fell out of the task list after RQ's default
500s while the same task triggered by an admin lived for TASK_RESULT_TTL.
They now go through enqueue_task, which derives timeout, ttl and meta
from the task itself.

Scan discovery paid a Redis round trip per queued job to re-read a status
the fetch already carried, and the stale sweep read every delayed job to
find the few past due. Both now ask Redis once.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 21:03:30 -04:00
Georges-Antoine Assi
bcafc3d504 refactor(scan): tighten the sigil title id plumbing
Rename embedding now goes through the handler's own rename primitive
(`rename_fs_rom`), so it inherits the library-root path validation and
per-path locking every other write in that class gets, and builds the new
name with the repo's multi-part extension helpers.

Extraction no longer reads files it can never parse: archives, manuals,
soundtracks and screenshots are skipped, and on non-Switch platforms it
stops after the first result, since only Switch looks at a per-file
content type.

Also collapses the two rom-level branches (dropping a closure), gives the
Switch family one home in RomM's own terms instead of deriving it from
sigil's slug string, logs an unrecognized save target layout instead of
dropping it silently, deletes the `ScannedFSRomValues` mirror of `FSRom`,
drops a dead `rom.version` locale key, and slims the sigil Docker builds
to one layer with a filtered clone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 16:34:36 -04:00
Sam Dornan
3593d2398a perf(scan): give scans their own queue and worker
A library scan runs for hours on the same worker as everything else, so
every cleanup, conversion and metadata refresh waited behind it. Scans go
on a queue of their own, consumed by a second worker, and the queues that
serve the rest of the app keep moving while a scan runs.

One worker on one queue also makes "one scan at a time" structural rather
than something the socket handler has to enforce, and it leaves another
worker running to notice when the scan worker dies.

Which is what the second half of this does. A worker killed mid-scan
never reaches the handler that reports the scan ended, so clients kept
showing a scan that no longer existed. RQ hands an abandoned job to its
failure callback when a surviving worker reaps it, so scans carry one
that emits `scan:done_ko`. Only for AbandonedJobError: every other
failure is already reported by the scan as it unwinds, and emitting here
too would report it twice. The scheduled rescan is not covered, because
rq cron cannot attach callbacks.

Scan discovery still reads the other queues, so a scan enqueued before
this change is still found and still runs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-02 15:02:16 -05:00
Sam Dornan
4e3ca0611f fix(docker): read REDIS_SSL as the boolean the app reads it as
The shell built the connection URL with `redis${REDIS_SSL:+s}`, which
only asks whether the variable is set. `env.template` ships
`REDIS_SSL=false`, so following the documented value pointed the worker
at `rediss://` while the app parsed the same variable through
`safe_str_to_bool` and connected in plaintext. Adding the cron process
put a second process behind it.

Parse the value in both entrypoints, matching the truthy set the app
accepts.

Also clear the old scheduler's lock and instance keys even when its
registry held no jobs: a scheduler that never queued anything still
registered itself, and only the orphan-job work needs the registry.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-02 15:02:04 -05:00
Sam Dornan
4e59217275 refactor(tasks): schedule with RQ instead of rq-scheduler
rq-scheduler has one release since 2023, 109 open issues, and RomM ran a
fork of it for Redis username and SSL options that upstream never took.
Everything it was here for now ships with RQ.

Its two failure modes were the reason for the workarounds in 9e9f59c04.
It reads a job's function name before taking the job out of its registry,
so one unreadable job stalls it for good; RQ's scheduler removes every id
it looked at whether or not the job could be read. And cancelling a
delayed job needed both `Scheduler.cancel` and `Job.cancel`, because the
first left the status alone and the second left the registry entry, which
the scheduler then queued anyway; `Job.cancel` on its own now clears the
scheduled registry.

Delayed jobs, which is how the watcher defers a rescan, go onto the queue
with `Queue.enqueue_in` and are released by the worker running with
`--with-scheduler`. Periodic tasks are declared in `tasks/cron_config.py`
and loaded by an `rq cron` process, replacing `rqscheduler`. A task is
registered only when it is enabled and has a cron string, so the
schedule-then-unschedule dance around the env toggles is gone, and with
it `PeriodicTask.init/schedule/unschedule`.

Jobs are enqueued by task name through `run_task_by_name`, resolved
against a catalog in `tasks/registry.py`. Nothing pickles a task instance
into Redis any more, which is what made a payload unreadable across
upgrades in the first place. The catalog also gives the tasks endpoint
one home for what a task is, rather than a list of its own.

Scan discovery keys off the type a job carries rather than the scheduled
rescan's function name, since every task now shares one entry point. That
also drops SCAN_LIBRARY_TASK_FUNC, which only existed to name a function
across an import cycle.

The watcher's dedupe worked on `job.args[0]` while scans are enqueued with
keyword arguments, so it never matched and every filesystem change
scheduled another scan. It reads `platform_ids` from the payload now, and
deliberately ignores a scan already running: that one may have walked past
the folder that just changed.

Startup clears what the old scheduler left in Redis, once.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-02 15:02:04 -05:00
nendo
e04b6035f2 Merge upstream master into feature/sigil-title-ids
Upstream took 0113, so the sigil migration rechains onto
0113_roms_locked_fields as 0114. The sigil build stage keeps its place
ahead of the emulator stage, which upstream renamed for js-dos.
2026-08-31 11:39:53 +09:00
Georges-Antoine Assi
025febc17f fix(nginx): keep cross-origin isolation when a player URL carries a query
$request_uri includes the query string, so the end-anchored player pattern
missed /rom/<id>/jsdos?x=1 and nginx dropped COOP and COEP, leaving the
threaded runtime without SharedArrayBuffer. Accept an optional query instead
of anchoring at the path end.

Matching stays on $request_uri: try_files rewrites $uri to /index.html before
add_header runs, so a $uri map would match no player URL at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 11:56:40 -04:00
Georges-Antoine Assi
4142fbc018 refactor: dedupe js-dos emulation checks and player plumbing
usePlatformPlayable is the platform-level twin of useCanPlay, but only the
latter learned about js-dos, so win3x/win9x games offered Play while their
platform tile showed no playable badge and sorted into the unplayable bucket.
Teach resolveEmulator about js-dos and derive `playable`/`isPlayable` from it
instead of hand-maintained OR chains.

Collapse the duplication the new backend introduced: a shared
resolvePlatformSlug in utils, a supportedBy factory for useCanPlay's three
identical computeds, one COOP/COEP nginx pattern per map, and a single
hard-navigation branch in useGameActions that reuses the canPlay useCanPlay
already returns.

In JsDos.vue, share the teardown tail between leavePlayer and onBeforeUnmount,
collapse four derivations of the route rom id into one, start the js-dos
runtime alongside the rom request rather than behind it, and hold the rom in a
shallowRef since the view only reads scalars off it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 10:20:47 -04:00
Georges-Antoine Assi
29bad62e58 chore: trim unused js-dos assets from the image
The js-dos release bundle ships a demo index.html that would be served
unauthenticated under /assets/jsdos, plus source maps, Emscripten symbol
tables and type declarations that no runtime code loads.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:57:35 -04:00
Georges-Antoine Assi
eed9549a2a Merge branch 'master' into 3143-jsdos-backend
Resolve conflicts in useCanPlay and its useGameActions tests, where master
added the has_file_on_disk gate to the play checks while this branch added
the js-dos route. Keep both: js-dos also boots from the ROM file, so it gets
the same gate as EmulatorJS and Ruffle.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:33:18 -04:00
nendo
a057c886ae feat(scan): extract PS3, Xbox and Xbox 360 title ids via sigil
sigil gained an Xbox extractor and learned to read PS3, PS Vita, Xbox 360
and Wii U out of their containers, so the three platforms it could
already name are now reachable from a scan. All three are non-hashable
or partly so, which is where a binary id earns the most: it is the only
identity those libraries carry. The extractors are flagged experimental
upstream.
2026-08-28 10:54:58 +09:00
nendo
5425a227ab Merge upstream master into feature/sigil-title-ids
Upstream took 0108 through 0110, so the four sigil migrations rechain
onto 0110_walkthrough_docs as 0111 through 0114. RomFile keeps both the
title id index and upstream's new rom_id/category composite, and
models/rom.py keeps SaveUsage alongside the new document types.
2026-08-26 19:40:48 +09:00
nendo
b9261cdea6 fix(scan): store 3DS, Wii and Wii U save ids in the emulator's case
save_id is the literal on-disk save location, and azahar, dolphin and
cemu all build those directories with lowercase hex. On case-sensitive
storage an uppercase id addressed a second directory beside the
emulator's own, so a game's saves split across the two. Sigil now emits
the path in the case the emulator writes; the pin moves with it, and
0111 recases the ids already stored so an existing library does not have
to be rescanned. title_id keeps its canonical uppercase form.
2026-08-26 19:27:15 +09:00
Sam Dornan
9e92e325f7 chore: drop review-flagged comments
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 08:11:09 -05:00
Sam Dornan
09b3c92690 fix(docker): ship valkey-cli and log watchdog restarts
The image bundles valkey but not its CLI, which Alpine packages
separately, so the internal cache cannot be inspected from inside a
running container. The watchdog also restarted dead processes silently,
hiding both the crash and whatever state died with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 16:51:41 -05:00
nendo
95f30b409c Merge upstream master into feature/sigil-title-ids
Resolve conflicts:
- rom_files/roms indexes: union the title-id index with upstream's new
  hash-search indexes.
- scan.py: keep upstream's ScreenScraper scan refactor, retaining the
  LIBRARY_BASE_PATH and UniversalPlatformSlug imports the body still uses.
- cleanup_orphaned_resources tests: take upstream's version.
- Renumber the sigil migrations onto upstream's 0107 head as 0108/0109/0110
  so the alembic chain stays single-headed.
2026-08-17 03:57:25 +09:00
nendo
0cf06f2200 Bump sigil pin for 3DS z3ds extraction fix 2026-08-17 03:21:41 +09:00
Bruno Henriques
154340d332 feat: playable Win3.x and Win9.x using js-dos 2026-08-16 18:49:49 +01:00
Georges-Antoine Assi
76efbe72fd fix(docker): keep the Redis password out of the RQ worker command line
The worker received its connection string through `rq worker --url`, which
put the password in argv for the life of the process, readable via
/proc/<pid>/cmdline, ps, and any monitoring or diagnostic tooling that
collects command lines (CWE-214).

RQ's `--url` option already reads from RQ_REDIS_URL, so passing it through
the environment instead is behavior-preserving. This matches how the RQ
scheduler alongside it already takes its credentials.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 21:24:31 -04:00
Georges-Antoine Assi
ae74f8de53 chore(docker): trim the scheduler comment
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 11:04:36 -04:00
Ryan McClelland
0ae753e4fe fix(docker): always start the RQ scheduler
The scheduler only started when one of four ENABLE_SCHEDULED_* flags was
true, but nothing else respects that condition. startup.py registers the
netplay, upload-tmp and zip-cache cleanups unconditionally, three more
flags gate periodic tasks that are absent from the list, and the
filesystem watcher defers its rescans through the scheduler as well.

Any of those leaves jobs sitting in the scheduler registry with no
process to run them. On a default install the three cleanups never fire
at all. A watcher running with none of the four listed tasks enabled
leaves a delayed scan_platforms entry that nothing will execute, and the
concurrent scan guard reads it as a scan already queued, so every manual
scan is refused with "A scan is already in progress". Restarting does not
help, because the entry is persisted state rather than a running process.

Start the scheduler unconditionally, matching entrypoint.sh, which never
gated it. A stuck entry then clears on its own, since the scheduler
enqueues past-due jobs as soon as it comes up.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 12:13:37 -07:00
nendo
158977cf69 Merge upstream master into feature/sigil-title-ids
Align cleanup_orphaned_resources tests with upstream 06cafd4b1, which made
the task schedule unconditionally: assert the default cron is set, and
clear cron_string in the unschedule-path test.
2026-07-30 20:54:22 +09:00
nendo
0c88dfdfe0 Extract 3DS save location via sigil folder-split usage
The 3DS nests its save under two directory levels, so sigil reports it as
a '/'-separated save_id (00040000/00033500) flagged with usage=folder-split
rather than a flat id. Add SaveUsage.FOLDER_SPLIT, migrate the saveusage
enum (0106), regenerate the frontend SaveUsage type, and bump the sigil
pin to 98f3c62.
2026-07-30 15:27:28 +09:00
nendo
3f91f0d20b Merge upstream master into feature/sigil-title-ids 2026-07-29 12:46:28 +09:00
Georges-Antoine Assi
7f0636aed5 Apply suggestion from @greptile-apps[bot]
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-07-28 21:26:15 -04:00
Georges-Antoine Assi
48259b3a9e fix(docker): snapshot the internal valkey hourly instead of every few minutes
The keyspace holds the Switch TitleDB and LaunchBox caches, so dump.rdb runs
to hundreds of MB (424MB on a dev instance). Valkey's stock save policy
rewrites all of it every ~5 minutes once 100 keys change, which idle RQ
bookkeeping alone triggers, for gigabytes of disk writes per hour.

Fixes #3980

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 18:41:49 -04:00
Ryan McClelland
90d1c72256 feat(tasks): allow orphaned resource cleanup to run on a schedule
Orphaned covers and screenshots left behind by deleted ROMs accumulate
indefinitely, because the only way to reclaim them is to trigger the
cleanup task by hand. On a long-lived instance the resources directory
grows without bound, which is a problem when it shares a filesystem with
the database.

Move the task to `tasks/scheduled/` and turn it into a `PeriodicTask`
with an opt-in cron schedule, defaulting to 5:00 AM so it runs after the
nightly scan and metadata tasks have settled.

`enabled` stays `True` rather than tracking the new env var, because the
run-task endpoint requires both `enabled` and `manual_run`. Gating it
would have silently removed the ability to run the cleanup by hand,
which is how it works today. The cron string is what is opt-in, and
`init()` unschedules when it is unset.

Add the new flag to the init script's scheduler condition, so enabling
only this schedule still starts `rqscheduler`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 13:53:30 -07:00
Georges-Antoine Assi
f1b49fa9c2 cleanup 2026-07-27 08:22:25 -04:00
Georges-Antoine Assi
98651ecbf8 Fix ROMM_AUTH_SECRET_KEY auto-generation under nounset
The init script runs with `set -o nounset`, so testing `${ROMM_AUTH_SECRET_KEY}`
aborted with "unbound variable" before reaching the generation branch, leaving
the container in a restart loop. This only triggered when the variable was
omitted entirely; shipping it with an empty value took the working path.

Use `${ROMM_AUTH_SECRET_KEY-}` so the unset case is testable, and warn instead
of info since a generated key changes on every restart.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 08:07:50 -04:00
nendo
6042a1c56b Merge upstream master into feature/sigil-title-ids
Re-integrate the sigil title-id feature on top of upstream's scan
reconciliation refactor and migration additions.

Scan reconciliation:
- _identify_rom now persists rom files via db_rom_handler.sync_rom_files
  instead of purge_rom_files + per-file add_rom_file. The obsolete
  RomFile copy-list (title_id/save_id/title_version) is removed; those
  fields now ride along through ROM_FILE_SCANNED_COLUMNS.
- Add title_id, save_id, title_version to ROM_FILE_SCANNED_COLUMNS so
  sync_rom_files copies them onto reconciled rows. Without this the
  extracted ids/version silently drop to NULL on rescan.
- Single-file embedding rename (renamed_rom_fs_name) preserved in both
  the new-entry and update paths of _identify_rom.

Migrations renumbered to chain after the new upstream head:
- 0102_sigil_title_ids -> 0104_sigil_title_ids (down: 0103_roms_facets_provider_ids)
- 0103_sigil_title_version -> 0105_sigil_title_version (down: 0104_sigil_title_ids)

Tests:
- Reworked TestIdentifyRomPersistsFileTitleVersion to capture
  sync_rom_files and assert the scanned RomFile carries title_id and
  title_version; added a direct assertion that ROM_FILE_SCANNED_COLUMNS
  includes the sigil columns.
2026-07-24 07:20:10 +09:00
nendo
fe0b4de169 Bump sigil pin for Switch CNMT content type and version 2026-07-24 05:20:09 +09:00
nendo
c90260500e Bump sigil pin for PS2 folder-prefix save_id 2026-07-24 04:23:41 +09:00
nendo
8fa9bc53e4 Bump sigil pin for the Linux large-CHD fix 2026-07-24 03:45:00 +09:00
nendo
2f1d69f834 Build sigil into Docker images as an optional dependency
docker/Dockerfile gains a sigil-build stage (python:3.13-alpine base so
the cffi extension matches the venv's cp313/musl ABI) whose staged
package is copied into the slim image's site-packages; the Ubuntu dev
image builds it inline after uv sync. Pinned by commit ARG. The
backend treats the package as optional, so images built without it
simply skip extraction. DEVELOPER_SETUP documents the optional local
build.
2026-07-24 02:54:37 +09:00
Georges-Antoine Assi
5edf6bc4f7 Merge pull request #3892 from Spinnich/fix/asset-cache-headers
fix(nginx): cache only fingerprinted assets, revalidate the rest
2026-07-23 08:17:29 -04:00
Georges-Antoine Assi
c70f7d1df3 cleanup 2026-07-23 08:06:42 -04:00
Georges-Antoine Assi
dfc4f6a6f5 fix(archives): end bsdtar options before the member argument
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 07:48:05 -04:00
Spinnich
61c3dd1e4c fix(nginx): cache only fingerprinted assets, revalidate the rest
RomM's nginx served everything under /assets, plus the root favicons and
manifest, with no Cache-Control, so browsers re-fetched or revalidated the
frontend bundle and every cover image on repeat visits.

Only some of these assets are safe to cache long-term, so a blanket immutable
rule is unsafe. Cache by fingerprint instead:

- Content-hashed bundles (index-<hash>.js) and library resources that carry a
  cache-busting query (covers ?ts=, manuals ?v=) -> public, max-age=31536000,
  immutable.
- Query-less library resources (screenshots and RA badges, which reuse stable
  filenames and are overwritten on re-scrape), the bundled EmulatorJS/Ruffle
  runtimes, and other static files under /assets -> public, max-age=3600,
  must-revalidate.
- index.html and the root favicons/manifest/service worker -> no-cache, so a
  new deploy's bundles and any updated runtime are picked up at once.

The resources split is driven by an $is_args map, so a resource is frozen only
while its URL carries a busting query.

Fixes #3890

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 22:23:21 +00:00
Georges-Antoine Assi
dc981f51c8 fix(archives): read RAR archives through bsdtar so they can be hashed
The bundled 7zz is built without the RAR codec (unRAR license), so it can
neither list nor extract RAR members. Every content-based match silently
came up empty for .rar: no RetroAchievements hash and no CRC/MD5/SHA-1 for
hash-database providers.

RAR listing and extraction now go through libarchive's bsdtar, added to the
images as libarchive-tools. Listing uses an mtree rewrite (libarchive's only
machine-readable listing) and member names are escaped before being handed
back to bsdtar, which matches them as globs.

Fixes #3884

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 10:13:50 -04:00
Georges-Antoine Assi
9488ceba0e Merge pull request #3167 from tmgast/fix/mod-zip-range-requests
feat: Support Range requests for multi-file ROM downloads
2026-07-19 18:32:12 -04:00
Georges-Antoine Assi
168fb2f009 fix(docker): sync nginx upstream port with DEV_PORT
The nginx upstream was hardcoded to 127.0.0.1:5000, while gunicorn and the
readiness check bind/probe ${DEV_PORT}. With a non-default DEV_PORT the
readiness check passes but every proxied request returns 502.

nginx.conf is not run through envsubst, so move the wsgi_server upstream into
the templated default.conf.template and export DEV_PORT in the entrypoint so
the upstream port tracks the gunicorn bind.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 19:05:40 -04:00
Georges-Antoine Assi
cf1420bd5d Merge branch 'master' into fix/mod-zip-range-requests 2026-07-18 18:15:39 -04:00
Georges-Antoine Assi
0ca1eb5529 fix(docker): proxy nginx to gunicorn over TCP instead of unix socket
nginx workers are dropped to the `romm` user while gunicorn creates
/tmp/gunicorn.sock as root. This only worked because gunicorn's default
umask leaves the socket world-writable; on some hosts (e.g. OMV) the
worker cannot connect() and every /api request 502s with
"connect() to unix:/tmp/gunicorn.sock failed (13: Permission denied)".

Proxy over loopback TCP (127.0.0.1:5000), which gunicorn already binds,
so there is no socket file owner/mode to mismatch. Readiness now polls
the TCP port instead of waiting for the socket file.

Fixes #3809

Generated-By: PostHog Code
Task-Id: 3cb72cda-eb77-4bc0-97ab-cde365a031c9
2026-07-18 14:44:08 -04:00