summary refs log tree commit diff
path: root/src/middlewares
diff options
context:
space:
mode:
authorDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-23 13:43:38 -0500
committerDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-23 13:43:38 -0500
commit28424ed95030e700f9aa8d6f4305da045f260a39 (patch)
tree29c5d85351363f7f189a61e2da52c214e597c0dd /src/middlewares
parentMerge branch 'fosscord-master' (diff)
downloadserver-28424ed95030e700f9aa8d6f4305da045f260a39.tar.xz
Fix: No more type casting required, rather take the gernics
Diffstat (limited to '')
-rw-r--r--src/middlewares/Authentication.ts2
-rw-r--r--src/middlewares/GlobalRateLimit.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/middlewares/Authentication.ts b/src/middlewares/Authentication.ts

index 78533489..050c427f 100644 --- a/src/middlewares/Authentication.ts +++ b/src/middlewares/Authentication.ts
@@ -29,7 +29,7 @@ export async function Authentication(req: Request, res: Response, next: NextFunc try { - const { jwtSecret } = (Config.apiConfig.getAll() as Config.DefaultOptions).security; + const { jwtSecret } = Config.apiConfig.getAll().security; const decoded: any = await checkToken(req.headers.authorization, jwtSecret); diff --git a/src/middlewares/GlobalRateLimit.ts b/src/middlewares/GlobalRateLimit.ts
index ce2bfa52..38098981 100644 --- a/src/middlewares/GlobalRateLimit.ts +++ b/src/middlewares/GlobalRateLimit.ts
@@ -44,7 +44,7 @@ export async function GlobalRateLimit(req: Request, res: Response, next: NextFun } export function getIpAdress(req: Request): string { - const { forwadedFor } = (Config.apiConfig.getAll() as Config.DefaultOptions).security; + const { forwadedFor } = Config.apiConfig.getAll().security; const ip = forwadedFor ? <string>req.headers[forwadedFor] : req.ip; return ip.replaceAll(".", "_").replaceAll(":", "_"); }