full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -2,17 +2,7 @@ import { Http2ServerResponse } from "node:http2";
import { Readable } from "node:stream";
import { getSetCookiesFromResponse } from "../core/cookies/index.js";
import { getViteErrorPayload } from "../core/errors/dev/index.js";
import notFoundTemplate from "../template/4xx.js";
async function handle404Response(origin, req, res) {
const pathname = decodeURI(new URL(origin + req.url).pathname);
const html = notFoundTemplate({
statusCode: 404,
title: "Not found",
tabTitle: "404: Not Found",
pathname
});
writeHtmlResponse(res, 404, html);
}
import { redirectTemplate } from "../core/routing/3xx.js";
async function handle500Response(loader, res, err) {
res.on(
"close",
@@ -31,7 +21,21 @@ async function handle500Response(loader, res, err) {
}
function writeHtmlResponse(res, statusCode, html) {
res.writeHead(statusCode, {
"Content-Type": "text/html; charset=utf-8",
"Content-Type": "text/html",
"Content-Length": Buffer.byteLength(html, "utf-8")
});
res.write(html);
res.end();
}
function writeRedirectResponse(res, statusCode, location) {
const html = redirectTemplate({
status: statusCode,
absoluteLocation: location,
relativeLocation: location
});
res.writeHead(statusCode, {
Location: location,
"Content-Type": "text/html",
"Content-Length": Buffer.byteLength(html, "utf-8")
});
res.write(html);
@@ -84,9 +88,9 @@ async function writeSSRResult(webRequest, webResponse, res) {
return writeWebResponse(res, webResponse);
}
export {
handle404Response,
handle500Response,
writeHtmlResponse,
writeRedirectResponse,
writeSSRResult,
writeWebResponse
};