mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
fix/consistent-sibling-groups
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
257025ccd7 |
fix(downloads): keep converted copies' ETag stable so downloads resume (#5442)
Serving a cached conversion touched the copy's mtime to record demand for TTL cleanup, and nginx builds its default ETag from mtime and size, so the ETag changed on every request and Range/If-Range resumes always got a full 200. Record serves on a `.served` marker in the key dir instead; cleanup already takes the newest mtime among the dir's files, so it reads the marker and falls back to the copy's own mtime, and removes the marker with the dir. Fixes #5239 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e232a52656 |
fix(docker): boot when the container runs as a non-default UID (#5189)
* 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> |
||
|
|
819811b155 |
feat(converto): library format settings and "Download as" on the game page (#5000)
* feat(converto): integrate rom-converto for title id extraction and download conversion * feat(converto): add conversion settings UI with per-platform format policies * fix(converto): read conversion targets from the backend and translate the settings page * 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> * fix(converto): edit the cache size limits on the settings page * feat(converto): store per-file metadata read by rom-converto during scans * fix(converto): show the labels of the cache settings fields * 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 * feat(converto): library format settings and "Download as" on the game page The settings page follows the reworked backend: per-platform formats are now the library format the "Convert library" task stores matched games in ("Leave as is" keeps a platform untouched), the scan metadata, cache TTL and max-sync fields are gone, and a "Convert library now" button starts the task behind a typed confirmation, since it deletes the originals. The game's More menu offers "Download as <format>" for a single-file rom when download conversion is on, from the per-extension table `/api/config` exposes. A one-byte ranged GET asks for the format, the UI polls through 202s while it converts, then downloads it; a 406 shows an error. 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 code-review findings (pr-ready step 2) Guard the conversion settings route, add it to the user menu, ignore a non-positive Retry-After, drop duplicate Download as clicks, name the game in the persisted error, and tidy the settings page (display-name sort, useUnloadGuard, decimal cache sizes, save snapshot). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(settings): share the config alerts and save bar (pr-ready step 3) Extract ConfigFileAlerts and SettingsSaveBar from the three settings views that copied them, move ScanSettings onto useUnloadGuard, align the retry slot, and flatten downloadFormats, getDownloadFormats and the format poll loop. 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> * feat(converto): guard destructive tasks and serve download formats per rom - TaskSpec gains destructive and single_instance. The Tasks list asks for a typed confirmation before a destructive task, and POST /tasks/run answers 409 while a single-instance task is queued or running. - convert_library is both, and only runnable with ROM_CONVERTO_ENABLED. - The heartbeat reports CONVERTO.ENABLED, which hides Conversion settings from the sidebar and user menu and warns on the page. - DetailedRomSchema.download_formats lists what the caller can convert the rom's single file to, resolved by the backend's own operation table and empty for visitors who can't start a conversion. It replaces CONVERTO_DOWNLOAD_FORMATS in /api/config and the frontend's copy of the extension matching. 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> |
||
|
|
9255b44017 |
fix(converto): refuse cue sheets that reach outside their folder (#5008)
* fix(converto): refuse cue sheets that reach outside their folder rom-converto joins each cue FILE name onto the cue's folder without rejecting `..` or absolute paths, so a crafted cue made `chd compress` and `cue to-iso` pack any file the backend can read into the output. The library task already refused such cues; the on-demand download path did not. The check now lives in RomConvertoService.convert and mirrors how the CLI reads FILE lines (first to last quote). Also run the CLI from an empty private dir with an empty --config and --no-cache, so it no longer picks up .env, rom-converto.toml or its hash cache from the backend's cwd or home. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(converto): remove a sandbox made after its run was cancelled Addresses Greptile review on #5008: a run cancelled while the sandbox thread was still creating the dir never reached the cleanup, leaving the dir behind. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
640a783f3f |
feat(converto): convert the library in place and serve downloads in a requested format (#4999)
* 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> |