From 860aeb031a95e5f7265fc6b33d8b1498e54fd33c Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Thu, 9 Jul 2026 07:35:44 -0600 Subject: [PATCH] adding hashing script for safer inline --- README.md | 1 + csp-hash.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 csp-hash.py diff --git a/README.md b/README.md index 8f617f7..64b6eb5 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ and no external requests — the page is fully self-contained. | `app.css` / `app.js` | Human-readable, unminified source of the styles/script that are inlined into `index.html`. Edit these, then re-minify and re-inline into `index.html` when publishing a change. | | `data/charmap.json` | The full character → Gen 1 byte value → species lookup table, generated from the source spreadsheet. Source of truth for `app.js`'s inlined data. | | `data/charmap.min.json` | Minified copy of the same table. | +| `csp-hash.py` | Prints the `sha256-...` CSP tokens for `index.html`'s inline `", html, re.S) +script_match = re.search(r"", html, re.S) + +if not style_match or not script_match: + raise SystemExit("Couldn't find both an inline