Merge branch 'dev' into immediate-finds

This commit is contained in:
Nuckyz 2024-05-05 17:56:21 -03:00
commit e311bd9f76
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -63,7 +63,8 @@ Object.defineProperty(Function.prototype, "O", {
// When using react devtools or other extensions, or even when discord loads the sentry, we may also catch their webpack here. // When using react devtools or other extensions, or even when discord loads the sentry, we may also catch their webpack here.
// This ensures we actually got the right one // This ensures we actually got the right one
// this.e (wreq.e) is the method for loading a chunk, and only the main webpack has it // this.e (wreq.e) is the method for loading a chunk, and only the main webpack has it
if (new Error().stack?.includes("discord.com") && String(this.e).includes("Promise.all")) { const { stack } = new Error();
if ((stack?.includes("discord.com") || stack?.includes("discordapp.com")) && String(this.e).includes("Promise.all")) {
logger.info("Found main WebpackRequire.onChunksLoaded"); logger.info("Found main WebpackRequire.onChunksLoaded");
delete (Function.prototype as any).O; delete (Function.prototype as any).O;
@ -120,9 +121,9 @@ Object.defineProperty(Function.prototype, "m", {
set(v: any) { set(v: any) {
// When using react devtools or other extensions, we may also catch their webpack here. // When using react devtools or other extensions, we may also catch their webpack here.
// This ensures we actually got the right one // This ensures we actually got the right one
const error = new Error(); const { stack } = new Error();
if (error.stack?.includes("discord.com")) { if (stack?.includes("discord.com") || stack?.includes("discordapp.com")) {
logger.info("Found Webpack module factory", error.stack.match(/\/assets\/(.+?\.js)/)?.[1] ?? ""); logger.info("Found Webpack module factory", stack.match(/\/assets\/(.+?\.js)/)?.[1] ?? "");
patchFactories(v); patchFactories(v);
} }