mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-12 19:40:02 -04:00
fix font
This commit is contained in:
parent
835cb237d7
commit
fc414951d1
6 changed files with 4728 additions and 5425 deletions
|
@ -1,43 +1,33 @@
|
|||
import { createServer } from "node:http";
|
||||
import rammerhead from "@rubynetwork/rammerhead";
|
||||
import { FastifyServerFactory, FastifyServerFactoryHandler, RawServerDefault } from "fastify";
|
||||
import {
|
||||
FastifyServerFactory,
|
||||
FastifyServerFactoryHandler,
|
||||
RawServerDefault,
|
||||
} from "fastify";
|
||||
import wisp from "wisp-server-node";
|
||||
import { LOG_LEVEL, WispOptions } from "wisp-server-node/dist/Types.js";
|
||||
import { parsedDoc } from "./config.js";
|
||||
|
||||
const rh = rammerhead.createRammerhead({
|
||||
logLevel: parsedDoc.server.server.logging ? "debug" : "disabled",
|
||||
reverseProxy: parsedDoc.server.rammerhead.reverseproxy,
|
||||
disableLocalStorageSync: parsedDoc.server.rammerhead.localstorage_sync ? false : true,
|
||||
disableHttp2: parsedDoc.server.rammerhead.http2 ? false : true
|
||||
});
|
||||
|
||||
const wispOptions: WispOptions = {
|
||||
logLevel: parsedDoc.server.server.logging ? LOG_LEVEL.DEBUG : LOG_LEVEL.NONE,
|
||||
pingInterval: 30
|
||||
logLevel: parsedDoc.server.server.logging ? LOG_LEVEL.DEBUG : LOG_LEVEL.NONE,
|
||||
pingInterval: 30,
|
||||
};
|
||||
|
||||
const serverFactory: FastifyServerFactory = (
|
||||
handler: FastifyServerFactoryHandler
|
||||
handler: FastifyServerFactoryHandler
|
||||
): RawServerDefault => {
|
||||
const httpServer = createServer();
|
||||
httpServer.on("request", (req, res) => {
|
||||
if (rammerhead.shouldRouteRh(req)) {
|
||||
rammerhead.routeRhRequest(rh, req, res);
|
||||
} else {
|
||||
handler(req, res);
|
||||
}
|
||||
});
|
||||
httpServer.on("upgrade", (req, socket, head) => {
|
||||
if (rammerhead.shouldRouteRh(req)) {
|
||||
rammerhead.routeRhUpgrade(rh, req, socket, head);
|
||||
} else if (parsedDoc.server.server.wisp) {
|
||||
if (req.url?.endsWith("/wisp/")) {
|
||||
wisp.routeRequest(req, socket as any, head, wispOptions);
|
||||
}
|
||||
}
|
||||
});
|
||||
return httpServer;
|
||||
const httpServer = createServer();
|
||||
httpServer.on("request", (req, res) => {
|
||||
handler(req, res);
|
||||
});
|
||||
httpServer.on("upgrade", (req, socket, head) => {
|
||||
if (parsedDoc.server.server.wisp) {
|
||||
if (req.url?.endsWith("/wisp/")) {
|
||||
wisp.routeRequest(req, socket as any, head, wispOptions);
|
||||
}
|
||||
}
|
||||
});
|
||||
return httpServer;
|
||||
};
|
||||
|
||||
export { serverFactory };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue