e
This commit is contained in:
parent
f073635f1b
commit
d8f4377558
2 changed files with 5 additions and 4 deletions
|
|
@ -43,7 +43,6 @@ class HTML extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|||
this.iterate(ast, fn, options);
|
||||
return (0,parse5__WEBPACK_IMPORTED_MODULE_1__.serialize)(ast);
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
return str;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -75,17 +75,19 @@ addEventListener('install', () => {
|
|||
});
|
||||
|
||||
|
||||
function UVServiceWorker(bare = '/bare/', options) {
|
||||
function UVServiceWorker(_bare = '/bare/', options) {
|
||||
try {
|
||||
return async function handler(event) {
|
||||
const { request } = event;
|
||||
const bare = new URL(_bare, location.href);
|
||||
|
||||
try {
|
||||
if (!request.url.startsWith(location.origin + (options.prefix || '/service/'))) {
|
||||
return fetch(request);
|
||||
};
|
||||
|
||||
const requestCtx = {
|
||||
url: bare + 'v1/',
|
||||
url: bare.href + 'v1/',
|
||||
referrer: false,
|
||||
headers: {},
|
||||
forward: headers.forward,
|
||||
|
|
@ -149,7 +151,7 @@ function UVServiceWorker(bare = '/bare/', options) {
|
|||
headers: !requestCtx.blob ? bareHeaders : requestCtx.headers,
|
||||
redirect: requestCtx.redirect,
|
||||
credentials: requestCtx.credentials,
|
||||
mode: requestCtx.mode,
|
||||
mode: location.origin !== bare.origin ? 'cors' : requestCtx.mode,
|
||||
};
|
||||
if (requestCtx.body) fetchOptions.body = requestCtx.body;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue