diff --git a/package.json b/package.json index cfd4bd010..5d8f9f97d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "buildReporter": "pnpm buildWebStandalone --reporter --skip-extension", "buildReporterDesktop": "pnpm build --reporter", "watch": "pnpm build --watch", + "dev": "pnpm watch", "watchWeb": "pnpm buildWeb --watch", "generatePluginJson": "tsx scripts/generatePluginList.ts", "generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types", diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx index 94dc673a5..89a992ac3 100644 --- a/src/plugins/_api/badges/index.tsx +++ b/src/plugins/_api/badges/index.tsx @@ -91,7 +91,7 @@ export default definePlugin({ /* new profiles */ { - find: ".PANEL]:14", + find: ".FULL_SIZE]:26", replacement: { match: /(?<=(\i)=\(0,\i\.\i\)\(\i\);)return 0===\i.length\?/, replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&" diff --git a/src/plugins/consoleShortcuts/index.ts b/src/plugins/consoleShortcuts/index.ts index d716ccf8e..81424bd1a 100644 --- a/src/plugins/consoleShortcuts/index.ts +++ b/src/plugins/consoleShortcuts/index.ts @@ -162,16 +162,32 @@ function loadAndCacheShortcut(key: string, val: any, forceLoad: boolean) { const currentVal = val.getter(); if (!currentVal || val.preload === false) return currentVal; - let value: any; - if (currentVal[SYM_LAZY_GET]) { - value = forceLoad ? currentVal[SYM_LAZY_GET]() : currentVal[SYM_LAZY_CACHED]; - } else if (currentVal[SYM_PROXY_INNER_GET]) { - value = forceLoad ? currentVal[SYM_PROXY_INNER_GET]() : currentVal[SYM_PROXY_INNER_VALUE]; - } else { - value = currentVal; + function unwrapProxy(value: any) { + if (value[SYM_LAZY_GET]) { + return forceLoad ? value[SYM_LAZY_GET]() : value[SYM_LAZY_CACHED]; + } else if (value[SYM_PROXY_INNER_GET]) { + return forceLoad ? value[SYM_PROXY_INNER_GET]() : value[SYM_PROXY_INNER_VALUE]; + } + + return value; } - if (value) define(window.shortcutList, key, { value }); + const value = unwrapProxy(currentVal); + if (typeof value === "object") { + const descriptors = Object.getOwnPropertyDescriptors(value); + + for (const propKey in descriptors) { + const descriptor = descriptors[propKey]; + + if (descriptor.writable === true || descriptor.set != null) { + value[propKey] = unwrapProxy(value[propKey]); + } + } + } + + if (value) { + define(window.shortcutList, key, { value }); + } return value; } diff --git a/src/plugins/mentionAvatars/styles.css b/src/plugins/mentionAvatars/styles.css index 33404d7b5..022f968c0 100644 --- a/src/plugins/mentionAvatars/styles.css +++ b/src/plugins/mentionAvatars/styles.css @@ -1,6 +1,6 @@ .vc-mentionAvatars-avatar { vertical-align: middle; - width: 1em; + width: 1em !important; /* insane discord sets width: 100% in channel topic */ height: 1em; margin: 0 4px 0.2rem 2px; border-radius: 50%; diff --git a/src/webpack/api.tsx b/src/webpack/api.tsx index 31a2990ac..5dc0df2a8 100644 --- a/src/webpack/api.tsx +++ b/src/webpack/api.tsx @@ -432,6 +432,8 @@ export function findByFactoryCode(...code: CodeFilter | [...CodeFilter, * Find the module exports of the first module which the factory includes all the given code, * then map them into an easily usable object via the specified mappers. * + * IMPORTANT: You can destructure the properties of the returned object at top level as long as the property filter does not return a primitive value export. + * * @example * const Modals = mapMangledModule("headerIdIsManaged:", { * openModal: filters.byCode("headerIdIsManaged:"), @@ -450,7 +452,7 @@ export function mapMangledModule(code: string | RegExp | // Wrapper to select whether the parent factory filter or child mapper filter failed when the error is thrown const errorMsgWrapper = lazyString(() => `Webpack mapMangledModule ${callbackCalled ? "mapper" : "factory"} filter matched no module. Filter: ${printFilter(callbackCalled ? mappers[newName] : factoryFilter)}`); - const [proxy, setInnerValue] = proxyInner(errorMsgWrapper, "Webpack find with proxy called on a primitive value."); + const [proxy, setInnerValue] = proxyInner(errorMsgWrapper, "Webpack find with proxy called on a primitive value. This may happen if you are trying to destructure a mapMangledModule primitive value on top level."); mapping[newName] = proxy; setters[newName] = setInnerValue; } @@ -469,6 +471,10 @@ export function mapMangledModule(code: string | RegExp | const filter = mappers[newName]; if (filter(exportValue)) { + if (typeof exportValue !== "object" && typeof exportValue !== "function") { + mapping[newName] = exportValue; + } + setters[newName](exportValue); } }