Compare commits

...
Author SHA1 Message Date
dependabot[bot] eb2e261c62 Bump esbuild from 0.21.4 to 0.25.0
Bumps [esbuild](https://github.com/evanw/esbuild) from 0.21.4 to 0.25.0.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.21.4...v0.25.0)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-12 15:15:40 +00:00
Zaid Humaimidi 4be39ed742 Replace deprecated koa middleware 2024-10-04 11:28:04 -07:00
Zaid Humaimidi 8ddb692370 Prevent UI crash when malformed URL is sent 2024-10-04 11:05:07 -07:00
4 changed files with 453 additions and 479 deletions

No files matched your search

+15 -10
View File
@@ -1,10 +1,10 @@
import { constants } from "node:zlib";
import Koa from "koa";
import Router from "koa-router";
import Router from "@koa/router";
import * as jwt from "jsonwebtoken";
import koaStatic from "koa-static";
import koaSend from "koa-send";
import koaCompress from "koa-compress";
import koaBodyParser from "koa-bodyparser";
import koaBodyParser from "@koa/bodyparser";
import koaJwt from "koa-jwt";
import * as config from "./config.ts";
import api from "./ui/api.ts";
@@ -18,12 +18,6 @@ import { version as VERSION } from "../package.json";
import memoize from "./common/memoize.ts";
import { APP_JS, APP_CSS, FAVICON_PNG } from "../build/assets.ts";
declare module "koa" {
interface Request {
body: any;
}
}
const koa = new Koa();
const router = new Router();
@@ -262,6 +256,17 @@ koa.use(
);
koa.use(router.routes());
koa.use(koaStatic(config.ROOT_DIR + "/public"));
koa.use(async (ctx, next) => {
await next();
if (ctx.method !== "HEAD" && ctx.method !== "GET") return;
if (ctx.body != null || ctx.status !== 404) return;
if (/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(ctx.path)) return;
try {
await koaSend(ctx, ctx.path, { root: config.ROOT_DIR + "/public" });
} catch (err) {
if (err.status !== 404) throw err;
}
});
export const listener = koa.callback();
+1 -1
View File
@@ -1,5 +1,5 @@
import { Readable } from "node:stream";
import Router from "koa-router";
import Router from "@koa/router";
import { ObjectId } from "mongodb";
import * as db from "./db.ts";
import * as apiFunctions from "../api-functions.ts";
+433 -462
View File
File diff suppressed because it is too large. Load diff
+4 -6
View File
@@ -26,17 +26,17 @@
},
"dependencies": {
"@breejs/later": "^4.2.0",
"@koa/bodyparser": "^5.1.1",
"@koa/router": "^13.1.0",
"bson": "^4.7.2",
"espresso-iisojs": "^1.0.8",
"iconv-lite": "^0.6.3",
"ipaddr.js": "^2.2.0",
"jsonwebtoken": "^9.0.2",
"koa": "^2.15.3",
"koa-bodyparser": "^4.3.0",
"koa-compress": "^5.1.0",
"koa-jwt": "^4.0.3",
"koa-router": "^12.0.0",
"koa-static": "^5.0.0",
"koa-send": "^5.0.1",
"mongodb": "^4.16.0",
"parsimmon": "^1.18.1",
"seedrandom": "^3.0.5"
@@ -46,8 +46,6 @@
"@types/jsonwebtoken": "^9.0.6",
"@types/koa": "^2.15.0",
"@types/koa-compress": "^4.0.6",
"@types/koa-router": "^7.4.8",
"@types/koa-static": "^4.0.4",
"@types/mithril": "^2.2.6",
"@types/node": "^20.14.2",
"@types/parsimmon": "^1.10.9",
@@ -55,7 +53,7 @@
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"codemirror": "^5.65.16",
"esbuild": "^0.21.4",
"esbuild": "^0.25.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"mithril": "^2.2.2",