mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 07:20:02 -04:00
Merge branch 'main' of https://github.com/MercuryWorkshop/aerojet
This commit is contained in:
commit
3d30e20150
7 changed files with 1637 additions and 3469 deletions
|
@ -27,7 +27,7 @@
|
|||
"@fastify/static": "^7.0.3",
|
||||
"@mercuryworkshop/bare-as-module3": "^2.2.2",
|
||||
"@mercuryworkshop/epoxy-transport": "^2.1.3",
|
||||
"@mercuryworkshop/libcurl-transport": "^1.3.6",
|
||||
"@mercuryworkshop/libcurl-transport": "^1.3.7",
|
||||
"@rsdoctor/rspack-plugin": "^0.3.7",
|
||||
"@rspack/cli": "^0.7.5",
|
||||
"@rspack/core": "^0.7.5",
|
||||
|
@ -56,6 +56,7 @@
|
|||
"domutils": "^3.1.0",
|
||||
"htmlparser2": "^9.1.0",
|
||||
"meriyah": "^4.4.2",
|
||||
"parse-domain": "^8.0.2"
|
||||
"parse-domain": "^8.0.2",
|
||||
"wisp-server-node": "^1.1.1"
|
||||
}
|
||||
}
|
||||
|
|
4998
pnpm-lock.yaml
generated
4998
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
@ -6,6 +6,7 @@ import fastifyStatic from "@fastify/static";
|
|||
import { join } from "node:path";
|
||||
import { spawn } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import wisp from "wisp-server-node";
|
||||
|
||||
//transports
|
||||
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
|
||||
|
@ -32,7 +33,7 @@ const fastify = Fastify({
|
|||
if (bare.shouldRoute(req)) {
|
||||
bare.routeUpgrade(req, socket, head);
|
||||
} else {
|
||||
socket.end();
|
||||
wisp.routeRequest(req, socket, head);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -72,7 +73,7 @@ fastify.listen({
|
|||
host: "0.0.0.0",
|
||||
});
|
||||
|
||||
writeFileSync(".git/hooks/pre-commit", "pnpm prettier . -w");
|
||||
writeFileSync(".git/hooks/pre-commit", "pnpm prettier . -w\ngit add -A");
|
||||
chmodSync(".git/hooks/pre-commit", 0o755);
|
||||
|
||||
const watch = spawn("pnpm", ["rspack", "-w"], {
|
||||
|
|
|
@ -68,17 +68,17 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, {
|
|||
case "getItem":
|
||||
return (key: string) => {
|
||||
return target.getItem(locationProxy.host + "@" + key);
|
||||
}
|
||||
};
|
||||
|
||||
case "setItem":
|
||||
return (key: string, value: string) => {
|
||||
target.setItem(locationProxy.host + "@" + key, value);
|
||||
}
|
||||
};
|
||||
|
||||
case "removeItem":
|
||||
return (key: string) => {
|
||||
target.removeItem(locationProxy.host + "@" + key);
|
||||
}
|
||||
};
|
||||
|
||||
case "clear":
|
||||
return () => {
|
||||
|
@ -87,14 +87,16 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, {
|
|||
target.removeItem(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
case "key":
|
||||
return (index: number) => {
|
||||
const keys = Object.keys(target).filter((key) => key.startsWith(locationProxy.host));
|
||||
const keys = Object.keys(target).filter((key) =>
|
||||
key.startsWith(locationProxy.host)
|
||||
);
|
||||
|
||||
return target.getItem(keys[index]);
|
||||
}
|
||||
};
|
||||
|
||||
case "length":
|
||||
return target.length;
|
||||
|
@ -109,7 +111,10 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, {
|
|||
},
|
||||
|
||||
defineProperty(target, property, attributes) {
|
||||
target.setItem(locationProxy.host + "@" + (property as string), attributes.value);
|
||||
target.setItem(
|
||||
locationProxy.host + "@" + (property as string),
|
||||
attributes.value
|
||||
);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
|
|
@ -37,7 +37,10 @@ export function rewriteHeaders(rawHeaders: BareHeaders, origin?: URL) {
|
|||
|
||||
urlHeaders.forEach((header) => {
|
||||
if (headers[header])
|
||||
headers[header] = encodeUrl(headers[header] as string, origin);
|
||||
headers[header] = encodeUrl(
|
||||
headers[header]?.toString() as string,
|
||||
origin
|
||||
);
|
||||
});
|
||||
|
||||
if (headers["link"]) {
|
||||
|
|
|
@ -73,9 +73,7 @@ async function handleResponse(
|
|||
switch (destination) {
|
||||
case "iframe":
|
||||
case "document":
|
||||
if (
|
||||
responseHeaders["content-type"]?.toString()?.startsWith("text/html")
|
||||
) {
|
||||
if (responseHeaders["content-type"]?.startsWith("text/html")) {
|
||||
responseBody = rewriteHtml(await response.text(), url);
|
||||
} else {
|
||||
responseBody = response.body;
|
||||
|
|
|
@ -28,7 +28,11 @@ const col = css`
|
|||
const store = $store(
|
||||
{
|
||||
url: "https://google.com",
|
||||
wispurl: "wss://wisp.mercurywork.shop/",
|
||||
wispurl:
|
||||
(location.protocol === "https:" ? "wss" : "ws") +
|
||||
"://" +
|
||||
location.host +
|
||||
"/wisp/",
|
||||
bareurl:
|
||||
(location.protocol === "https:" ? "https" : "http") +
|
||||
"://" +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue