fix: ignore recursion checks for certain requests

This commit is contained in:
Viren070
2025-06-13 20:36:15 +01:00
parent c208b9ce01
commit d26602631e
2 changed files with 7 additions and 3 deletions
+3 -2
View File
@@ -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.`
);
+4 -1
View File
@@ -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(