|
|
@ -14,6 +14,18 @@ self.addEventListener("install", event => { |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
async function cacheFirst(request) { |
|
|
async function cacheFirst(request) { |
|
|
|
|
|
if (request.url.includes('/-/frame')) { |
|
|
|
|
|
const url = new URL(request.url) |
|
|
|
|
|
if (url.pathname === '/-/frame') { |
|
|
|
|
|
const {html, csp} = url.searchParams |
|
|
|
|
|
return new Response(html, { |
|
|
|
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'text/html', |
|
|
|
|
|
'Content-Security-Policy': csp, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
const resp = await caches.match(request) |
|
|
const resp = await caches.match(request) |
|
|
if (resp) { |
|
|
if (resp) { |
|
|
return resp |
|
|
return resp |
|
|
|