From 9d00b8a9dea62634a20f4815668b60fdd9644b20 Mon Sep 17 00:00:00 2001 From: nai-degen Date: Mon, 27 May 2024 08:24:56 -0500 Subject: [PATCH] adjusts max IP error message wording --- src/proxy/gatekeeper.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/proxy/gatekeeper.ts b/src/proxy/gatekeeper.ts index 05f4049..a8a654a 100644 --- a/src/proxy/gatekeeper.ts +++ b/src/proxy/gatekeeper.ts @@ -66,7 +66,8 @@ export const gatekeeper: RequestHandler = (req, res, next) => { req, res, 403, - "Forbidden: no more IPs can authenticate with this user token" + `Forbidden: no more IP addresses allowed for this user token`, + { currentIp: ip, maxIps: user?.maxIps } ); case "disabled": const bannedUser = getUser(token); @@ -84,7 +85,8 @@ function sendError( req: Request, res: Response, status: number, - message: string + message: string, + data: any = {} ) { const isPost = req.method === "POST"; const hasBody = isPost && req.body; @@ -103,6 +105,7 @@ function sendError( format: "unknown", statusCode: status, reqId: req.id, + obj: data, }, }); }