v4.0.20 — cover-picker visibility + image-fetch fix
Suggested release title:
v4.0.20 — fix cover-picker dark theme + unblock external covers
Release body
A focused patch on top of v4.0.19's cover-picker. Three issues that only surfaced after end-to-end browser-driving the deployed instance under the caliBlur dark theme — none of them showed up in unit tests because they're rendering-environment-specific. If you tried v4.0.19 and the cover-picker page looked broken or empty, this fixes it.
Get it
docker pull ghcr.io/new-usemame/calibre-web-nextgen:v4.0.20
Same volume layout as v4.0.19; no migration.
Fixes
-
CSP was blocking every external cover URL on the new picker page. The
img-src *exception incps/web.pywas scoped only to the existing edit-metadata modal endpoint. The new/book/<id>/coverpage wasn't on the list, so all 14 providers' covers (Apple Books, Hardcover, Amazon image CDN, OpenLibrary, Kobo, Douban, etc.) were CSP-blocked at browser load time. Only the embedded-cover candidate (adata:URL) rendered. Picker grid now fully populates. -
Picker CSS was light-theme-only — invisible on caliBlur. The fork's caliBlur theme adds
class="blur"to<body>and uses a dark background with near-white body text. The picker styled cards / panels with hardcoded light colors, and text inside those cards inherited body's near-white color → titles, panel summaries, "Lock cover" label, help text, candidate metadata all rendered as white-on-white. Rewrotecover_picker.cssto flow every color through CSS custom properties scoped to.cwa-cover-picker, withbody.bluroverriding to a dark variant. Same approach applied to the inline cover-URL preview block on the edit-metadata page. -
URL preview always returned "Could not reach that URL".
cover_url_validator.validate_cover_urlwas callingcw_advocate.head(...), but that vendored library only exportsrequest,get,post, etc. — there is no top-levelhead. TheAttributeErrorgot caught by a genericexceptand surfaced asunreachable, so even known-good URLs failed validation. Switched tocw_advocate.request("HEAD", ...). Live: pastinghttps://m.media-amazon.com/images/P/1853260010.01._SCRM_SL2000_.jpgnow returns1300×2000 · 359 KB · image/jpegwith the preview thumbnail shown inline.
Also
- Candidate cards whose images fail to load (network 4xx, anti-scraping HTTP 418 from Douban, etc.) now show a labeled "Cover not reachable" placeholder instead of leaving an empty white box. Failed candidates remain pickable.
- A previous successful URL-preview's "Use this cover" action no longer lingers when the user types a worse URL afterwards.
Validation
End-to-end driven through a real browser against the deployed instance under the caliBlur theme: 67 candidate covers render, panel summaries readable, lock toggle visible, API-keys panel readable with "Configured"/"Not configured" labels and Save buttons. 14 unit tests for the URL validator still pass.