From 88c4dab0c9be8fe5c7cdd347297cfff8c24a490f Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 16 May 2025 08:54:16 -0300 Subject: [PATCH 1/3] WebpackPatcher: Avoid patching libDiscore without relying on name --- src/webpack/patchWebpack.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index baba751f..300abbab 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -105,7 +105,11 @@ define(Function.prototype, "m", { } const fileName = stack.match(/\/assets\/(.+?\.js)/)?.[1]; - if (fileName?.includes("libdiscore")) { + + // Currently, sentry and libDiscore Webpack instances are not meant to be patched. + // As an extra measure, take advatange of the fact their files include the names and return early if it's one of them. + // Later down we also include other measures to avoid patching them. + if (["sentry", "libdiscore"].some(name => fileName?.toLowerCase()?.includes(name))) { return; } @@ -119,7 +123,10 @@ define(Function.prototype, "m", { define(this, "p", { value: bundlePath }); clearTimeout(bundlePathTimeout); - if (bundlePath !== "/assets/") { + // libDiscore init Webpack instance always returns a constanst string for the js filename of a chunk. + // In that case, avoid patching this instance, + // as it runs before the main Webpack instance and will make the WebpackRequire fallback not work properly, or init an wrongful main WebpackRequire. + if (bundlePath !== "/assets/" || /(?:=>|{return)"[^"]/.exec(String(this.u))) { return; } @@ -132,9 +139,9 @@ define(Function.prototype, "m", { } }); - // In the past, the sentry Webpack instance which we also wanted to patch used to rely on chunks being loaded before initting sentry. + // In the past, the sentry Webpack instance which we also wanted to patch used to rely on chunks being loaded before initing sentry. // This Webpack instance did not include actual chunk loading, and only awaited for them to be loaded, which means it did not include the bundlePath property. - // To keep backwards compability, in case this is ever the case again, and keep patching this type of instance, we explicity patch instances which include wreq.O and not wreq.p. + // To keep backwards compability, if this is ever the case again, and keep patching this type of instance, we explicity patch instances which include wreq.O and not wreq.p. // Since we cannot check what is the bundlePath of the instance to filter for the Discord bundlePath, we only patch it if wreq.p is not included, // which means the instance relies on another instance which does chunk loading, and that makes it very likely to only target Discord Webpack instances like the old sentry. From c1074cb8f7990db025667be65cd9a9e745689ea4 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 16 May 2025 15:54:43 -0300 Subject: [PATCH 2/3] Fix quick css not overriding themes --- src/utils/quickCss.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/quickCss.ts b/src/utils/quickCss.ts index 1789c14d..f32ae7e6 100644 --- a/src/utils/quickCss.ts +++ b/src/utils/quickCss.ts @@ -92,6 +92,7 @@ async function initThemes() { document.addEventListener("DOMContentLoaded", () => { initSystemValues(); + initThemes(); toggle(Settings.useQuickCss); SettingsStore.addChangeListener("useQuickCss", toggle); @@ -102,8 +103,6 @@ document.addEventListener("DOMContentLoaded", () => { if (!IS_WEB) { VencordNative.quickCss.addThemeChangeListener(initThemes); } - - initThemes(); }); export function initQuickCssThemeStore() { From c7f3889713ddcc3a78b359eb0610fd2ff7b683e3 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 16 May 2025 21:23:20 +0200 Subject: [PATCH 3/3] bump to v1.12.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b8e518ae..4c6d5023 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.12.1", + "version": "1.12.2", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": {