Merge branch 'dev' into modules-proxy-patches

This commit is contained in:
Nuckyz 2024-06-29 01:33:59 -03:00
commit 28a7fbb309
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -78,8 +78,7 @@ export default definePlugin({
// Because of that, its WebpackInstance doesnt export wreq.m or wreq.c // Because of that, its WebpackInstance doesnt export wreq.m or wreq.c
// To circuvent this and disable Sentry we are gonna hook when wreq.g of its WebpackInstance is set. // To circuvent this and disable Sentry we are gonna hook when wreq.g of its WebpackInstance is set.
// When that happens we are gonna obtain a reference to its internal module cache (wreq.c) and proxy its prototype, // When that happens we are gonna forcefully throw an error and abort everything.
// so, when the first require to initialize the Sentry is attempted, we are gonna forcefully throw an error and abort everything.
Object.defineProperty(Function.prototype, "g", { Object.defineProperty(Function.prototype, "g", {
configurable: true, configurable: true,
@ -112,28 +111,12 @@ export default definePlugin({
return; return;
} }
const cacheExtractSym = Symbol("vencord.cacheExtract"); new Logger("NoTrack", "#8caaee").info("Disabling Sentry by erroring its WebpackInstance");
Object.defineProperty(Object.prototype, cacheExtractSym, {
configurable: true,
get(this: WebpackRequire["c"]) {
new Logger("NoTrack", "#8caaee").info("Disabling Sentry by proxying its WebpackInstance cache");
Object.setPrototypeOf(this, new Proxy(this, {
get() {
throw new Error("Sentry successfully disabled");
}
}));
Reflect.deleteProperty(Function.prototype, "g"); Reflect.deleteProperty(Function.prototype, "g");
Reflect.deleteProperty(Object.prototype, cacheExtractSym);
Reflect.deleteProperty(window, "DiscordSentry"); Reflect.deleteProperty(window, "DiscordSentry");
return { exports: {} }; throw new Error("Sentry successfully disabled");
}
});
// WebpackRequire our fake module id
this(cacheExtractSym);
} }
}); });