Update packages

This commit is contained in:
Taevas 2025-03-30 16:17:49 +02:00
parent 5e09b7ba77
commit 150b861bd3
3 changed files with 45 additions and 41 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -54,52 +54,56 @@ const servers: Server[] = ports.map((port) => Bun.serve({
tls: port !== 80 ? tls : undefined,
port,
fetch: async (req) => {
const request_url = req.url.startsWith("/") ? "https://taevas.xyz".concat(req.url) : req.url;
if (req.url.startsWith("/")) {console.log("Changed", req.url.substring(0, 100), "to", request_url.substring(0, 100));}
const url = new URL(request_url);
const parameters = url.searchParams;
// merciless sanitization
let pathname = url.pathname;
pathname = pathname
.replace(/([^A-Za-z0-9/._-])/g, "")
.replace(/(?<![a-zA-Z])\.(?![a-zA-Z])/g, "");
try {
const request_url = req.url.startsWith("/") ? "https://taevas.xyz".concat(req.url) : req.url;
const url = new URL(request_url);
const parameters = url.searchParams;
// merciless sanitization
let pathname = url.pathname;
pathname = pathname
.replace(/([^A-Za-z0-9/._-])/g, "")
.replace(/(?<![a-zA-Z])\.(?![a-zA-Z])/g, "");
if (req.method !== "GET") {
return new Response("Method Not Allowed", { status: 405 });
}
if (req.method !== "GET") {
return new Response("Method Not Allowed", { status: 405 });
}
// MAIN PAGE
// MAIN PAGE
if (pathname === "/") {
const indexContent = await Bun.file("./dist/index.html").text();
return new Response(indexContent, {headers: {"Content-Type": "text/html"}});
}
if (pathname === "/") {
const indexContent = await Bun.file("./dist/index.html").text();
return new Response(indexContent, {headers: {"Content-Type": "text/html"}});
}
// EXTERNAL TO MAIN PAGE
// EXTERNAL TO MAIN PAGE
if (pathname.startsWith("/compressed")) {
const asset = Bun.file("./dist" + pathname);
return await asset.exists() ? new Response(asset, {status: 200}) : new Response("Not Found", {status: 404});
}
if (pathname.startsWith("/compressed")) {
const asset = Bun.file("./dist" + pathname);
return await asset.exists() ? new Response(asset, {status: 200}) : new Response("Not Found", {status: 404});
}
if (pathname.startsWith("/assets")) {
const asset = Bun.file("." + pathname);
return await asset.exists() ? new Response(asset, {status: 200}) : new Response("Not Found", {status: 404});
}
if (pathname.startsWith("/assets")) {
const asset = Bun.file("." + pathname);
return await asset.exists() ? new Response(asset, {status: 200}) : new Response("Not Found", {status: 404});
}
// API
// API
if (pathname.startsWith("/api")) {
for (const endpoint of api_endpoints) {
if (pathname === "/api/" + endpoint.name) {
return await endpoint(parameters);
if (pathname.startsWith("/api")) {
for (const endpoint of api_endpoints) {
if (pathname === "/api/" + endpoint.name) {
return await endpoint(parameters);
}
}
}
}
return new Response("Not Found", {status: 404});
return new Response("Not Found", {status: 404});
} catch(e) {
console.error("Returning a 500 because:\n", e);
return new Response("Internal Server Error", {status: 500});
}
},
}));

View file

@ -9,11 +9,11 @@
"dependencies": {
"@bachmacintosh/wanikani-api-types": "^1.8.0",
"@carbon/icons-react": "^11.57.0",
"@gitbeaker/rest": "^42.1.0",
"@gitbeaker/rest": "^42.2.0",
"@octokit/rest": "^20.1.2",
"osu-api-v2-js": "^1.1.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"timeago.js": "^4.0.2"
},
"devDependencies": {
@ -21,8 +21,8 @@
"@eslint/js": "^9.23.0",
"@stylistic/eslint-plugin": "^3.1.0",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/postcss": "^4.0.15",
"@types/bun": "latest",
"@tailwindcss/postcss": "^4.0.17",
"@types/bun": "^1.2.8",
"@types/react": "^19.0.12",
"@types/react-dom": "^19.0.4",
"dotenv": "^16.4.7",
@ -31,10 +31,10 @@
"eslint-plugin-react": "^7.37.4",
"postcss": "^8.5.3",
"react-animate-height": "^3.2.3",
"tailwindcss": "^4.0.15",
"tailwindcss": "^4.0.17",
"typescript": "^5.8.2",
"typescript-eslint": "^8.27.0",
"vite": "^6.2.2"
"typescript-eslint": "^8.28.0",
"vite": "^6.2.3"
},
"imports": {
"#Main/*": "./src/Main/*",