fix: resolve CSP and service worker asset errors

Allow posimai-ui base script under CSP, permit unpkg source map fetches, and make SW precache resilient while adding the missing logo asset to prevent install/runtime errors.

Made-with: Cursor
This commit is contained in:
posimai 2026-04-23 18:25:33 +09:00
parent bf2d407741
commit 3b99291f3e
3 changed files with 6 additions and 2 deletions

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

6
sw.js
View File

@ -4,7 +4,11 @@ const STATIC = ['/', '/index.html', '/manifest.json', '/logo.png'];
self.addEventListener('install', e => {
e.waitUntil(
caches.open(CACHE).then(c => c.addAll(STATIC))
caches.open(CACHE).then(async c => {
await Promise.allSettled(
STATIC.map(path => c.add(path))
);
})
);
self.skipWaiting();
});

View File

@ -30,7 +30,7 @@
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' 'unsafe-inline' https://unpkg.com https://cdn.jsdelivr.net https://esm.sh; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com https://posimai-ui.vercel.app; font-src 'self' data: https://fonts.gstatic.com; img-src 'self' data: https:; media-src 'self' https:; connect-src 'self' https://api.soar-enrich.com wss://api.soar-enrich.com; worker-src 'self'; frame-ancestors 'none';"
"value": "default-src 'self'; script-src 'self' 'unsafe-inline' https://unpkg.com https://cdn.jsdelivr.net https://esm.sh https://posimai-ui.vercel.app; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com https://posimai-ui.vercel.app; font-src 'self' data: https://fonts.gstatic.com; img-src 'self' data: https:; media-src 'self' https:; connect-src 'self' https://api.soar-enrich.com wss://api.soar-enrich.com https://unpkg.com; worker-src 'self'; frame-ancestors 'none';"
},
{
"key": "Strict-Transport-Security",