diff --git a/src/plugins/_api/commands.ts b/src/plugins/_api/commands.ts index cca1a6862..2af65b6f9 100644 --- a/src/plugins/_api/commands.ts +++ b/src/plugins/_api/commands.ts @@ -51,11 +51,17 @@ export default definePlugin({ // Show plugin name instead of "Built-In" { find: "#{intl::COMMANDS_OPTIONAL_COUNT}", - replacement: { - // ...children: p?.name - match: /(?<=:(\i)\.displayDescription\}.{0,200}children:).{0,50}\.name(?=\}\))/, - replace: "$1.plugin||($&)" - } + replacement: [ + { + // ...children: p?.name + match: /(?<=:(\i)\.displayDescription\}.{0,200}children:).{0,50}\.name(?=\}\))/, + replace: "$1.plugin||($&)" + }, + { + match: /children:(?=\i\?\?\i\?\.name)(?<=command:(\i),.+?)/, + replace: "children:$1.plugin??" + } + ] } ], }); diff --git a/src/plugins/_api/dynamicImageModalApi.ts b/src/plugins/_api/dynamicImageModalApi.ts index 58ee2989f..959f490bf 100644 --- a/src/plugins/_api/dynamicImageModalApi.ts +++ b/src/plugins/_api/dynamicImageModalApi.ts @@ -13,7 +13,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/messageEvents.ts b/src/plugins/_api/messageEvents.ts index ca38846ba..70b7f26c3 100644 --- a/src/plugins/_api/messageEvents.ts +++ b/src/plugins/_api/messageEvents.ts @@ -38,7 +38,7 @@ export default definePlugin({ find: ".handleSendMessage,onResize:", replacement: { // https://regex101.com/r/7iswuk/1 - match: /let (\i)=\i\.\i\.parse\((\i),.+?\.getSendMessageOptions\(\{.+?\}\);(?=.+?(\i)\.flags=)(?<=\)\(({.+?})\)\.then.+?)/, + match: /let (\i)=\i\.\i\.parse\((\i),.+?\.getSendMessageOptions\(\{.+?\}\)?;(?=.+?(\i)\.flags=)(?<=\)\(({.+?})\)\.then.+?)/, replace: (m, parsedMessage, channel, replyOptions, extra) => m + `if(await Vencord.Api.MessageEvents._handlePreSend(${channel}.id,${parsedMessage},${extra},${replyOptions}))` + "return{shouldClear:false,shouldRefocus:true};" 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 99ad9071c..101e70c57 100644 --- a/src/plugins/betterGifPicker/index.ts +++ b/src/plugins/betterGifPicker/index.ts @@ -25,11 +25,17 @@ export default definePlugin({ settings, 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"' + } + ] }, { find: "#{intl::NO_GIF_FAVORITES_HOW_TO_FAVORITE}", 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/blurNsfw/index.ts b/src/plugins/blurNsfw/index.ts index 61923894e..d37545836 100644 --- a/src/plugins/blurNsfw/index.ts +++ b/src/plugins/blurNsfw/index.ts @@ -49,7 +49,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 ac7dbbb24..c0a52193b 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -148,10 +148,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."', @@ -162,10 +168,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", @@ -183,17 +195,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 9a6192e0b..8b158e6df 100644 --- a/src/plugins/consoleShortcuts/index.ts +++ b/src/plugins/consoleShortcuts/index.ts @@ -249,11 +249,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 50b6a41c7..44f18f6c1 100644 --- a/src/plugins/customRPC/index.tsx +++ b/src/plugins/customRPC/index.tsx @@ -227,7 +227,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 388eb6fcd..77cccc6ba 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" } ] })), diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 29ccf1719..5a776bd6d 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -299,13 +299,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,.{0,15}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/imageZoom/index.tsx b/src/plugins/imageZoom/index.tsx index 724bda2fb..bbd9b82a6 100644 --- a/src/plugins/imageZoom/index.tsx +++ b/src/plugins/imageZoom/index.tsx @@ -162,7 +162,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 9986769fa..8c63fe5a2 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 2351592d3..658b6ec28 100644 --- a/src/plugins/mentionAvatars/index.tsx +++ b/src/plugins/mentionAvatars/index.tsx @@ -52,10 +52,16 @@ export default definePlugin({ patches: [{ // HEY THOR UPDATE SHOW ME YOUR NAME IF THIS SHIT CHANGES TY :) find: ".USER_MENTION)", - replacement: { - match: /"@"\.concat\((null!=\i\?\i:\i)\)(?<=\.useName\((\i)\).+?)/, - replace: "$self.renderUsername({username:$1,user:$2,showMeYourNameMention:typeof showMeYourNameMention!=='undefined'?showMeYourNameMention:undefined})" - } + replacement: [ + { + match: /children:"@"\.concat\((null!=\i\?\i:\i)\)(?<=\.useName\((\i)\).+?)/, + replace: "children:$self.renderUsername({username:$1,user:$2,showMeYourNameMention:typeof showMeYourNameMention!=='undefined'?showMeYourNameMention:undefined})" + }, + { + match: /children:`@\$\{(\i\?\?\i)\}`(?<=\.useName\((\i)\).+?)/, + replace: "children:$self.renderUsername({username:$1,user:$2,showMeYourNameMention:typeof showMeYourNameMention!=='undefined'?showMeYourNameMention:undefined})" + } + ] }, { find: ".ROLE_MENTION)", diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index eb2d8e006..0c21455ed 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -715,7 +715,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 index 82076ef20..335cf27fc 100644 --- a/src/plugins/normalizeMessageLinks/index.ts +++ b/src/plugins/normalizeMessageLinks/index.ts @@ -15,8 +15,8 @@ export default definePlugin({ { find: "#{intl::COPY_MESSAGE_LINK}", replacement: { - match: /\.concat\(location\.host\)/, - replace: ".concat($self.normalizeHost(location.host))", + match: /(?<=(?:.concat\(|\/\/\$\{))location\.host/, + replace: "$self.normalizeHost(location.host)", }, }, ], diff --git a/src/plugins/pinDms/components/CreateCategoryModal.tsx b/src/plugins/pinDms/components/CreateCategoryModal.tsx index b35d2cd6c..4543fa6aa 100644 --- a/src/plugins/pinDms/components/CreateCategoryModal.tsx +++ b/src/plugins/pinDms/components/CreateCategoryModal.tsx @@ -26,7 +26,8 @@ interface ColorPickerWithSwatchesProps { const ColorPickerWithSwatches = findComponentByCodeLazy('id:"color-picker"'); -export const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}(\i\.\i\("?.+?"?\).*?).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/); +// 701663 this is terrible imo +export const requireSettingsMenu = extractAndLoadChunksLazy(['"AppSkeleton"'], /createPromise:.{0,20}(\i\.\i\("?.+?"?\).*?).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}\}\),(?=.{0,15}createPromise.*?\}\),)/); const cl = classNameFactory("vc-pindms-modal-"); diff --git a/src/plugins/pinDms/index.tsx b/src/plugins/pinDms/index.tsx index b2345ea1a..7559abaa9 100644 --- a/src/plugins/pinDms/index.tsx +++ b/src/plugins/pinDms/index.tsx @@ -73,7 +73,7 @@ export default definePlugin({ patches: [ { - find: '"private-channels-".concat(', + find: '"dm-quick-launcher"===', replacement: [ { // Filter out pinned channels from the private channel list @@ -88,15 +88,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()," }, @@ -106,7 +106,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/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 8b690b7ea..6ad0a3d69 100644 --- a/src/plugins/reviewDB/components/ReviewsView.tsx +++ b/src/plugins/reviewDB/components/ReviewsView.tsx @@ -32,7 +32,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/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 66ef9b806..6ef86c425 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -159,7 +159,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;" } }, @@ -223,7 +223,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})` @@ -250,19 +250,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})` }, { diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index b788a8bd1..82ff7a77c 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 74a67fd0c..be34e7a5a 100644 --- a/src/plugins/themeAttributes/index.ts +++ b/src/plugins/themeAttributes/index.ts @@ -39,10 +39,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/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 72e551c8b..b77efb8f7 100644 --- a/src/plugins/usrbg/index.tsx +++ b/src/plugins/usrbg/index.tsx @@ -58,9 +58,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 ee2a29493..e6d008f5f 100644 --- a/src/plugins/viewIcons/index.tsx +++ b/src/plugins/viewIcons/index.tsx @@ -205,10 +205,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 472f90406..2076404ab 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -24,7 +24,7 @@ import { saveFile } from "@utils/web"; import { filters, mapMangledModuleLazy } from "@webpack"; import { ComponentDispatch } from "@webpack/common"; -const ctxMenuCallbacks = mapMangledModuleLazy('.tagName)==="TEXTAREA"||', { +const ctxMenuCallbacks = mapMangledModuleLazy('closest("[contenteditable=true]")', { contextMenuCallbackWeb: filters.byCode('"[contenteditable=true]"'), contextMenuCallbackNative: filters.byCode('.getPropertyValue("-webkit-user-select")') }); 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 55804b442..cb2d6f977 100644 --- a/src/plugins/whoReacted/index.tsx +++ b/src/plugins/whoReacted/index.tsx @@ -110,7 +110,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/utils/modal.tsx b/src/utils/modal.tsx index 7787c5f6f..8ff3cebd2 100644 --- a/src/utils/modal.tsx +++ b/src/utils/modal.tsx @@ -101,7 +101,8 @@ interface Modals { }>; } -export const Modals: Modals = mapMangledModuleLazy('??"thin")', { +// TODO: move to new modal api +export const Modals: Modals = mapMangledModuleLazy(".MODAL_ROOT_LEGACY,", { ModalRoot: filters.componentByCode('.MODAL,"aria-labelledby":'), ModalHeader: filters.componentByCode(",id:"), ModalContent: filters.componentByCode("scrollbarType:"), diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index 57629cf7a..e830e52ef 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -60,7 +60,7 @@ export const TextInput = waitForComponent("TextInput", filters.comp export const TextArea = waitForComponent("TextArea", filters.componentByCode("this.getPaddingRight()},id:")); export const Select = waitForComponent("Select", filters.componentByCode('"Select"')); export const SearchableSelect = waitForComponent("SearchableSelect", filters.componentByCode('"SearchableSelect"')); -export const Slider = waitForComponent("Slider", filters.componentByCode("`markDash${null==")); +export const Slider = waitForComponent("Slider", filters.componentByCode("markDash", "this.renderMark(")); export const Popout = waitForComponent("Popout", filters.componentByCode("ref:this.ref,", "renderPopout:this.renderPopout,")); export const Dialog = waitForComponent("Dialog", filters.componentByCode('role:"dialog",tabIndex:-1')); export const TabBar = waitForComponent("TabBar", filters.componentByCode("ref:this.tabBarRef,className:")); @@ -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 f6176e36b..30fec83a6 100644 --- a/src/webpack/common/utils.ts +++ b/src/webpack/common/utils.ts @@ -147,7 +147,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") }); @@ -164,7 +164,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");