mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -04:00
header flattening
This commit is contained in:
parent
a94cf9dd6a
commit
d0df4a8357
2 changed files with 18 additions and 11 deletions
|
@ -70,11 +70,16 @@ self.ScramjetServiceWorker = class ScramjetServiceWorker {
|
|||
}
|
||||
}
|
||||
|
||||
for (let header in responseHeaders) {
|
||||
// flatten everything past here
|
||||
if (responseHeaders[header] instanceof Array) responseHeaders[header] = responseHeaders[header][0];
|
||||
}
|
||||
|
||||
if (response.body) {
|
||||
switch (request.destination) {
|
||||
case "iframe":
|
||||
case "document":
|
||||
if (responseHeaders["content-type"].toString().startsWith("text/html")) {
|
||||
if (responseHeaders["content-type"]?.toString()?.startsWith("text/html")) {
|
||||
responseBody = rewriteHtml(await response.text(), url);
|
||||
} else {
|
||||
responseBody = response.body;
|
||||
|
|
20
static/ui.js
20
static/ui.js
|
@ -1,18 +1,20 @@
|
|||
navigator.serviceWorker.register("./sw.js", {
|
||||
scope: $scramjet.config.prefix
|
||||
})
|
||||
scope: $scramjet.config.prefix
|
||||
}).then((reg) => {
|
||||
reg.update();
|
||||
});
|
||||
const connection = new BareMux.BareMuxConnection("/baremux/worker.js")
|
||||
const flex = css`display: flex;`;
|
||||
const col = css`flex-direction: column;`;
|
||||
const store = $store({
|
||||
url: "https://google.com",
|
||||
wispurl: "wss://wisp.mercurywork.shop/",
|
||||
bareurl: (location.protocol === "https:" ? "https" : "http") + "://" + location.host + "/bare/",
|
||||
url: "https://google.com",
|
||||
wispurl: "wss://wisp.mercurywork.shop/",
|
||||
bareurl: (location.protocol === "https:" ? "https" : "http") + "://" + location.host + "/bare/",
|
||||
}, { ident: "settings", backing: "localstorage", autosave: "auto" });
|
||||
connection.setTransport("/baremod/index.mjs", [store.bareurl])
|
||||
function App() {
|
||||
this.urlencoded = "";
|
||||
this.css = `
|
||||
this.urlencoded = "";
|
||||
this.css = `
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #e0def4;
|
||||
|
@ -71,7 +73,7 @@ function App() {
|
|||
}
|
||||
`;
|
||||
|
||||
return html`
|
||||
return html`
|
||||
<div>
|
||||
<h1>Percury Unblocker</h1>
|
||||
<p>surf the unblocked and mostly buggy web</p>
|
||||
|
@ -95,5 +97,5 @@ function App() {
|
|||
}
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
document.body.appendChild(h(App))
|
||||
document.body.appendChild(h(App))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue