From df02a04cfd0ba316105a526b3497c33d3ed2f532 Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Fri, 6 Mar 2026 11:32:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(bestdebrid):=20inject=20CDP?= =?UTF-8?q?=20anti-fingerprint=20patches=20for=20Cloudflare=20Turnstile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use Chrome DevTools Protocol to inject scripts before page load that: - Set navigator.webdriver to false - Add fake navigator.plugins - Set navigator.languages to realistic values - Add window.chrome runtime stub Co-Authored-By: Claude Opus 4.6 --- src/main/bestdebrid-web.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/bestdebrid-web.ts b/src/main/bestdebrid-web.ts index cf7e1a2..18d9fdc 100644 --- a/src/main/bestdebrid-web.ts +++ b/src/main/bestdebrid-web.ts @@ -192,6 +192,24 @@ export class BestDebridWebFallback { }); window.webContents.setUserAgent(BESTDEBRID_USER_AGENT); window.setMenuBarVisibility(false); + + // Inject anti-fingerprint patches via CDP before any page JS runs + // This hides Electron-specific properties that Cloudflare Turnstile detects + try { + window.webContents.debugger.attach("1.3"); + await window.webContents.debugger.sendCommand("Page.addScriptToEvaluateOnNewDocument", { + source: [ + "Object.defineProperty(navigator, 'webdriver', { get: () => false });", + "Object.defineProperty(navigator, 'plugins', { get: () => [1, 2, 3, 4, 5] });", + "Object.defineProperty(navigator, 'languages', { get: () => ['de-DE', 'de', 'en-US', 'en'] });", + "window.chrome = { runtime: {}, loadTimes: function() {}, csi: function() {} };" + ].join("\n") + }); + window.webContents.debugger.detach(); + } catch { + // CDP not available — continue without patches + } + window.on("closed", () => { if (this.loginWindow === window) { this.loginWindow = null;