From 6950e0b03ac81b5d38593f5f5bb3d9c136958e7e Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 10 Jun 2025 17:22:30 +0200 Subject: [PATCH] add comment explaining the patch --- src/renderer/patches/devtoolsFixes.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/renderer/patches/devtoolsFixes.ts b/src/renderer/patches/devtoolsFixes.ts index 59fb853..1881329 100644 --- a/src/renderer/patches/devtoolsFixes.ts +++ b/src/renderer/patches/devtoolsFixes.ts @@ -16,6 +16,11 @@ addPatch({ replace: "false" } }, + + // Discord Web uses an incredibly broken devtools detector with false positives. + // They "hide" (aka remove from storage) your token if it "detects" open devtools. + // Due to the false positives, this leads to random logouts. + // Patch their devtools detection to use proper Electron APIs instead to fix the false positives { find: ".setDevtoolsCallbacks(", group: true, @@ -27,8 +32,8 @@ addPatch({ }, { // eslint-disable-next-line no-useless-escape - match: /\b\i\.window\b/g, - replace: "VesktopNative.win" + match: /\b\i\.window\.setDevtoolsCallbacks/g, + replace: "VesktopNative.win.setDevtoolsCallbacks" } ] }