diff --git a/src/plugins/_api/dynamicImageModalApi.ts b/src/plugins/_api/dynamicImageModalApi.ts index 2ce51400d..4d74cff24 100644 --- a/src/plugins/_api/dynamicImageModalApi.ts +++ b/src/plugins/_api/dynamicImageModalApi.ts @@ -16,8 +16,8 @@ export default definePlugin({ { find: "SCALE_DOWN:", replacement: { - match: /!\(null==(\i)\|\|0===\i\|\|null==(\i)\|\|0===\i\)/, - replace: (_, width, height) => `!((null == ${width} || 0 === ${width}) && (null == ${height} || 0 === ${height}))` + match: /(?<="IMAGE"===\i\?)\i(?=\?)/, + replace: "true" } } ] diff --git a/src/plugins/betterUploadButton/index.ts b/src/plugins/betterUploadButton/index.ts index c08d43282..29827a5e9 100644 --- a/src/plugins/betterUploadButton/index.ts +++ b/src/plugins/betterUploadButton/index.ts @@ -26,10 +26,18 @@ export default definePlugin({ patches: [ { find: '"ChannelAttachButton"', - replacement: { - match: /\.attachButtonInner,"aria-label":.{0,50},onDoubleClick:(.+?:void 0),.{0,30}?\.\.\.(\i),/, - replace: "$&onClick:$1,onContextMenu:$2.onClick,", - }, + replacement: [ + { + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert + match: /\.attachButtonInner,"aria-label":.{0,50},onDoubleClick:(.+?:void 0),.{0,30}?\.\.\.(\i),/, + replace: "$&onClick:$1,onContextMenu:$2.onClick,", + noWarn: true + }, + { + match: /\.attachButtonInner,"aria-label":.{0,50},onDoubleClick:(.+?:void 0),.{0,100}\},(\i)\).{0,100}children:\i/, + replace: "$&,onClick:$1,onContextMenu:$2.onClick,", + }, + ] }, ], }); diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index 69a7a1a59..4801cf753 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -50,12 +50,24 @@ export default definePlugin({ find: ".decorationGridItem,", replacement: [ { - match: /(?<==)\i=>{let{children.{20,100}decorationGridItem/, - replace: "$self.DecorationGridItem=$&" + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert + match: /(?<==)\i=>{let{children.{20,200}decorationGridItem/, + replace: "$self.DecorationGridItem=$&", + noWarn: true }, { + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert match: /(?<==)\i=>{let{user:\i,avatarDecoration/, - replace: "$self.DecorationGridDecoration=$&" + replace: "$self.DecorationGridDecoration=$&", + noWarn: true + }, + { + match: /(?<==)\i=>{var{children.{20,200}decorationGridItem/, + replace: "$self.DecorationGridItem=$&", + }, + { + match: /(?<==)\i=>{var{user:\i,avatarDecoration/, + replace: "$self.DecorationGridDecoration=$&", }, // Remove NEW label from decor avatar decorations { diff --git a/src/plugins/implicitRelationships/index.ts b/src/plugins/implicitRelationships/index.ts index cfc3818dd..f0be9ee54 100644 --- a/src/plugins/implicitRelationships/index.ts +++ b/src/plugins/implicitRelationships/index.ts @@ -34,7 +34,7 @@ export default definePlugin({ { find: "#{intl::FRIENDS_ALL_HEADER}", replacement: { - match: /toString\(\)\}\);case (\i\.\i)\.BLOCKED/, + match: /toString\(\)\}\);case (\i\.\i)\.PENDING/, replace: 'toString()});case $1.IMPLICIT:return "Implicit — "+arguments[1];case $1.BLOCKED' }, }, @@ -50,7 +50,7 @@ export default definePlugin({ { find: "#{intl::FRIENDS_SECTION_ONLINE}", replacement: { - match: /,{id:(\i\.\i)\.BLOCKED,show:.+?className:(\i\.item)/, + match: /,{id:(\i\.\i)\.PENDING,show:.+?className:(\i\.item)/, replace: (rest, relationShipTypes, className) => `,{id:${relationShipTypes}.IMPLICIT,show:true,className:${className},content:"Implicit"}${rest}` } }, @@ -58,7 +58,7 @@ export default definePlugin({ { find: '"FriendsStore"', replacement: { - match: /(?<=case (\i\.\i)\.BLOCKED:return (\i)\.type===\i\.\i\.BLOCKED)/, + match: /(?<=case (\i\.\i)\.SUGGESTIONS:return \d+===(\i)\.type)/, replace: ";case $1.IMPLICIT:return $2.type===5" }, }, diff --git a/src/plugins/memberCount/index.tsx b/src/plugins/memberCount/index.tsx index 67bbc4ce8..ad7491cc3 100644 --- a/src/plugins/memberCount/index.tsx +++ b/src/plugins/memberCount/index.tsx @@ -65,10 +65,18 @@ export default definePlugin({ patches: [ { find: "{isSidebarVisible:", - replacement: { - match: /(?<=let\{className:(\i),.+?children):\[(\i\.useMemo[^}]+"aria-multiselectable")/, - replace: ":[$1?.startsWith('members')?$self.render():null,$2" - }, + replacement: [ + { + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert + match: /(?<=let\{className:(\i),.+?children):\[(\i\.useMemo[^}]+"aria-multiselectable")/, + replace: ":[$1?.startsWith('members')?$self.render():null,$2", + noWarn: true + }, + { + match: /(?<=var\{className:(\i),.+?children):\[(\i\.useMemo[^}]+"aria-multiselectable")/, + replace: ":[$1?.startsWith('members')?$self.render():null,$2", + }, + ], predicate: () => settings.store.memberList }, { diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 7b7bcc44d..ffa2b5a25 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -84,8 +84,14 @@ export default definePlugin({ find: ".USER_MENTION)", replacement: [ { + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert match: /onContextMenu:\i,color:\i,\.\.\.\i(?=,children:)(?<=user:(\i),channel:(\i).{0,500}?)/, - replace: "$&,color:$self.getColorInt($1?.id,$2?.id)" + replace: "$&,color:$self.getColorInt($1?.id,$2?.id)", + noWarn: true + }, + { + match: /(?<=onContextMenu:\i,color:)\i(?=\},\i\),\{children)(?<=user:(\i),channel:(\i).{0,500}?)/, + replace: "$self.getColorInt($1?.id,$2?.id)", } ], predicate: () => settings.store.chatMentions diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index ccaff2ad8..36abe30ec 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -204,7 +204,7 @@ export default definePlugin({ { // Hide unreads predicate: () => settings.store.hideUnreads === true, - match: /{channel:(\i),name:\i,.+?unread:(\i).+?;/, + match: /\.subtitle,.+?;(?=return\(0,\i\.jsxs?\))(?<={channel:(\i),name:\i,.+?unread:(\i).+?)/, replace: (m, channel, unread) => `${m}${unread}=$self.isHiddenChannel(${channel})?false:${unread};` } ] @@ -485,7 +485,7 @@ export default definePlugin({ } }, { - find: '="NowPlayingViewStore",', + find: '"NowPlayingViewStore"', replacement: { // Make active now voice states on hidden channels match: /(getVoiceStateForUser.{0,150}?)&&\i\.\i\.canWithPartialContext.{0,20}VIEW_CHANNEL.+?}\)(?=\?)/, diff --git a/src/plugins/startupTimings/index.tsx b/src/plugins/startupTimings/index.tsx index aabc786a4..ac7f3f0c8 100644 --- a/src/plugins/startupTimings/index.tsx +++ b/src/plugins/startupTimings/index.tsx @@ -27,12 +27,22 @@ export default definePlugin({ authors: [Devs.Megu], patches: [{ find: "#{intl::ACTIVITY_SETTINGS}", - replacement: { - match: /(?<=}\)([,;])(\i\.settings)\.forEach.+?(\i)\.push.+}\)}\))/, - replace: (_, commaOrSemi, settings, elements) => "" + - `${commaOrSemi}${settings}?.[0]==="CHANGELOG"` + - `&&${elements}.push({section:"StartupTimings",label:"Startup Timings",element:$self.StartupTimingPage})` - } + replacement: [ + { + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert + match: /(?<=}\)([,;])(\i\.settings)\.forEach.+?(\i)\.push.+}\)}\))/, + replace: (_, commaOrSemi, settings, elements) => "" + + `${commaOrSemi}${settings}?.[0]==="CHANGELOG"` + + `&&${elements}.push({section:"StartupTimings",label:"Startup Timings",element:$self.StartupTimingPage})`, + noWarn: true + }, + { + match: /(?<=}\)([,;])(\i\.settings)\.forEach.+?(\i)\.push.+\)\)\}\))(?=\)\})/, + replace: (_, commaOrSemi, settings, elements) => "" + + `${commaOrSemi}${settings}?.[0]==="CHANGELOG"` + + `&&${elements}.push({section:"StartupTimings",label:"Startup Timings",element:$self.StartupTimingPage})`, + }, + ] }], StartupTimingPage }); diff --git a/src/plugins/userMessagesPronouns/index.ts b/src/plugins/userMessagesPronouns/index.ts index 27b162b90..1699251ee 100644 --- a/src/plugins/userMessagesPronouns/index.ts +++ b/src/plugins/userMessagesPronouns/index.ts @@ -41,11 +41,20 @@ export default definePlugin({ }, { find: '="SYSTEM_TAG"', - replacement: { - // Add next to username (compact mode) - match: /className:\i\(\)\(\i\.className(?:,\i\.clickable)?,\i\)}\),(?=\i)/g, - replace: "$&$self.CompactPronounsChatComponentWrapper(arguments[0])," - } + replacement: [ + { + // Add next to username (compact mode) + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert + match: /className:\i\(\)\(\i\.className(?:,\i\.clickable)?,\i\)}\),(?=\i)/g, + replace: "$&$self.CompactPronounsChatComponentWrapper(arguments[0]),", + noWarn: true + }, + { + // Add next to username (compact mode) + match: /className:\i\(\)\(\i\.className(?:,\i\.clickable)?,\i\)}\)\),(?=\i)/g, + replace: "$&$self.CompactPronounsChatComponentWrapper(arguments[0]),", + }, + ] } ], diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx index 12ee18e14..afd9d48c5 100644 --- a/src/plugins/viewIcons/index.tsx +++ b/src/plugins/viewIcons/index.tsx @@ -193,10 +193,18 @@ export default definePlugin({ // Avatar component used in User DMs "User Profile" popup in the right and Profiles Modal pfp { find: ".overlay:void 0,status:", - replacement: { - match: /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/, - replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openAvatar($1)}," - }, + replacement: [ + { + // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert + match: /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/, + replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openAvatar($1)},", + noWarn: true + }, + { + match: /avatarSrc:(\i),eventHandlers:(\i).+?"div",.{0,100}className:\i,/, + replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openAvatar($1)},", + } + ], all: true }, // Banners diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index e46e44ad7..526c5514b 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -20,9 +20,9 @@ export function makeLazy(factory: () => T, attempts = 5): () => T { let tries = 0; let cache: T; return () => { - if (!cache && attempts > tries++) { + if (cache === undefined && attempts > tries++) { cache = factory(); - if (!cache && attempts === tries) + if (cache === undefined && attempts === tries) console.error("Lazy factory failed:", factory); } return cache; diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index e31e167e8..2681d51d3 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -41,7 +41,7 @@ export const Switch = waitForComponent("Switch", filters.componentByCo const Tooltips = mapMangledModuleLazy(".tooltipTop,bottom:", { Tooltip: filters.componentByCode("this.renderTooltip()]"), - TooltipContainer: filters.componentByCode('="div",') + TooltipContainer: filters.componentByCode('="div"') }) as { Tooltip: t.Tooltip, TooltipContainer: t.TooltipContainer;