fix(pwa): move inline SW registration script to external file to satisfy CSP
CI / Build & Test (push) Successful in 2m56s

The inline <script> for service worker registration was blocked by the
extension's script-src 'self' Content Security Policy. Extracted it to
register-sw.js and replaced the inline block with a <script src>.
Added register-sw.js to web_accessible_resources.
This commit is contained in:
Raven Scott
2026-03-01 02:30:00 -05:00
parent 5e40b14a91
commit d587441cf5
3 changed files with 6 additions and 5 deletions
+1 -5
View File
@@ -1295,10 +1295,6 @@
<script src="core/init.js"></script> <script src="core/init.js"></script>
<!-- PWA service worker registration (required for installability) --> <!-- PWA service worker registration (required for installability) -->
<script> <script src="register-sw.js"></script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js').catch(() => {});
}
</script>
</body> </body>
</html> </html>
+4
View File
@@ -0,0 +1,4 @@
// Registers the PWA service worker required for installability.
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js').catch(() => {});
}
+1
View File
@@ -55,6 +55,7 @@
"dashboard/dashboard.html", "dashboard/dashboard.html",
"dashboard/manifest.webmanifest", "dashboard/manifest.webmanifest",
"dashboard/sw.js", "dashboard/sw.js",
"dashboard/register-sw.js",
"dashboard/screenshots/*.png", "dashboard/screenshots/*.png",
"dashboard/dashboard.css", "dashboard/dashboard.css",
"dashboard/data/*.js", "dashboard/data/*.js",