mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(sw) no auth dialog when serve by service worker
This commit is contained in:
parent
ef0a14ba63
commit
58986eb52e
1 changed files with 9 additions and 2 deletions
|
|
@ -7,7 +7,14 @@ const currify = require('currify/legacy');
|
|||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const wait = currify((f, e) => e.waitUntil(f()));
|
||||
const respondWith = currify((f, e) => e.respondWith(f(e)));
|
||||
const respondWith = currify((f, e) => {
|
||||
const {url} = e.requestl;
|
||||
|
||||
if (/\/$/.test(url) || /\^\/fs/.test(url))
|
||||
return;
|
||||
|
||||
e.respondWith(f(e));
|
||||
});
|
||||
const getPathName = (url) => new URL(url).pathname;
|
||||
|
||||
const date = codegen`module.exports = '"' + Date() + '"'`;
|
||||
|
|
@ -73,7 +80,7 @@ async function onFetch(event) {
|
|||
});
|
||||
|
||||
if (e)
|
||||
return console.error(e, response, pathname);
|
||||
return new Response(e.message);
|
||||
|
||||
if (!isGet(request) || !resp.ok || !isBasic(resp))
|
||||
return resp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue