revert: Revert "fix: remove turnstyle detection to check if it causes false-positives"

This reverts commit c10ca29fda.
This commit is contained in:
WebStreamr 2025-09-16 19:41:59 +00:00
parent 1433d032f3
commit 60f44c9603
No known key found for this signature in database

View file

@ -118,7 +118,9 @@ export class Fetcher {
};
private async handleHttpCacheItem(ctx: Context, httpCacheItem: HttpCacheItem, url: URL, init?: CustomRequestInit): Promise<HttpCacheItem> {
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) {