diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-13 20:53:50 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-13 20:53:50 +0200 |
commit | 213b5811c49f30c8ff2b8a967ebd666adac6cb6f (patch) | |
tree | 2e5ab479447dfdcf669007322f57ac84b61a7527 /api/src/middlewares/Authentication.ts | |
parent | :pencil: updated links to fosscord-server (diff) | |
download | server-213b5811c49f30c8ff2b8a967ebd666adac6cb6f.tar.xz |
:bug: fix api middleware
Diffstat (limited to 'api/src/middlewares/Authentication.ts')
-rw-r--r-- | api/src/middlewares/Authentication.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts index 00cd9ea7..9bd2fcb7 100644 --- a/api/src/middlewares/Authentication.ts +++ b/api/src/middlewares/Authentication.ts @@ -28,10 +28,8 @@ declare global { export async function Authentication(req: Request, res: Response, next: NextFunction) { if (req.method === "OPTIONS") return res.sendStatus(204); - if (!req.url.startsWith("/api")) return next(); - const apiPath = req.url.replace(API_PREFIX, ""); - if (apiPath.startsWith("/invites") && req.method === "GET") return next(); // @ts-ignore - if (NO_AUTHORIZATION_ROUTES.some((x) => apiPath.startsWith(x) || x.test?.(req.url))) return next(); + if (req.url.startsWith("/invites") && req.method === "GET") return next(); // @ts-ignore + if (NO_AUTHORIZATION_ROUTES.some((x) => req.url.startsWith(x) || x.test?.(req.url))) return next(); if (!req.headers.authorization) return next(new HTTPError("Missing Authorization Header", 401)); try { |