From 3d4cf25659e726ac5ab210a66686a0a0baf17060 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:50:16 -0500 Subject: [PATCH] fix remaining things broken by recent Discord update (#3966) Co-authored-by: V Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> --- src/Vencord.ts | 4 +- src/plugins/_api/dynamicImageModalApi.ts | 3 +- src/plugins/_api/messageUpdater.ts | 2 +- src/plugins/betterGifAltText/index.ts | 2 +- src/plugins/betterGifPicker/index.ts | 16 ++++-- src/plugins/betterSessions/index.tsx | 7 ++- src/plugins/betterSettings/index.tsx | 10 ++-- src/plugins/blurNsfw/index.ts | 2 +- src/plugins/consoleJanitor/index.tsx | 52 +++++++++++++------ src/plugins/consoleShortcuts/index.ts | 12 +++-- src/plugins/customRPC/index.tsx | 2 +- src/plugins/decor/index.tsx | 9 +++- .../decor/ui/modals/CreateDecorationModal.tsx | 2 +- src/plugins/experiments/index.tsx | 5 +- src/plugins/fakeNitro/index.tsx | 4 +- src/plugins/fullSearchContext/index.tsx | 2 +- src/plugins/fullUserInChatbox/index.tsx | 2 +- src/plugins/gifPaste/index.ts | 6 +-- src/plugins/imageZoom/index.tsx | 2 +- src/plugins/loadingQuotes/index.ts | 4 +- src/plugins/mentionAvatars/index.tsx | 14 +++-- src/plugins/messageLogger/index.tsx | 2 +- src/plugins/normalizeMessageLinks/index.ts | 26 ---------- src/plugins/pinDms/index.tsx | 10 ++-- src/plugins/platformIndicators/index.tsx | 6 +-- src/plugins/revealAllSpoilers/index.ts | 2 +- .../reviewDB/components/ReviewsView.tsx | 2 +- src/plugins/roleColorEverywhere/index.tsx | 2 +- src/plugins/showHiddenChannels/index.tsx | 19 ++++--- src/plugins/showHiddenThings/index.ts | 2 +- src/plugins/spotifyCrack/index.ts | 2 +- src/plugins/themeAttributes/index.ts | 14 +++-- src/plugins/typingTweaks/index.tsx | 2 +- src/plugins/userMessagesPronouns/index.ts | 2 +- src/plugins/usrbg/index.tsx | 4 +- src/plugins/validReply/index.ts | 14 +++-- src/plugins/viewIcons/index.tsx | 14 +++-- src/plugins/webContextMenus.web/index.ts | 6 +-- src/plugins/webKeybinds.web/index.ts | 2 +- src/plugins/webScreenShareFixes.web/index.ts | 10 +++- src/plugins/whoReacted/index.tsx | 2 +- src/webpack/common/components.ts | 2 +- src/webpack/common/utils.ts | 4 +- 43 files changed, 179 insertions(+), 132 deletions(-) delete mode 100644 src/plugins/normalizeMessageLinks/index.ts diff --git a/src/Vencord.ts b/src/Vencord.ts index d451e9f28..86a2e8e34 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -34,6 +34,7 @@ import { debounce } from "@shared/debounce"; import { IS_WINDOWS } from "@utils/constants"; import { createAndAppendStyle } from "@utils/css"; import { StartAt } from "@utils/types"; +import { SettingsRouter } from "@webpack/common"; import { get as dsGet } from "./api/DataStore"; import { NotificationData, showNotification } from "./api/Notifications"; @@ -44,7 +45,6 @@ import { localStorage } from "./utils/localStorage"; import { relaunch } from "./utils/native"; import { checkForUpdates, update, UpdateLogger } from "./utils/updater"; import { onceReady } from "./webpack"; -import { SettingsRouter } from "./webpack/common"; import { patches } from "./webpack/patchWebpack"; if (IS_REPORTER) { @@ -68,7 +68,7 @@ async function syncSettings() { body: "We've noticed you have cloud integrations enabled in another client! Due to limitations, you will " + "need to re-authenticate to continue using them. Click here to go to the settings page to do so!", color: "var(--yellow-360)", - onClick: () => SettingsRouter.open("VencordCloud") + onClick: () => SettingsRouter.openUserSettings("vencord_cloud_panel") }); return; } diff --git a/src/plugins/_api/dynamicImageModalApi.ts b/src/plugins/_api/dynamicImageModalApi.ts index 775cdf030..4cbd95c9a 100644 --- a/src/plugins/_api/dynamicImageModalApi.ts +++ b/src/plugins/_api/dynamicImageModalApi.ts @@ -14,7 +14,8 @@ export default definePlugin({ description: "Allows you to omit either width or height when opening an image modal", patches: [ { - find: ".renderLinkComponent)?", + // TODO: bundler compat + find: ".renderLinkComponent", replacement: { // widthAndHeightPassed = w != null && w !== 0 && h == null || h === 0 match: /(?<=\i=)(null!=\i&&0!==\i)&&(null!=\i&&0!==\i)/, diff --git a/src/plugins/_api/messageUpdater.ts b/src/plugins/_api/messageUpdater.ts index 8f6cca26a..d029456e7 100644 --- a/src/plugins/_api/messageUpdater.ts +++ b/src/plugins/_api/messageUpdater.ts @@ -27,7 +27,7 @@ export default definePlugin({ patches: [ { // Message accessories have a custom logic to decide if they should render again, so we need to make it not ignore changed message reference - find: "}renderEmbeds(", + find: "}renderStickersAccessories(", replacement: { match: /(?<=this.props,\i,\[)"message",/, replace: "" diff --git a/src/plugins/betterGifAltText/index.ts b/src/plugins/betterGifAltText/index.ts index 5d9b188ea..0a381e547 100644 --- a/src/plugins/betterGifAltText/index.ts +++ b/src/plugins/betterGifAltText/index.ts @@ -26,7 +26,7 @@ export default definePlugin({ "Change GIF alt text from simply being 'GIF' to containing the gif tags / filename", patches: [ { - find: '"onCloseImage",', + find: ".modalContext})};", replacement: { match: /(return.{0,10}\.jsx.{0,50}isWindowFocused)/, replace: diff --git a/src/plugins/betterGifPicker/index.ts b/src/plugins/betterGifPicker/index.ts index 9d7d8db41..bc39c6b5c 100644 --- a/src/plugins/betterGifPicker/index.ts +++ b/src/plugins/betterGifPicker/index.ts @@ -13,11 +13,17 @@ export default definePlugin({ authors: [Devs.Samwich], patches: [ { - find: '"state",{resultType:', - replacement: [{ - match: /(?<="state",{resultType:)null/, - replace: '"Favorites"' - }] + find: "renderHeaderContent(){", + replacement: [ + { + match: /(?<="state",{resultType:)null/, + replace: '"Favorites"' + }, + { + match: /(?<=state={resultType:)null/, + replace: '"Favorites"' + } + ] } ] }); diff --git a/src/plugins/betterSessions/index.tsx b/src/plugins/betterSessions/index.tsx index 78aea6133..b6dabbaa0 100644 --- a/src/plugins/betterSessions/index.tsx +++ b/src/plugins/betterSessions/index.tsx @@ -23,15 +23,14 @@ import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy, findComponentByCodeLazy, findCssClassesLazy, findStoreLazy } from "@webpack"; -import { Constants, React, RestAPI, Tooltip } from "@webpack/common"; +import { findComponentByCodeLazy, findCssClassesLazy, findStoreLazy } from "@webpack"; +import { Constants, React, RestAPI, SettingsRouter, Tooltip } from "@webpack/common"; import { RenameButton } from "./components/RenameButton"; import { Session, SessionInfo } from "./types"; import { fetchNamesFromDataStore, getDefaultName, GetOsColor, GetPlatformIcon, savedSessionsCache, saveSessionsToDataStore } from "./utils"; const AuthSessionsStore = findStoreLazy("AuthSessionsStore"); -const UserSettingsModal = findByPropsLazy("saveAccountChanges", "open"); const TimestampClasses = findCssClassesLazy("timestamp", "blockquoteContainer"); const SessionIconClasses = findCssClassesLazy("sessionIcon"); @@ -175,7 +174,7 @@ export default definePlugin({ title: "BetterSessions", body: `New session:\n${session.client_info.os} · ${session.client_info.platform} · ${session.client_info.location}`, permanent: true, - onClick: () => UserSettingsModal.open("Sessions") + onClick: () => SettingsRouter.openUserSettings("sessions_panel") }); } diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index 2236d2fdc..79fe68509 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -100,9 +100,9 @@ export default definePlugin({ { find: "this.renderArtisanalHack()", replacement: [ - { // Fade in on layer - match: /(?<=\((\i),"contextType",\i\.\i\);)/, - replace: "$1=$self.Layer;", + { + match: /class (\i)(?= extends \i\.PureComponent.+?static contextType=.+?jsx\)\(\1,\{mode:)/, + replace: "var $1=$self.Layer;class VencordPatchedOldFadeLayer", predicate: () => settings.store.disableFade }, { // Lazy-load contents @@ -129,8 +129,8 @@ export default definePlugin({ { // Load menu TOC eagerly find: "#{intl::USER_SETTINGS_WITH_BUILD_OVERRIDE}", replacement: { - match: /(\i)\(this,"handleOpenSettingsContextMenu",.{0,100}?null!=\i&&.{0,100}?(await [^};]*?\)\)).*?,(?=\1\(this)/, - replace: "$&(async ()=>$2)()," + match: /(?=handleOpenSettingsContextMenu=.{0,100}?null!=\i&&.{0,100}?(await [^};]*?\)\)))/, + replace: "_vencordBetterSettingsEagerLoad=(async ()=>$1)();" }, predicate: () => settings.store.eagerLoad }, diff --git a/src/plugins/blurNsfw/index.ts b/src/plugins/blurNsfw/index.ts index 358c986b0..1681f8c57 100644 --- a/src/plugins/blurNsfw/index.ts +++ b/src/plugins/blurNsfw/index.ts @@ -45,7 +45,7 @@ export default definePlugin({ patches: [ { - find: "}renderEmbeds(", + find: "}renderStickersAccessories(", replacement: [ { match: /(\.renderReactions\(\i\).+?className:)/, diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index 038f8513a..067fa270f 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -147,10 +147,16 @@ export default definePlugin({ }, { find: "is not a valid locale.", - replacement: { - match: /\i\.error(?=\(""\.concat\(\i," is not a valid locale."\)\))/, - replace: "$self.Noop" - } + replacement: [ + { + match: /\i\.error(?=\(""\.concat\(\i," is not a valid locale."\)\))/, + replace: "$self.Noop" + }, + { + match: /\i\.error(?=\(`\$\{\i\} is not a valid locale.`)/, + replace: "$self.Noop" + } + ] }, { find: '"AppCrashedFatalReport: getLastCrash not supported."', @@ -161,10 +167,16 @@ export default definePlugin({ }, { find: "RPCServer:WSS", - replacement: { - match: /\i\.error\("Error: "\.concat\((\i)\.message/, - replace: '!$1.message.includes("EADDRINUSE")&&$&' - } + replacement: [ + { + match: /\i\.error\("Error: "\.concat\((\i)\.message/, + replace: '!$1.message.includes("EADDRINUSE")&&$&' + }, + { + match: /\i\.error\(`Error: \$\{(\i)\.message\}/, + replace: '!$1.message.includes("EADDRINUSE")&&$&' + } + ] }, { find: "Tried getting Dispatch instance before instantiated", @@ -182,17 +194,25 @@ export default definePlugin({ }, { find: "failed to send analytics events", - replacement: { - match: /console\.error\("\[analytics\] failed to send analytics events query: "\.concat\(\i\)\)/, - replace: "" - } + replacement: [ + { + match: /console\.error\("\[analytics\] failed to send analytics events query: "\.concat\(\i\)\)/, + replace: "" + }, + { + match: /console\.error\(`\[analytics\] failed to send analytics events query: \$\{\i\}`\)/, + replace: "" + } + ] }, { find: "Slow dispatch on", - replacement: { - match: /\i\.totalTime>\i&&\i\.verbose\("Slow dispatch on ".+?\)\);/, - replace: "" - } + replacement: [ + { + match: /\i\.totalTime>\i&&\i\.verbose\([`"]Slow dispatch on.{0,55}\);/, + replace: "" + }, + ] }, // Patches Discord generic logger function { diff --git a/src/plugins/consoleShortcuts/index.ts b/src/plugins/consoleShortcuts/index.ts index c163dd649..3b35e89e4 100644 --- a/src/plugins/consoleShortcuts/index.ts +++ b/src/plugins/consoleShortcuts/index.ts @@ -247,11 +247,13 @@ export default definePlugin({ patches: [ { - find: 'this,"_changeCallbacks",', - replacement: { - match: /\i\(this,"_changeCallbacks",/, - replace: "Reflect.defineProperty(this,Symbol.toStringTag,{value:this.getName(),configurable:!0,writable:!0,enumerable:!1}),$&" - } + find: "&&this.initializeIfNeeded()", + replacement: [ + { + match: /\i&&this\.initializeIfNeeded\(\)/, + replace: "$&,Reflect.defineProperty(this,Symbol.toStringTag,{value:this.getName(),configurable:!0,writable:!0,enumerable:!1})" + } + ] } ], diff --git a/src/plugins/customRPC/index.tsx b/src/plugins/customRPC/index.tsx index 8e3328e80..d41c904d0 100644 --- a/src/plugins/customRPC/index.tsx +++ b/src/plugins/customRPC/index.tsx @@ -225,7 +225,7 @@ export default definePlugin({ // Discord hides buttons on your own Rich Presence for some reason. This patch disables that behaviour patches: [ { - find: ".buttons.length)>=1", + find: ".USER_PROFILE_ACTIVITY_BUTTONS),", replacement: { match: /.getId\(\)===\i.id/, replace: "$& && false" diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index 6e8e53f16..c4888b94b 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -50,7 +50,7 @@ export default definePlugin({ find: "80,onlyAnimateOnHoverOrFocus:!", replacement: [ { - match: /(?<==)\i=>{let{children.{20,200}isSelected:\i=!1\}=\i/, + match: /(?<==)\i=>{let{children.{20,200}isSelected:\i=!1.{0,5}\}=\i/, replace: "$self.DecorationGridItem=$&", }, { @@ -106,6 +106,10 @@ export default definePlugin({ { match: /(?<=userValue.{0,25}void 0:)((\i)\.avatarDecoration)/, replace: "$self.useUserDecorAvatarDecoration($2)??$1" + }, + { + match: /(?<=userValue:)((\i)(?:.{0,10})?\.avatarDecoration)/, + replace: "$self.useUserDecorAvatarDecoration($2)??$1" } ] })), @@ -114,7 +118,7 @@ export default definePlugin({ find: "#{intl::PREMIUM_UPSELL_PROFILE_AVATAR_DECO_INLINE_UPSELL_DESCRIPTION}", replacement: { match: /(#{intl::PREMIUM_UPSELL_PROFILE_AVATAR_DECO_INLINE_UPSELL_DESCRIPTION}.+?return null!=(\i)&&\()(null==\i)/, - replace: (_, rest, avatarDecoration, hasPurchase) => `${rest}(${avatarDecoration}.skuId!==$self.SKU_ID&&${hasPurchase})` + replace: (_, rest, avatarDecoration, hasPurchase) => `${rest}(${avatarDecoration}.skuId!==$self.SKU_ID&&${avatarDecoration}.skuId!==$self.RAW_SKU_ID&&${hasPurchase})` } } ], @@ -140,6 +144,7 @@ export default definePlugin({ }, SKU_ID, + RAW_SKU_ID, useUserDecorAvatarDecoration, diff --git a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx index f81135977..fa07cc312 100644 --- a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx @@ -16,7 +16,7 @@ import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeade import { filters, findComponentByCodeLazy, mapMangledModuleLazy } from "@webpack"; import { Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Text, TextInput, useEffect, useMemo, UserStore, useState } from "@webpack/common"; -const FileUpload = findComponentByCodeLazy(".currentTarget.files)", "lineClamp:1"); +const FileUpload = findComponentByCodeLazy(".currentTarget.files", "lineClamp:1"); const { HelpMessage, HelpMessageTypes } = mapMangledModuleLazy('POSITIVE="positive', { HelpMessageTypes: filters.byProps("POSITIVE", "WARNING", "INFO"), diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index ab97ae92d..df750cdc6 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -30,7 +30,7 @@ import { Forms, React } from "@webpack/common"; import hideBugReport from "./hideBugReport.css?managed"; const KbdStyles = findByPropsLazy("key", "combo"); -const BugReporterExperiment = findLazy(m => m?.definition?.id === "2024-09_bug_reporter"); +const BugReporterExperiment = findLazy(m => m?.definition?.name === "2026-01-bug-reporter"); const modKey = IS_MAC ? "cmd" : "ctrl"; const altKey = IS_MAC ? "opt" : "alt"; @@ -109,6 +109,7 @@ export default definePlugin({ find: "Clear Treatment ", replacement: [ { + // TODO: stable compat optional chaining remove once some time has passed match: /\i\??\.isStaff\(\)/, replace: "true" }, @@ -129,7 +130,7 @@ export default definePlugin({ } ], - start: () => !BugReporterExperiment.getCurrentConfig().hasBugReporterAccess && enableStyle(hideBugReport), + start: () => !BugReporterExperiment.getConfig().hasBugReporterAccess && enableStyle(hideBugReport), stop: () => disableStyle(hideBugReport), settingsAboutComponent: () => { diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 4a943e118..13a5b5e82 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -293,13 +293,13 @@ export default definePlugin({ { // Patch the rendered message content to add fake nitro emojis or remove sticker links predicate: () => settings.store.transformEmojis || settings.store.transformStickers, - match: /(?=return{hasSpoilerEmbeds:\i,content:(\i))/, + match: /(?=return{hasSpoilerEmbeds:\i,hasBailedAst:\i,content:(\i))/, replace: (_, content) => `${content}=$self.patchFakeNitroEmojisOrRemoveStickersLinks(${content},arguments[2]?.formatInline);` } ] }, { - find: "}renderEmbeds(", + find: "}renderStickersAccessories(", replacement: [ { // Call our function to decide whether the embed should be ignored or not diff --git a/src/plugins/fullSearchContext/index.tsx b/src/plugins/fullSearchContext/index.tsx index d5b9c8a1e..2f20cd53b 100644 --- a/src/plugins/fullSearchContext/index.tsx +++ b/src/plugins/fullSearchContext/index.tsx @@ -34,7 +34,7 @@ interface CopyIdMenuItemProps { } let CopyIdMenuItem: (props: CopyIdMenuItemProps) => React.ReactElement | null = NoopComponent; -waitFor(filters.componentByCode('"devmode-copy-id-".concat'), m => CopyIdMenuItem = m); +waitFor(filters.componentByCode('"cannot copy null text"'), m => CopyIdMenuItem = m); function MessageMenu({ message, channel, onHeightUpdate }) { const canReport = message.author && diff --git a/src/plugins/fullUserInChatbox/index.tsx b/src/plugins/fullUserInChatbox/index.tsx index a9d4d61d9..9ac4f811d 100644 --- a/src/plugins/fullUserInChatbox/index.tsx +++ b/src/plugins/fullUserInChatbox/index.tsx @@ -28,7 +28,7 @@ export default definePlugin({ patches: [ { // Same find as RoleColorEverywhere chatbox mentions - find: ':"text":', + find: '"text":"locked"', replacement: { match: /(hidePersonalInformation\).+?)(if\(null!=\i\){.+?return \i)(?=})/, replace: "$1return $self.UserMentionComponent({...arguments[0],originalComponent:()=>{$2}});" diff --git a/src/plugins/gifPaste/index.ts b/src/plugins/gifPaste/index.ts index b2b4305d8..4e520d122 100644 --- a/src/plugins/gifPaste/index.ts +++ b/src/plugins/gifPaste/index.ts @@ -27,10 +27,10 @@ export default definePlugin({ authors: [Devs.Ven], patches: [{ - find: '"handleSelectGIF",', + find: "handleSelectGIF=", replacement: { - match: /"handleSelectGIF",(\i)=>\{/, - replace: '"handleSelectGIF",$1=>{if (!this.props.className) return $self.handleSelect($1);' + match: /handleSelectGIF=(\i)=>\{/, + replace: "$&if (!this.props.className) return $self.handleSelect($1);" } }], diff --git a/src/plugins/imageZoom/index.tsx b/src/plugins/imageZoom/index.tsx index 061407411..4bdfe4378 100644 --- a/src/plugins/imageZoom/index.tsx +++ b/src/plugins/imageZoom/index.tsx @@ -163,7 +163,7 @@ export default definePlugin({ patches: [ { - find: ".renderLinkComponent)?", + find: "disableArrowKeySeek:!0", replacement: [ { match: /useFullWidth:!0,shouldLink:/, diff --git a/src/plugins/loadingQuotes/index.ts b/src/plugins/loadingQuotes/index.ts index d26f49367..3b9896b58 100644 --- a/src/plugins/loadingQuotes/index.ts +++ b/src/plugins/loadingQuotes/index.ts @@ -66,11 +66,11 @@ export default definePlugin({ find: "#{intl::LOADING_DID_YOU_KNOW}", replacement: [ { - match: /"_loadingText".+?(?=(\i)\[.{0,10}\.random)/, + match: /_loadingText.+?(?=(\i)\[.{0,10}\.random)/, replace: "$&$self.mutateQuotes($1)," }, { - match: /"_eventLoadingText".+?(?=(\i)\[.{0,10}\.random)/, + match: /_eventLoadingText.+?(?=(\i)\[.{0,10}\.random)/, replace: "$&$self.mutateQuotes($1),", predicate: () => settings.store.replaceEvents } diff --git a/src/plugins/mentionAvatars/index.tsx b/src/plugins/mentionAvatars/index.tsx index 3e8e7c9ee..741116c76 100644 --- a/src/plugins/mentionAvatars/index.tsx +++ b/src/plugins/mentionAvatars/index.tsx @@ -49,10 +49,16 @@ export default definePlugin({ patches: [{ find: ".USER_MENTION)", - replacement: { - match: /children:"@"\.concat\((null!=\i\?\i:\i)\)(?<=\.useName\((\i)\).+?)/, - replace: "children:$self.renderUsername({username:$1,user:$2})" - } + replacement: [ + { + match: /children:"@"\.concat\((null!=\i\?\i:\i)\)(?<=\.useName\((\i)\).+?)/, + replace: "children:$self.renderUsername({username:$1,user:$2})" + }, + { + match: /children:`@\$\{(\i\?\?\i)\}`(?<=\.useName\((\i)\).+?)/, + replace: "children:$self.renderUsername({username:$1,user:$2})" + } + ] }, { find: ".ROLE_MENTION)", diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 4d765e9e6..ef32ad514 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -408,7 +408,7 @@ export default definePlugin({ { // Updated message transformer(?) - find: "THREAD_STARTER_MESSAGE?null==", + find: ".PREMIUM_REFERRAL&&(", replacement: [ { // Pass through editHistory & deleted & original attachments to the "edited message" transformer diff --git a/src/plugins/normalizeMessageLinks/index.ts b/src/plugins/normalizeMessageLinks/index.ts deleted file mode 100644 index 82076ef20..000000000 --- a/src/plugins/normalizeMessageLinks/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "NormalizeMessageLinks", - description: "Strip canary/ptb from message links", - authors: [Devs.bb010g], - patches: [ - { - find: "#{intl::COPY_MESSAGE_LINK}", - replacement: { - match: /\.concat\(location\.host\)/, - replace: ".concat($self.normalizeHost(location.host))", - }, - }, - ], - normalizeHost(host: string) { - return host.replace(/(^|\b)(canary\.|ptb\.)(discord.com)$/, "$1$3"); - }, -}); diff --git a/src/plugins/pinDms/index.tsx b/src/plugins/pinDms/index.tsx index b3aaa528e..71b863eb1 100644 --- a/src/plugins/pinDms/index.tsx +++ b/src/plugins/pinDms/index.tsx @@ -72,7 +72,7 @@ export default definePlugin({ patches: [ { - find: '"private-channels-".concat(', + find: '"dm-quick-launcher"===', replacement: [ { // Filter out pinned channels from the private channel list @@ -87,15 +87,15 @@ export default definePlugin({ // Rendering { - match: /"renderRow",(\i)=>{(?<="renderDM",.+?(\i\.\i),\{channel:.+?)/, + match: /renderRow(?:",|=)(\i)=>{(?<=renderDM(?:",|=).+?(\i\.\i),\{channel:.+?)/, replace: "$&if($self.isChannelIndex($1.section, $1.row))return $self.renderChannel($1.section,$1.row,$2)();" }, { - match: /"renderSection",(\i)=>{/, + match: /renderSection(?:",|=)(\i)=>{/, replace: "$&if($self.isCategoryIndex($1.section))return $self.renderCategory($1);" }, { - match: /"renderSection".{0,300}?"span",{/, + match: /renderSection(?:",|=).{0,300}?"span",{/, replace: "$&...$self.makeSpanProps()," }, @@ -105,7 +105,7 @@ export default definePlugin({ replace: "$1($2-$self.categoryLen())" }, { - match: /"getRowHeight",\((\i),(\i)\)=>{/, + match: /getRowHeight(?:",|=)\((\i),(\i)\)=>{/, replace: "$&if($self.isChannelHidden($1,$2))return 0;" }, diff --git a/src/plugins/platformIndicators/index.tsx b/src/plugins/platformIndicators/index.tsx index 8c6ba66d8..ea33b3c6a 100644 --- a/src/plugins/platformIndicators/index.tsx +++ b/src/plugins/platformIndicators/index.tsx @@ -42,7 +42,7 @@ export interface Session { const SessionsStore = findStoreLazy("SessionsStore") as { getSessions(): Record; }; -const { useStatusFillColor } = mapMangledModuleLazy(".concat(.5625*", { +const { useStatusFillColor } = mapMangledModuleLazy([".5625*", "translate"], { useStatusFillColor: filters.byCode(".hex") }); @@ -236,8 +236,8 @@ export default definePlugin({ }, { // Fix sizes for mobile indicators which aren't online - match: /(?<=\(\i\.status,)(\i)(?=,(\i),\i\))/, - replace: (_, userStatus, isMobile) => `${isMobile}?"online":${userStatus}` + match: /(?<=\(\i\.status,)(\i)(?=,\{.{0,15}isMobile:(\i))/, + replace: '$2?"online":$1' }, { // Make isMobile true no matter the status diff --git a/src/plugins/revealAllSpoilers/index.ts b/src/plugins/revealAllSpoilers/index.ts index 814abb202..173632d7a 100644 --- a/src/plugins/revealAllSpoilers/index.ts +++ b/src/plugins/revealAllSpoilers/index.ts @@ -32,7 +32,7 @@ export default definePlugin({ { find: ".removeObscurity,", replacement: { - match: /(?<="removeObscurity",(\i)=>{)/, + match: /(?<=removeObscurity(?:",|=)(\i)=>{)/, replace: (_, event) => `$self.reveal(${event});` } } diff --git a/src/plugins/reviewDB/components/ReviewsView.tsx b/src/plugins/reviewDB/components/ReviewsView.tsx index 7de4044a7..675bfe614 100644 --- a/src/plugins/reviewDB/components/ReviewsView.tsx +++ b/src/plugins/reviewDB/components/ReviewsView.tsx @@ -31,7 +31,7 @@ const Transforms = findByPropsLazy("insertNodes", "textToText"); const Editor = findByPropsLazy("start", "end", "toSlateRange"); const ChatInputTypes = findByPropsLazy("FORM", "USER_PROFILE"); const InputComponent = findComponentByCodeLazy("editorClassName", "CHANNEL_TEXT_AREA"); -const createChannelRecordFromServer = findByCodeLazy(".GUILD_TEXT])", "fromServer)"); +const createChannelRecordFromServer = findByCodeLazy(".GUILD_TEXT]", "fromServer)"); interface UserProps { discordId: string; diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 872efdc64..eb03942f5 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -92,7 +92,7 @@ export default definePlugin({ // Slate { // Same find as FullUserInChatbox - find: ':"text":', + find: '"text":"locked"', replacement: [ { match: /let\{id:(\i),guildId:\i,channelId:(\i)[^}]*\}.*?\.\i,{(?=children)/, diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 484352a13..f1b08c654 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -147,7 +147,7 @@ export default definePlugin({ all: true, // Render null instead of the buttons if the channel is hidden replacement: { - match: /(?<="renderOpenChatButton",\(\)=>{)/, + match: /(?<=renderOpenChatButton(?:",|=)\(\)=>{)/, replace: "if($self.isHiddenChannel(this.props.channel))return null;" } }, @@ -200,7 +200,7 @@ export default definePlugin({ }, { // Hide the new version of unreads box for hidden channels - find: '"ChannelListUnreadsStore",', + find: '"ChannelListUnreadsStore"', replacement: { match: /(?<=\.id\)\))(?=&&\(0,\i\.\i\)\((\i)\))/, replace: (_, channel) => `&&!$self.isHiddenChannel(${channel})` @@ -227,19 +227,19 @@ export default definePlugin({ find: "Missing channel in Channel.renderHeaderToolbar", replacement: [ { - match: /"renderHeaderToolbar",\(\)=>{.+?case \i\.\i\.GUILD_TEXT:(?=.+?(\i\.push.{0,50}channel:(\i)},"notifications"\)\)))(?<=isLurking:(\i).+?)/, + match: /renderHeaderToolbar(?:",|=)\(\)=>{.+?case \i\.\i\.GUILD_TEXT:(?=.+?(\i\.push.{0,50}channel:(\i)},"notifications"\)\)))(?<=isLurking:(\i).+?)/, replace: (m, pushNotificationButtonExpression, channel, isLurking) => `${m}if(!${isLurking}&&$self.isHiddenChannel(${channel})){${pushNotificationButtonExpression};break;}` }, { - match: /"renderHeaderToolbar",\(\)=>{.+?case \i\.\i\.GUILD_MEDIA:(?=.+?(\i\.push.{0,40}channel:(\i)},"notifications"\)\)))(?<=isLurking:(\i).+?)/, + match: /renderHeaderToolbar(?:",|=)\(\)=>{.+?case \i\.\i\.GUILD_MEDIA:(?=.+?(\i\.push.{0,40}channel:(\i)},"notifications"\)\)))(?<=isLurking:(\i).+?)/, replace: (m, pushNotificationButtonExpression, channel, isLurking) => `${m}if(!${isLurking}&&$self.isHiddenChannel(${channel})){${pushNotificationButtonExpression};break;}` }, { - match: /"renderMobileToolbar",\(\)=>{.+?case \i\.\i\.GUILD_DIRECTORY:(?<=let{channel:(\i).+?)/, + match: /renderMobileToolbar(?:",|=)\(\)=>{.+?case \i\.\i\.GUILD_DIRECTORY:(?<=let{channel:(\i).+?)/, replace: (m, channel) => `${m}if($self.isHiddenChannel(${channel}))break;` }, { - match: /(?<="renderHeaderBar",\(\)=>{.+?hideSearch:(\i)\.isDirectory\(\))/, + match: /(?<=renderHeaderBar(?:",|=)\(\)=>{.+?hideSearch:(\i)\.isDirectory\(\))/, replace: (_, channel) => `||$self.isHiddenChannel(${channel})` }, { @@ -335,6 +335,13 @@ export default definePlugin({ match: /(?<="\+"\.concat\()\i/, replace: overflowTextAmount => "" + `$self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)&&(${overflowTextAmount}-1)<=0?"":${overflowTextAmount}` + }, + { + // Show only the plus text without overflowed children amount + // if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen + match: /(?<=`\+\$\{)\i(?=\})/, + replace: overflowTextAmount => "" + + `$self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)&&(${overflowTextAmount}-1)<=0?"":${overflowTextAmount}` } ] }, diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index b788a8bd1..9a329474d 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -52,7 +52,7 @@ export default definePlugin({ }, }, { - find: "INVITES_DISABLED))||", + find: "INVITES_DISABLED)||", predicate: () => settings.store.showInvitesPaused, replacement: { match: /\i\.\i\.can\(\i\.\i.MANAGE_GUILD,\i\)/, diff --git a/src/plugins/spotifyCrack/index.ts b/src/plugins/spotifyCrack/index.ts index 37504be2e..505e53a12 100644 --- a/src/plugins/spotifyCrack/index.ts +++ b/src/plugins/spotifyCrack/index.ts @@ -51,7 +51,7 @@ export default definePlugin({ }, }, { - find: '"displayName","SpotifyStore")', + find: "}getPlayableComputerDevices(){", replacement: [ { predicate: () => settings.store.noSpotifyAutoPause, diff --git a/src/plugins/themeAttributes/index.ts b/src/plugins/themeAttributes/index.ts index 9cb95874c..25753b39d 100644 --- a/src/plugins/themeAttributes/index.ts +++ b/src/plugins/themeAttributes/index.ts @@ -40,10 +40,16 @@ export default definePlugin({ // popout profiles { find: "#{intl::LABEL_WITH_ONLINE_STATUS}", - replacement: { - match: /src:null!=\i\?(\i).{1,50}"aria-hidden":!0/, - replace: "$&,style:$self.getAvatarStyles($1)" - } + replacement: [ + { + match: /src:null!=\i\?(\i).{1,50}"aria-hidden":!0/, + replace: "$&,style:$self.getAvatarStyles($1)" + }, + { + match: /src:(\i)\?\?void 0.{1,50}"aria-hidden":!0/, + replace: "$&,style:$self.getAvatarStyles($1)" + } + ] }, // chat avatars { diff --git a/src/plugins/typingTweaks/index.tsx b/src/plugins/typingTweaks/index.tsx index 8369497c2..8b558562b 100644 --- a/src/plugins/typingTweaks/index.tsx +++ b/src/plugins/typingTweaks/index.tsx @@ -111,7 +111,7 @@ export default definePlugin({ replace: "$self.renderTypingUsers({ users: arguments[0]?.typingUserObjects, guildId: arguments[0]?.channel?.guild_id, children: $& })" }, { - match: /(?<=function \i\(\i\)\{)(?=[^}]+?\{channel:\i,isThreadCreation:\i=!1\})/, + match: /(?<=function \i\(\i\)\{)(?=[^}]+?\{channel:\i,isThreadCreation:\i=!1,\.\.\.\i\})/, replace: "let typingUserObjects = $self.useTypingUsers(arguments[0]?.channel);" }, { diff --git a/src/plugins/userMessagesPronouns/index.ts b/src/plugins/userMessagesPronouns/index.ts index 9eaab235f..56721e11f 100644 --- a/src/plugins/userMessagesPronouns/index.ts +++ b/src/plugins/userMessagesPronouns/index.ts @@ -44,7 +44,7 @@ export default definePlugin({ replacement: [ { // Add next to username (compact mode) - match: /className:\i\(\)\(\i\.className(?:,\i\.clickable)?,\i\)}\)\),(?=\i)/g, + match: /className:\i\(\)\(\i\.className(?:,\i\.\i)?,\i\)\}\)(?:\))?,(?=\i)/g, replace: "$&$self.CompactPronounsChatComponentWrapper(arguments[0]),", }, ] diff --git a/src/plugins/usrbg/index.tsx b/src/plugins/usrbg/index.tsx index 86f122c8e..36efe355e 100644 --- a/src/plugins/usrbg/index.tsx +++ b/src/plugins/usrbg/index.tsx @@ -54,9 +54,9 @@ export default definePlugin({ settings, patches: [ { - find: '.banner)==null?"COMPLETE"', + find: ':"SHOULD_LOAD");', replacement: { - match: /(?<=void 0:)\i.getPreviewBanner\(\i,\i,\i\)/, + match: /\i(?:\?)?.getPreviewBanner\(\i,\i,\i\)(?=.{0,100}"COMPLETE")/, replace: "$self.patchBannerUrl(arguments[0])||$&" } diff --git a/src/plugins/validReply/index.ts b/src/plugins/validReply/index.ts index 0f0a198dd..d5d54195e 100644 --- a/src/plugins/validReply/index.ts +++ b/src/plugins/validReply/index.ts @@ -44,10 +44,16 @@ export default definePlugin({ }, { find: "ReferencedMessageStore", - replacement: { - match: /constructor\(\)\{\i\(this,"_channelCaches",new Map\)/, - replace: "$&;$self.setReplyStore(this);" - } + replacement: [ + { + match: /constructor\(\)\{\i\(this,"_channelCaches",new Map\)/, + replace: "$&;$self.setReplyStore(this);" + }, + { + match: /_channelCaches=new Map;/, + replace: "$&_=$self.setReplyStore(this);" + } + ] } ], diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx index 891a2c7c4..bbcebfaa4 100644 --- a/src/plugins/viewIcons/index.tsx +++ b/src/plugins/viewIcons/index.tsx @@ -206,10 +206,16 @@ export default definePlugin({ // Banners { find: 'backgroundColor:"COMPLETE"', - replacement: { - match: /(overflow:"visible",.{0,125}?!1\),)style:{(?=.+?backgroundImage:null!=(\i)\?"url\("\.concat\(\2,)/, - replace: (_, rest, bannerSrc) => `${rest}onClick:()=>${bannerSrc}!=null&&$self.openBanner(${bannerSrc}),style:{cursor:${bannerSrc}!=null?"pointer":void 0,` - } + replacement: [ + { + match: /(overflow:"visible",.{0,125}?!1\),)style:{(?=.+?backgroundImage:null!=(\i)\?"url\("\.concat\(\2,)/, + replace: (_, rest, bannerSrc) => `${rest}onClick:()=>${bannerSrc}!=null&&$self.openBanner(${bannerSrc}),style:{cursor:${bannerSrc}!=null?"pointer":void 0,` + }, + { + match: /(overflow:"visible",.{0,125}?!1\),)style:{(?=.+?backgroundImage:null!=(\i)\?`url\(\$\{\2\}\))/, + replace: (_, rest, bannerSrc) => `${rest}onClick:()=>${bannerSrc}!=null&&$self.openBanner(${bannerSrc}),style:{cursor:${bannerSrc}!=null?"pointer":void 0,` + } + ] }, // Group DMs top small & large icon { diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts index f8c77ab95..e4b9c510f 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -24,9 +24,9 @@ import { saveFile } from "@utils/web"; import { filters, mapMangledModuleLazy } from "@webpack"; import { ComponentDispatch } from "@webpack/common"; -const ctxMenuCallbacks = mapMangledModuleLazy('.tagName)==="TEXTAREA"||', { - contextMenuCallbackWeb: filters.byCode('.tagName)==="INPUT"||'), - contextMenuCallbackNative: filters.byCode('.tagName)==="TEXTAREA"||') +const ctxMenuCallbacks = mapMangledModuleLazy('closest("[contenteditable=true]")', { + contextMenuCallbackWeb: filters.byCode('"[contenteditable=true]"'), + contextMenuCallbackNative: filters.byCode('.getPropertyValue("-webkit-user-select")') }); async function fetchImage(url: string) { diff --git a/src/plugins/webKeybinds.web/index.ts b/src/plugins/webKeybinds.web/index.ts index 6a0da3573..783f965d9 100644 --- a/src/plugins/webKeybinds.web/index.ts +++ b/src/plugins/webKeybinds.web/index.ts @@ -55,7 +55,7 @@ export default definePlugin({ break; case ",": e.preventDefault(); - SettingsRouter.open("My Account"); + SettingsRouter.openUserSettings("my_account_panel"); break; default: if (e.key >= "1" && e.key <= "9") { diff --git a/src/plugins/webScreenShareFixes.web/index.ts b/src/plugins/webScreenShareFixes.web/index.ts index 624423001..8eb2e6269 100644 --- a/src/plugins/webScreenShareFixes.web/index.ts +++ b/src/plugins/webScreenShareFixes.web/index.ts @@ -21,6 +21,10 @@ export default definePlugin({ match: /"x-google-max-bitrate=".concat\(\i\)/, replace: '"x-google-max-bitrate=".concat("80_000")' }, + { + match: /`x-google-max-bitrate=\$\{\i\}`/, + replace: '"x-google-max-bitrate=80_000"' + }, { match: ";level-asymmetry-allowed=1", replace: ";b=AS:800000;level-asymmetry-allowed=1" @@ -28,7 +32,11 @@ export default definePlugin({ { match: /;usedtx=".concat\((\i)\?"0":"1"\)/, replace: '$&.concat($1?";stereo=1;sprop-stereo=1":"")' - } + }, + { + match: /;usedtx=\$\{(\i)\?"0":"1"\}/, + replace: '$&${$1?";stereo=1;sprop-stereo=1":""}' + }, ] } ] diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx index 723301164..7a39f35b2 100644 --- a/src/plugins/whoReacted/index.tsx +++ b/src/plugins/whoReacted/index.tsx @@ -99,7 +99,7 @@ export default definePlugin({ find: "cleanAutomaticAnchor(){", replacement: { - match: /constructor\(\i\)\{(?=.{0,100}automaticAnchor)/, + match: /constructor\(\i\)\{(?=.{0,100}(?:automaticAnchor|\.messages\.loadingMore))/, replace: "$&$self.setScrollObj(this);" } } diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index f44ba0343..e830e52ef 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -107,7 +107,7 @@ waitFor(m => { } const str = String(m); - return str.includes(".resolve({theme:null") && !str.includes("useMemo"); + return str.includes(".resolve({theme:") && str.includes('"refresh-fast-follow-avatars"') && !str.includes("useMemo"); }, m => useToken = m); export const MaskedLink = waitForComponent("MaskedLink", filters.componentByCode("MASKED_LINK)")); diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts index c76c3ead5..368d4d108 100644 --- a/src/webpack/common/utils.ts +++ b/src/webpack/common/utils.ts @@ -143,7 +143,7 @@ export const UploadHandler = { export const ApplicationAssetUtils = mapMangledModuleLazy("getAssetImage: size must === [", { fetchAssetIds: filters.byCode('.startsWith("http:")', ".dispatch({"), - getAssetFromImageURL: filters.byCode("].serialize(", ',":"'), + getAssetFromImageURL: filters.byCode("].serialize(", ":null"), getAssetImage: filters.byCode("getAssetImage: size must === ["), getAssets: filters.byCode(".assets") }); @@ -160,7 +160,7 @@ export const ChannelRouter: t.ChannelRouter = mapMangledModuleLazy('"Thread must }); export let SettingsRouter: any; -waitFor(["open", "saveAccountChanges"], m => SettingsRouter = m); +waitFor(["openUserSettings", "USER_SETTINGS_MODAL_KEY"], m => SettingsRouter = m); export const PermissionsBits: t.PermissionsBits = findLazy(m => typeof m.ADMINISTRATOR === "bigint");