From d26602631e030f59ef0f0098633b7f4909db87bc Mon Sep 17 00:00:00 2001 From: Viren070 Date: Fri, 13 Jun 2025 20:36:15 +0100 Subject: [PATCH] fix: ignore recursion checks for certain requests --- packages/core/src/utils/http.ts | 5 +++-- packages/core/src/utils/rpdb.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/core/src/utils/http.ts b/packages/core/src/utils/http.ts index 2a10a774..b1fc1df6 100644 --- a/packages/core/src/utils/http.ts +++ b/packages/core/src/utils/http.ts @@ -32,7 +32,8 @@ export function makeRequest( url: string, timeout: number, headers: HeadersInit = {}, - forwardIp?: string + forwardIp?: string, + ignoreRecursion?: boolean ) { const useProxy = shouldProxy(url); headers = new Headers(headers); @@ -45,7 +46,7 @@ export function makeRequest( // block recursive requests const key = `${url}-${forwardIp}`; const currentCount = urlCount.get(key, false) ?? 0; - if (currentCount > Env.RECURSION_THRESHOLD_LIMIT) { + if (currentCount > Env.RECURSION_THRESHOLD_LIMIT && !ignoreRecursion) { logger.warn( `Detected possible recursive requests to ${url}. Current count: ${currentCount}. Blocking request.` ); diff --git a/packages/core/src/utils/rpdb.ts b/packages/core/src/utils/rpdb.ts index 93029330..dfa2aa81 100644 --- a/packages/core/src/utils/rpdb.ts +++ b/packages/core/src/utils/rpdb.ts @@ -20,7 +20,10 @@ export class RPDB { public async validateApiKey() { const response = await makeRequest( `https://api.ratingposterdb.com/${this.apiKey}/isValid`, - 5000 + 5000, + undefined, + undefined, + true ); if (!response.ok) { throw new Error(