From 4c0c09c8bc800a9f16e16c00804f0e9074cdf15d Mon Sep 17 00:00:00 2001 From: Umimaso Date: Sat, 19 Jun 2021 15:49:49 +0100 Subject: feat: add routing for unversioned api requests Create new route for /api which can handle routing of unversioned requests. Update regex for NO_AUTHORIZATION_ROUTES to support unversioned requests. --- src/middlewares/Authentication.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/middlewares/Authentication.ts') diff --git a/src/middlewares/Authentication.ts b/src/middlewares/Authentication.ts index b53632a8..4b0f2b38 100644 --- a/src/middlewares/Authentication.ts +++ b/src/middlewares/Authentication.ts @@ -3,11 +3,11 @@ import { HTTPError } from "lambert-server"; import { checkToken, Config } from "@fosscord/server-util"; export const NO_AUTHORIZATION_ROUTES = [ - /^\/api\/v8\/auth\/login/, - /^\/api\/v8\/auth\/register/, - /^\/api\/v8\/webhooks\//, - /^\/api\/v8\/gateway/, - /^\/api\/v8\/experiments/, + /^\/api(\/v\d+)?\/auth\/login/, + /^\/api(\/v\d+)?\/auth\/register/, + /^\/api(\/v\d+)?\/webhooks\//, + /^\/api(\/v\d+)?\/gateway/, + /^\/api(\/v\d+)?\/experiments/, /^\/api(\/v\d+)?\/guilds\/\d+\/widget\.(json|png)/ ]; -- cgit 1.5.1