add comment explaining the patch

This commit is contained in:
Vendicated
2025-06-10 17:22:30 +02:00
parent f98309c7b7
commit 6950e0b03a

View File

@@ -16,6 +16,11 @@ addPatch({
replace: "false" 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(", find: ".setDevtoolsCallbacks(",
group: true, group: true,
@@ -27,8 +32,8 @@ addPatch({
}, },
{ {
// eslint-disable-next-line no-useless-escape // eslint-disable-next-line no-useless-escape
match: /\b\i\.window\b/g, match: /\b\i\.window\.setDevtoolsCallbacks/g,
replace: "VesktopNative.win" replace: "VesktopNative.win.setDevtoolsCallbacks"
} }
] ]
} }