v4.0.38 — Kobo cover preview refreshes when you change the settings (and a new gradient fill mode)
If you've been using the new "Show how each cover would look on a Kobo" preview on the cover-picker page, two bugs were getting in your way. Both are fixed in this release.
What's fixed
The previews now refresh when you change Target aspect ratio or Border fill style. Before today, flipping the dropdowns while the toggle was on left every preview stuck on whatever the previous setting rendered. Reproduced live: a closure-shared in-flight counter got corrupted when an aborted older render burst's cleanup decremented the counter belonging to the freshly-started new burst, so the next fetches looked permanently "in flight" and the visible covers never updated. Replaced with a generation counter — every refresh increments it, every fetch closes over its own generation, and completion handlers only touch the live UI when their generation is still current.
Toggling the preview on no longer freezes the rest of the app for ~10 seconds. The previous behavior fired ~36 simultaneous kobo-preview requests on toggle-on (one per candidate cover), each holding a gunicorn worker through the server-side BoundedSemaphore(4) queue. While the burst drained, login, /static/, and metadata-search routes all stalled. New client-side KOBO_MAX_CONCURRENT = 4 work queue mirrors the server's per-process Wand cap, so the burst now drains 4-at-a-time without starving anything else.
Discrete-event controls (the aspect / fill-mode dropdowns) now refresh immediately. The manual-color text input keeps the 250 ms debounce so per-keystroke fetches don't pile up.
What's new
A new gradient fill mode alongside Edge mirror, Edge blur, dominant, average, and manual. It samples the dominant color from the cover's top 10% band and bottom 10% band, then renders the pad area as a smooth top-to-bottom gradient between those two colors. The result is palette-matched to the cover without the edge-replication seams you can occasionally see with mirror or blur — covers with strong sky-over-ground or title-band-over-art compositions look great. Available in both the cover-picker page (per-book preview) and the admin Settings dropdown (global default).
How to update
docker pull ghcr.io/new-usemame/calibre-web-nextgen:latest
docker pull ghcr.io/new-usemame/calibre-web-nextgen:v4.0.38
Tests
33 unit tests cover the changes:
- 4 new JS surface tests pin the refresh wiring, generation race-safety, and the client-side concurrency cap.
- 2 new Wand round-trip tests pin gradient mode (returns a valid JPEG, hits the right output aspect ratio).
- 1 new template-surface test pins the new
gradientoption in the picker dropdown.
Pre-existing 26 tests around the picker, padding pipeline, and template surface still pass.