Skip to content

Commit

Permalink
Merge branch 'main' into ntoll-2023-11-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ntoll authored Nov 10, 2023
2 parents eb10542 + b9a736a commit 6d8af5b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/beginning-pyscript.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,4 @@ needed to build yet more interesting things of your own.

PyScript is extremely powerful, and these beginner steps only just scratch the
surface. To learn about PyScript in more depth, check out
[our user guide](user-guide.md).
[our user guide](user-guide/index.md).
28 changes: 28 additions & 0 deletions docs/mini-coi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */
/*! mini-coi - Andrea Giammarchi and contributors, licensed under MIT */
(({ document: d, navigator: { serviceWorker: s } }) => {
if (d) {
const { currentScript: c } = d;
s.register(c.src, { scope: c.getAttribute('scope') || '.' }).then(r => {
r.addEventListener('updatefound', () => location.reload());
if (r.active && !s.controller) location.reload();
});
}
else {
addEventListener('install', () => skipWaiting());
addEventListener('activate', e => e.waitUntil(clients.claim()));
addEventListener('fetch', e => {
const { request: r } = e;
if (r.cache === 'only-if-cached' && r.mode !== 'same-origin') return;
e.respondWith(fetch(r).then(r => {
const { body, status, statusText } = r;
if (!status || status > 399) return r;
const h = new Headers(r.headers);
h.set('Cross-Origin-Opener-Policy', 'same-origin');
h.set('Cross-Origin-Embedder-Policy', 'require-corp');
h.set('Cross-Origin-Resource-Policy', 'cross-origin');
return new Response(body, { status, statusText, headers: h });
}));
});
}
})(self);

0 comments on commit 6d8af5b

Please sign in to comment.