@dodona/papyros 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Papyros=t():e.Papyros=t()}(self,(function(){return(()=>{const e=location.hostname,t={input:""};function n(e){return new Promise((t=>setTimeout(t,e)))}return addEventListener("fetch",(function(s){const o=s.request.url;let i;console.log("Fetch event to url: ",o),o.includes(e)?o.includes("__papyros_input")?"GET"===s.request.method?i=async function(){for(;!t.input;)await n(1e3);const e=Promise.resolve(new Response(t.input));return t.input="",e}():"POST"===s.request.method&&(i=s.request.json().then((e=>(t.input=e.input,new Response("input stored: "+t.input))))):i=fetch(s.request).then((e=>{const t=new Headers(e.headers);return t.set("Cross-Origin-Embedder-Policy","require-corp"),t.set("Cross-Origin-Opener-Policy","same-origin"),new Response(e.body,{status:e.status||200,statusText:e.statusText,headers:t})})):i=fetch(s.request),s.respondWith(i)})),addEventListener("install",(function(e){e.waitUntil(skipWaiting())})),addEventListener("activate",(function(e){e.waitUntil(clients.claim())})),{}})()}));
|