From 22d3fb10e9c0527a112b7f9f804b21a6f9302898 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Sun, 3 Aug 2025 09:05:26 -0400 Subject: [PATCH] fix plugins broken by latest Discord update (#3574) Co-authored-by: V --- src/plugins/_api/dynamicImageModalApi.ts | 5 +++-- src/plugins/_api/messageEvents.ts | 2 +- src/plugins/decor/index.tsx | 2 +- src/plugins/favGifSearch/index.tsx | 4 ++-- src/plugins/showHiddenChannels/index.tsx | 14 ++++++++++++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/plugins/_api/dynamicImageModalApi.ts b/src/plugins/_api/dynamicImageModalApi.ts index d91a5a93..114b4836 100644 --- a/src/plugins/_api/dynamicImageModalApi.ts +++ b/src/plugins/_api/dynamicImageModalApi.ts @@ -16,8 +16,9 @@ export default definePlugin({ { find: ".dimensionlessImage,", replacement: { - match: /(?<="IMAGE"===\i&&\(\i=)\i(?=\?)/, - replace: "true" + // widthAndHeightPassed = w != null && w !== 0 && h == null || h === 0 + match: /(?<=\i=)(null!=\i&&0!==\i)&&(null!=\i&&0!==\i)/, + replace: "($1)||($2)" } } ] diff --git a/src/plugins/_api/messageEvents.ts b/src/plugins/_api/messageEvents.ts index 9dfc55e2..e5192763 100644 --- a/src/plugins/_api/messageEvents.ts +++ b/src/plugins/_api/messageEvents.ts @@ -27,7 +27,7 @@ export default definePlugin({ { find: "#{intl::EDIT_TEXTAREA_HELP}", replacement: { - match: /(?<=,channel:\i\}\)\.then\().+?(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/, + match: /(?<=,channel:\i\}\)\.then\().+?\i\.content!==this\.props\.message\.content&&\i\((.+?)\)\}(?=return)/, replace: (match, args) => "" + `async ${match}` + `if(await Vencord.Api.MessageEvents._handlePreEdit(${args}))` + diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index 0a6dd85d..a141f2b5 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -71,7 +71,7 @@ export default definePlugin({ }, // Remove NEW label from decor avatar decorations { - match: /(?<=\.\i\.PREMIUM_PURCHASE&&\i)(?<=avatarDecoration:(\i).+?)/, + match: /(?<=\.\i\.PURCHASE)(?=,)(?<=avatarDecoration:(\i).+?)/, replace: "||$1.skuId===$self.SKU_ID" } ] diff --git a/src/plugins/favGifSearch/index.tsx b/src/plugins/favGifSearch/index.tsx index 5e302912..d88ced34 100644 --- a/src/plugins/favGifSearch/index.tsx +++ b/src/plugins/favGifSearch/index.tsx @@ -35,7 +35,7 @@ interface SearchBarComponentProps { } type TSearchBarComponent = - React.FC & { Sizes: Record<"SMALL" | "MEDIUM" | "LARGE", string>; }; + React.FC; interface Gif { format: number; @@ -182,7 +182,7 @@ function SearchBar({ instance, SearchBarComponent }: { instance: Instance; Searc ref={ref} autoFocus={true} className={containerClasses.searchBar} - size={SearchBarComponent.Sizes.MEDIUM} + size="md" onChange={onChange} onClear={() => { setQuery(""); diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index d582c8c7..2d0ea368 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -292,8 +292,8 @@ export default definePlugin({ replacement: [ { // Change the role permission check to CONNECT if the channel is locked - match: /ADMINISTRATOR\)\|\|(?<=context:(\i)}.+?)(?=(.+?)VIEW_CHANNEL)/, - replace: (m, channel, permCheck) => `${m}!Vencord.Webpack.Common.PermissionStore.can(${CONNECT}n,${channel})?${permCheck}CONNECT):` + match: /\i\.\i\(\i\.\i\.ADMINISTRATOR,\i\.\i\.VIEW_CHANNEL\)(?<=context:(\i)}.+?)/, + replace: (m, channel) => `$self.fixPermCheck(${m},${channel})` }, { // Change the permissionOverwrite check to CONNECT if the channel is locked @@ -492,6 +492,16 @@ export default definePlugin({ } ], + + fixPermCheck(originalPerms: bigint, channel: Channel) { + if (!PermissionStore.can(PermissionsBits.CONNECT, channel)) { + originalPerms &= ~PermissionsBits.VIEW_CHANNEL; + originalPerms |= PermissionsBits.CONNECT; + } + + return originalPerms; + }, + isHiddenChannel(channel: Channel & { channelId?: string; }, checkConnect = false) { try { if (channel == null || Object.hasOwn(channel, "channelId") && channel.channelId == null) return false;