From 6d01bd7971e404f616382e2b2e0bbb104e229dbd Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 25 Oct 2026 17:39:30 -0400 Subject: [PATCH] fix(web): convert remaining JS-global bindings for the CSP build; drop unsafe-eval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The strict CSP sweep surfaced a final class of bindings on the audio reader and book detail pages that referenced browser globals (Number, String, Math, window, document) — identifiers the CSP-safe evaluator resolves only from component scope: - audio reader: scrub input, volume slider/input, speed+skip active styles, genre tick styles, and the default-speed select now route through component methods (onScrubInput, setVolumeFromEvent, applyDefaultSpeedFromSelect, volumeLabel, railTickStyle, isSkipActive, isSpeedActive, isDefaultSpeed) - book detail: cover-upload click and banner edit validation moved to component methods (triggerCoverUpload, bannerEditHasText) - admin: Refresh-to-View-Books reload moved to reloadPage() - reader: note edit validation moved to noteEditHasText() CSP header: frame-src 'self' blob: (foliate renders book content in a blob: frame) and blob: on font-src/img-src (EPUB-embedded fonts and images load as blob: URLs inside that frame). 'unsafe-eval' is gone: script-src is 'self' plus 'unsafe-inline' for the pre-paint theme flash guard. Also: header openPanel promoted to the root component (one open panel across all sidebar panels, persisted in init), with the sidebar shell reduced to themeMode state + methods; fmtTime restored to the audioReader component (ripped by the unexport pass — time displays were dead on the audio reader). --- internal/middleware/security_headers.go | 4 +++- templates/reader.templ | 6 +++--- web/src/reader/reader.ts | 9 +++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/internal/middleware/security_headers.go b/internal/middleware/security_headers.go index b68dcefd..48b38d89 100644 --- a/internal/middleware/security_headers.go +++ b/internal/middleware/security_headers.go @@ -17,7 +17,9 @@ func SecurityHeadersMiddleware() echo.MiddlewareFunc { // theme flash guard (inline