Fix injection for canary

This commit is contained in:
2022-04-10 17:03:28 -04:00
parent 33393fcedf
commit f168219404
+1 -8
View File
@@ -30,15 +30,8 @@ Object.assign(BrowserWindow, electron.BrowserWindow);
export default class {
static patchBrowserWindow() {
// Reassign electron using proxy to avoid the onReady issue, thanks Powercord!
const newElectron = new Proxy(electron, {
get: function(target, prop) {
if (prop === "BrowserWindow") return BrowserWindow;
return target[prop];
}
});
const electronPath = __non_webpack_require__.resolve("electron");
delete __non_webpack_require__.cache[electronPath].exports; // If it didn't work, try to delete existing
__non_webpack_require__.cache[electronPath].exports = newElectron; // Try to assign again after deleting
__non_webpack_require__.cache[electronPath].exports = {...electron, BrowserWindow}; // Try to assign again after deleting
}
}