Fix CSP blocking the service worker registration and tag colors

script-src 'self' blocks any inline <script> block outright, which would
have silently broken the service-worker registration snippet in base.html
in production — the exact feature this whole project exists to support.
Moved it to static/js/register-sw.js, loaded via <script src>, so script-src
can stay strict with no 'unsafe-inline' exception. style-src needed
'unsafe-inline' regardless, since tag pills set a per-tag color via a
dynamic inline style attribute.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-30 20:11:55 -06:00
1 parent 3f6474ce94
commit 4c20558525
4 files changed
+13 -9

No files matched your search

+1 -1
View File
@@ -59,5 +59,5 @@ def test_base_template_links_manifest_and_registers_service_worker(client, djang
content = response.content.decode()
assert 'rel="manifest"' in content
assert "serviceWorker" in content
assert "register-sw.js" in content
assert "apple-touch-icon" in content