fix plugins broken by latest Discord update (#3574)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
sadan4 2025-08-03 09:05:26 -04:00 committed by GitHub
parent fa672a347d
commit 22d3fb10e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 8 deletions

View file

@ -16,8 +16,9 @@ export default definePlugin({
{ {
find: ".dimensionlessImage,", find: ".dimensionlessImage,",
replacement: { replacement: {
match: /(?<="IMAGE"===\i&&\(\i=)\i(?=\?)/, // widthAndHeightPassed = w != null && w !== 0 && h == null || h === 0
replace: "true" match: /(?<=\i=)(null!=\i&&0!==\i)&&(null!=\i&&0!==\i)/,
replace: "($1)||($2)"
} }
} }
] ]

View file

@ -27,7 +27,7 @@ export default definePlugin({
{ {
find: "#{intl::EDIT_TEXTAREA_HELP}", find: "#{intl::EDIT_TEXTAREA_HELP}",
replacement: { 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) => "" + replace: (match, args) => "" +
`async ${match}` + `async ${match}` +
`if(await Vencord.Api.MessageEvents._handlePreEdit(${args}))` + `if(await Vencord.Api.MessageEvents._handlePreEdit(${args}))` +

View file

@ -71,7 +71,7 @@ export default definePlugin({
}, },
// Remove NEW label from decor avatar decorations // 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" replace: "||$1.skuId===$self.SKU_ID"
} }
] ]

View file

@ -35,7 +35,7 @@ interface SearchBarComponentProps {
} }
type TSearchBarComponent = type TSearchBarComponent =
React.FC<SearchBarComponentProps> & { Sizes: Record<"SMALL" | "MEDIUM" | "LARGE", string>; }; React.FC<SearchBarComponentProps>;
interface Gif { interface Gif {
format: number; format: number;
@ -182,7 +182,7 @@ function SearchBar({ instance, SearchBarComponent }: { instance: Instance; Searc
ref={ref} ref={ref}
autoFocus={true} autoFocus={true}
className={containerClasses.searchBar} className={containerClasses.searchBar}
size={SearchBarComponent.Sizes.MEDIUM} size="md"
onChange={onChange} onChange={onChange}
onClear={() => { onClear={() => {
setQuery(""); setQuery("");

View file

@ -292,8 +292,8 @@ export default definePlugin({
replacement: [ replacement: [
{ {
// Change the role permission check to CONNECT if the channel is locked // Change the role permission check to CONNECT if the channel is locked
match: /ADMINISTRATOR\)\|\|(?<=context:(\i)}.+?)(?=(.+?)VIEW_CHANNEL)/, match: /\i\.\i\(\i\.\i\.ADMINISTRATOR,\i\.\i\.VIEW_CHANNEL\)(?<=context:(\i)}.+?)/,
replace: (m, channel, permCheck) => `${m}!Vencord.Webpack.Common.PermissionStore.can(${CONNECT}n,${channel})?${permCheck}CONNECT):` replace: (m, channel) => `$self.fixPermCheck(${m},${channel})`
}, },
{ {
// Change the permissionOverwrite check to CONNECT if the channel is locked // 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) { isHiddenChannel(channel: Channel & { channelId?: string; }, checkConnect = false) {
try { try {
if (channel == null || Object.hasOwn(channel, "channelId") && channel.channelId == null) return false; if (channel == null || Object.hasOwn(channel, "channelId") && channel.channelId == null) return false;