fix(pwa): move inline SW registration script to external file to satisfy CSP
CI / Build & Test (push) Successful in 2m56s
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:
@@ -1295,10 +1295,6 @@
|
||||
<script src="core/init.js"></script>
|
||||
|
||||
<!-- PWA service worker registration (required for installability) -->
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('sw.js').catch(() => {});
|
||||
}
|
||||
</script>
|
||||
<script src="register-sw.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Registers the PWA service worker required for installability.
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('sw.js').catch(() => {});
|
||||
}
|
||||
@@ -55,6 +55,7 @@
|
||||
"dashboard/dashboard.html",
|
||||
"dashboard/manifest.webmanifest",
|
||||
"dashboard/sw.js",
|
||||
"dashboard/register-sw.js",
|
||||
"dashboard/screenshots/*.png",
|
||||
"dashboard/dashboard.css",
|
||||
"dashboard/data/*.js",
|
||||
|
||||
Reference in New Issue
Block a user