mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -04:00
add built in wisp server
This commit is contained in:
parent
084f2cd789
commit
3ced0defc4
4 changed files with 1611 additions and 3453 deletions
|
@ -56,6 +56,7 @@
|
||||||
"domutils": "^3.1.0",
|
"domutils": "^3.1.0",
|
||||||
"htmlparser2": "^9.1.0",
|
"htmlparser2": "^9.1.0",
|
||||||
"meriyah": "^4.4.2",
|
"meriyah": "^4.4.2",
|
||||||
"parse-domain": "^8.0.2"
|
"parse-domain": "^8.0.2",
|
||||||
|
"wisp-server-node": "^1.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5056
pnpm-lock.yaml
generated
5056
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 { join } from "node:path";
|
||||||
import { spawn } from "node:child_process";
|
import { spawn } from "node:child_process";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
import wisp from "wisp-server-node";
|
||||||
|
|
||||||
//transports
|
//transports
|
||||||
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
|
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
|
||||||
|
@ -32,7 +33,7 @@ const fastify = Fastify({
|
||||||
if (bare.shouldRoute(req)) {
|
if (bare.shouldRoute(req)) {
|
||||||
bare.routeUpgrade(req, socket, head);
|
bare.routeUpgrade(req, socket, head);
|
||||||
} else {
|
} else {
|
||||||
socket.end();
|
wisp.routeRequest(req, socket, head);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,7 +28,7 @@ const col = css`
|
||||||
const store = $store(
|
const store = $store(
|
||||||
{
|
{
|
||||||
url: "https://google.com",
|
url: "https://google.com",
|
||||||
wispurl: "wss://wisp.mercurywork.shop/",
|
wispurl: (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/",
|
||||||
bareurl:
|
bareurl:
|
||||||
(location.protocol === "https:" ? "https" : "http") +
|
(location.protocol === "https:" ? "https" : "http") +
|
||||||
"://" +
|
"://" +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue