summary refs log tree commit diff
path: root/src/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'src/middlewares')
-rw-r--r--src/middlewares/Authentication.ts4
-rw-r--r--src/middlewares/RateLimit.ts2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/middlewares/Authentication.ts b/src/middlewares/Authentication.ts

index 3d49d8e4..65d5a2cf 100644 --- a/src/middlewares/Authentication.ts +++ b/src/middlewares/Authentication.ts
@@ -7,7 +7,7 @@ export const NO_AUTHORIZATION_ROUTES = ["/api/v8/auth/login", "/api/v8/auth/regi declare global { namespace Express { interface Request { - userid: any; + user_id: any; token: any; } } @@ -22,7 +22,7 @@ export async function Authentication(req: Request, res: Response, next: NextFunc const decoded: any = await checkToken(req.headers.authorization); req.token = decoded; - req.userid = BigInt(decoded.id); + req.user_id = BigInt(decoded.id); return next(); } catch (error) { return next(new HTTPError(error.toString(), 400)); diff --git a/src/middlewares/RateLimit.ts b/src/middlewares/RateLimit.ts
index ab541b74..09d109e1 100644 --- a/src/middlewares/RateLimit.ts +++ b/src/middlewares/RateLimit.ts
@@ -8,7 +8,7 @@ export function RateLimit({ count = 10, timespan = 1000 * 5, name = "/" }) { // TODO: use new db mongoose models /* - let id = req.userid || getIpAdress(req); + let id = req.user_id || getIpAdress(req); const limit: { count: number; start: number } = (await db.data.ratelimit.routes[name][id].get()) || { count: 0,