From 49c8ecfb735c5f8d99795f84d093ccfbfaad5c8a Mon Sep 17 00:00:00 2001 From: Sami Date: Sun, 17 May 2026 02:20:36 -0700 Subject: [PATCH] fix(build): compute CSP hash on LF-normalized index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the build runs on a Windows checkout, fs.readFileSync returns the file with CRLF intact, and the hash of the inline bootstrap script's body reflects those CRLFs. The release tarball / git transport / Linux file system strip CRLF on the publishing host, so the browser sees the LF-only version and computes a different sha256. CSP then blocks the script — disabling the version widget, theme switcher, and any other DOM bindings set up in that inline block. Normalize CRLF -> LF before computing the hash (the on-disk file keeps its native line endings; only the hash input is normalized). The CSP allowlist now matches whatever Caddy actually serves. --- status/build.js | 10 +++++++++- status/index.html | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/status/build.js b/status/build.js index 4248cc9..fb9f776 100644 --- a/status/build.js +++ b/status/build.js @@ -78,7 +78,13 @@ const bundles = { function updateInlineScriptCspHash() { const html = fs.readFileSync(INDEX_HTML, 'utf8'); - const scripts = [...html.matchAll(/