From 17ce008e6651d67fd7e098b2ee0d22fd77ac8781 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Tue, 15 Oct 2024 20:07:57 +0200 Subject: [PATCH] fix: BotReason.ChromeWithoutChrome removed due to false positives --- src/bot.test.ts | 12 ++++++------ src/bot.ts | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/bot.test.ts b/src/bot.test.ts index e8aac59..64741ae 100644 --- a/src/bot.test.ts +++ b/src/bot.test.ts @@ -92,12 +92,12 @@ test('"" languages means bot', () => { expect(botDetectionService.isBot()).toBe(BotReason.EmptyLanguages) }) -test('Chrome without chrome means bot', () => { - globalThis.navigator = { - userAgent: userAgentChrome, - } as Navigator - expect(botDetectionService.isBot()).toBe(BotReason.ChromeWithoutChrome) -}) +// test('Chrome without chrome means bot', () => { +// globalThis.navigator = { +// userAgent: userAgentChrome, +// } as Navigator +// expect(botDetectionService.isBot()).toBe(BotReason.ChromeWithoutChrome) +// }) // This test helps with coverage, while not really testing anything useful test('cdp in jest looks like a bot, because it does error serialization', () => { diff --git a/src/bot.ts b/src/bot.ts index 4462331..bcb483b 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -47,9 +47,10 @@ class BotDetectionService { // isChrome is true if the browser is Chrome, Chromium or Opera // this is "the chrome test" from https://intoli.com/blog/not-possible-to-block-chrome-headless/ // this property is for some reason not present by default in headless chrome - if (userAgent.includes('Chrome') && !(globalThis as any).chrome) { - return BotReason.ChromeWithoutChrome // Headless Chrome - } + // Kirill: criterium removed due to false positives with Android + // if (userAgent.includes('Chrome') && !(globalThis as any).chrome) { + // return BotReason.ChromeWithoutChrome // Headless Chrome + // } } /**