Skip to content

Commit

Permalink
fix scramjet playground
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Nov 18, 2024
1 parent f0ee177 commit 7d15d84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 1 addition & 8 deletions src/worker/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ export async function handleFetch(
method: ev.method,
body: ev.body,
headers: ev.requestHeaders,
credentials: "omit",
mode: request.mode === "cors" ? request.mode : "same-origin",
cache: request.cache,
redirect: "manual",
//@ts-ignore why the fuck is this not typed mircosoft
duplex: "half",
}));

return await handleResponse(
Expand Down Expand Up @@ -323,8 +317,7 @@ async function rewriteBody(
return response.body;
}
case "script":
// @ts-ignore perc idk why
return rewriteJs(await response.arrayBuffer(), response.finalURL, meta);
return rewriteJs(await response.arrayBuffer(), response.url, meta);
case "style":
return rewriteCss(await response.text(), meta);
case "sharedworker":
Expand Down
7 changes: 4 additions & 3 deletions static/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ scramjet.addEventListener("request", (e) => {
} else {
return;
}

e.response.rawHeaders = headers;
e.response.finalURL = e.url;
if (playgroundData) {
e.response.rawHeaders = headers;
e.response.finalURL = e.url;
}
});

0 comments on commit 7d15d84

Please sign in to comment.