From 60f44c9603cba4266f9ea33e8558da4c101d01f1 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Tue, 16 Sep 2025 19:41:59 +0000 Subject: [PATCH] revert: Revert "fix: remove turnstyle detection to check if it causes false-positives" This reverts commit c10ca29fda84aafc34914889b198e5ae6fca4063. --- src/utils/Fetcher.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 103951b..eaa16ba 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -118,7 +118,9 @@ export class Fetcher { }; private async handleHttpCacheItem(ctx: Context, httpCacheItem: HttpCacheItem, url: URL, init?: CustomRequestInit): Promise { - if (httpCacheItem.status && httpCacheItem.status >= 200 && httpCacheItem.status <= 399) { + const triggeredCloudflareTurnstile = httpCacheItem.body.includes('cf-turnstile'); + + if (httpCacheItem.status && httpCacheItem.status >= 200 && httpCacheItem.status <= 399 && !triggeredCloudflareTurnstile) { return httpCacheItem; } @@ -126,7 +128,7 @@ export class Fetcher { throw new NotFoundError(); } - if (httpCacheItem.headers['cf-mitigated'] === 'challenge') { + if (httpCacheItem.headers['cf-mitigated'] === 'challenge' || triggeredCloudflareTurnstile) { const noFlareSolverr = init?.noFlareSolverr ?? false; const flareSolverrEndpoint = envGet('FLARESOLVERR_ENDPOINT'); if (noFlareSolverr || !flareSolverrEndpoint) {