This commit is contained in:
MotorTruck1221 2025-05-05 00:16:07 -06:00
parent 44a42117f3
commit e53b28f777
No known key found for this signature in database
GPG key ID: 08F417E2B8B61EA4
3 changed files with 26 additions and 21 deletions

View file

@ -11,7 +11,8 @@
"build": "npm run build:server & npm run build:client", "build": "npm run build:server & npm run build:client",
"start": "node server/index.js", "start": "node server/index.js",
"bstart": "npm run build && npm run start", "bstart": "npm run build && npm run start",
"astro": "astro" "astro": "astro",
"format": "biome format --write ."
}, },
"dependencies": { "dependencies": {
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.4",

View file

@ -1,4 +1,10 @@
import Fastify, { FastifyReply, FastifyRequest, FastifyServerFactory, FastifyServerFactoryHandler, RawServerDefault } from "fastify"; import Fastify, {
FastifyReply,
FastifyRequest,
FastifyServerFactory,
FastifyServerFactoryHandler,
RawServerDefault
} from "fastify";
import fastifyMiddie from "@fastify/middie"; import fastifyMiddie from "@fastify/middie";
import fastifyStatic from "@fastify/static"; import fastifyStatic from "@fastify/static";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
@ -9,17 +15,19 @@ import { handler as astroHandler } from "../dist/server/entry.mjs";
import { createServer } from "node:http"; import { createServer } from "node:http";
import { Socket } from "node:net"; import { Socket } from "node:net";
const serverFactory: FastifyServerFactory = ( handler: FastifyServerFactoryHandler): RawServerDefault => { const serverFactory: FastifyServerFactory = (
handler: FastifyServerFactoryHandler
): RawServerDefault => {
return createServer() return createServer()
.on('request', (req, res) => { .on("request", (req, res) => {
handler(req, res); handler(req, res);
}) })
.on('upgrade', (req, socket, head) => { .on("upgrade", (req, socket, head) => {
if (req.url?.endsWith('/wisp/')) { if (req.url?.endsWith("/wisp/")) {
wisp.routeRequest(req, socket as Socket, head); wisp.routeRequest(req, socket as Socket, head);
} }
}) });
} };
const app = Fastify({ const app = Fastify({
logger: false, logger: false,

View file

@ -8,15 +8,11 @@ import Header from "@components/Header.astro";
import "@styles/global.css"; import "@styles/global.css";
import "@styles/default.css"; import "@styles/default.css";
readdir( readdir(pathJoin("src", "styles", "themes"), { encoding: "utf-8" }, (err, files) => {
pathJoin("src", "styles", "themes"),
{ encoding: "utf-8" },
(err, files) => {
files.forEach(async (name) => { files.forEach(async (name) => {
await import(`../styles/themes/${name.replace(".css", "")}.css`); await import(`../styles/themes/${name.replace(".css", "")}.css`);
}); });
} });
);
--- ---
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">