diff --git a/sw.js b/sw.js index c62e616..cc7ef6f 100644 --- a/sw.js +++ b/sw.js @@ -14,6 +14,18 @@ self.addEventListener("install", event => { }) 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) if (resp) { return resp