mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 10:01:00 +01:00
* feat(media): serve JPEG XL library images inline Add .jxl to the image extensions the download endpoint serves inline, with an explicit image/jxl type since mimetypes doesn't know it, and to the frontend lists that pick artwork and folder screenshots out of rom.files. AVIF was already covered; the new test pins both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * feat(media): accept JPEG XL cover uploads through a Pillow plugin Pillow 13 reads AVIF but not JPEG XL. pillow-jxl-plugin registers a JXL codec with Pillow (imported once in utils/images, which the cover and WebP-conversion code already load). It ships musllinux wheels for the image's amd64 and arm64 builds. ROM and collection artwork uploads now accept image/jxl and store it re-encoded as PNG, since covers are served in their stored format and not every browser renders JPEG XL. Avatars, stored as uploaded, keep the PNG/JPEG/WebP/GIF allowlist. The plugin is GPL-3.0, which is compatible with RomM's AGPL-3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * test(roms): expect JPEG XL in the artwork rejection message Artwork uploads now also accept JPEG XL, so the rejection message lists it. The collection tests were updated with the change; this ROM one was missed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * fix(media): list library JPEG XL images only where the browser renders them Library files are served as stored, and Chrome and Firefox render no JPEG XL, so .jxl artwork and folder screenshots showed as broken tiles there. A one-time probe decodes a 22-byte JPEG XL image and the artwork and screenshot lists only include .jxl files once it succeeds (Safari), updating reactively when the answer arrives. Chromium 153 fails the probe, so the files stay hidden there as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * fix(media): size-check JPEG XL before decoding and keep it out of screenshot uploads pillow-jxl decodes every pixel in _open(), before Pillow's decompression-bomb check sees the size, so a small, highly compressed JXL declaring a huge canvas could exhaust memory. utils/jxl reads the width and height from the codestream SizeHeader (bare or inside a container) and runs Pillow's own bomb check on them first, then registers this guarded decoder in place of the plugin's. The decoder raises RuntimeError on a corrupt file, which escaped store_artwork as a 500. The guard turns it into SyntaxError, so Pillow reports UnidentifiedImageError and the upload takes the same path as a corrupt PNG. POST /api/screenshots validated against the library inline list, so it started accepting .jxl, but the asset endpoint serves those as attachments. Screenshot uploads now use their own list without JPEG XL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * style(media): one-sentence jxl docstring and a narrowed mock call in the JXL test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * style(media): one-sentence canRenderJxl doc comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>