From cb52a582acbba52c4c68555b5fafdfb266eba3a8 Mon Sep 17 00:00:00 2001 From: Raphael Hehl <7577984+RaHehl@users.noreply.github.com> Date: Tue, 29 Apr 2025 10:59:01 +0200 Subject: [PATCH] feat(backend): add `getTracker` method for IP extraction (#3535) Co-authored-by: Raphael Hehl --- packages/hoppscotch-backend/src/guards/gql-throttler.guard.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/hoppscotch-backend/src/guards/gql-throttler.guard.ts b/packages/hoppscotch-backend/src/guards/gql-throttler.guard.ts index 14316586..b51db4c9 100644 --- a/packages/hoppscotch-backend/src/guards/gql-throttler.guard.ts +++ b/packages/hoppscotch-backend/src/guards/gql-throttler.guard.ts @@ -9,4 +9,7 @@ export class GqlThrottlerGuard extends ThrottlerGuard { const ctx = gqlCtx.getContext(); return { req: ctx.req, res: ctx.res }; } + protected async getTracker(req: Record): Promise { + return req.ips.length ? req.ips[0] : req.ip; // individualize IP extraction to meet your own needs + } }