don't mess with splitbee requests

This commit is contained in:
m5r 2022-06-27 14:44:52 +02:00
parent c48bf58784
commit 06f0078dfd

View File

@ -30,11 +30,11 @@ self.addEventListener("message", (event) => {
}); });
self.addEventListener("fetch", (event) => { self.addEventListener("fetch", (event) => {
const url = new URL(event.request.url);
const isSSERequest = event.request.headers.get("Accept") === "text/event-stream"; const isSSERequest = event.request.headers.get("Accept") === "text/event-stream";
const isOutsideRequest = !["localhost", "dev.shellphone.app", "www.shellphone.app"].includes( const isOutsideRequest = !["localhost", "dev.shellphone.app", "www.shellphone.app"].includes(url.hostname);
new URL(event.request.url).hostname, const isSplitbeeProxiedRequest = url.pathname.startsWith("/_hive") || url.pathname === "/bee.js";
); if (isSSERequest || isOutsideRequest || isSplitbeeProxiedRequest) {
if (isSSERequest || isOutsideRequest) {
return; return;
} }