diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-17 22:42:16 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-17 22:42:16 +0200 |
commit | e611126c7c168b7c14e6d79fe02e1f996937bbfc (patch) | |
tree | ffe0135fdf4ca7ae9b9005bbb85a6689345a06c2 /api/src | |
parent | :sparkles: mention regex (diff) | |
download | server-e611126c7c168b7c14e6d79fe02e1f996937bbfc.tar.xz |
:art: clean up
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/middlewares/Authentication.ts | 7 | ||||
-rw-r--r-- | api/src/routes/auth/login.ts | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts index 06eeab39..a8bfe196 100644 --- a/api/src/middlewares/Authentication.ts +++ b/api/src/middlewares/Authentication.ts @@ -27,11 +27,12 @@ declare global { export async function Authentication(req: Request, res: Response, next: NextFunction) { if (req.method === "OPTIONS") return res.sendStatus(204); - if (req.url.startsWith("/invites") && req.method === "GET") return next(); // @ts-ignore + const url = req.url.replace(API_PREFIX, ""); + if (url.startsWith("/invites") && req.method === "GET") return next(); // @ts-ignore if ( NO_AUTHORIZATION_ROUTES.some((x) => { - if (typeof x === "string") return req.url.startsWith(x); - return x.test(req.url); + if (typeof x === "string") return url.startsWith(x); + return x.test(url); }) ) return next(); diff --git a/api/src/routes/auth/login.ts b/api/src/routes/auth/login.ts index a7247485..dc970e4c 100644 --- a/api/src/routes/auth/login.ts +++ b/api/src/routes/auth/login.ts @@ -4,7 +4,6 @@ import bcrypt from "bcrypt"; import jwt from "jsonwebtoken"; import { Config, UserModel } from "@fosscord/util"; import { adjustEmail } from "./register"; -import RateLimit from "../../middlewares/RateLimit"; const router: Router = Router(); export default router; |