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>
|
<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>
|
||||||
|
|||||||
@@ -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/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",
|
||||||
|
|||||||
Reference in New Issue
Block a user