From 1abfb5f0cfad7a2c37251c15791cb5eaba51a220 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 25 Sep 2024 23:11:43 +0200 Subject: [PATCH 01/11] CustomIdle: fix crash on canary --- src/plugins/customidle/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/customidle/index.ts b/src/plugins/customidle/index.ts index ea56da10e..7d353f157 100644 --- a/src/plugins/customidle/index.ts +++ b/src/plugins/customidle/index.ts @@ -37,8 +37,8 @@ export default definePlugin({ find: 'type:"IDLE",idle:', replacement: [ { - match: /(?<=Date\.now\(\)-\i>)\i\.\i/, - replace: "$self.getIdleTimeout()" + match: /(?<=Date\.now\(\)-\i>)\i\.\i\|\|/, + replace: "$self.getIdleTimeout()||" }, { match: /Math\.min\((\i\.\i\.getSetting\(\)\*\i\.\i\.\i\.SECOND),\i\.\i\)/, From bc59fc41b3cdcca7f858a915011fcef9692f0c42 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:25:48 -0400 Subject: [PATCH 02/11] Fix multiple plugins for latest Discord update (#2911) Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> --- src/plugins/_api/notices.ts | 4 +-- src/plugins/anonymiseFileNames/index.tsx | 2 +- src/plugins/consoleJanitor/index.ts | 2 +- src/plugins/decor/index.tsx | 2 +- src/plugins/fakeNitro/index.tsx | 34 +++++++++--------- src/plugins/ignoreActivities/index.tsx | 4 +-- src/plugins/messageLogger/index.tsx | 44 ++++++++++++------------ src/plugins/moreUserTags/index.tsx | 8 ++--- src/plugins/noBlockedMessages/index.ts | 6 ++-- src/plugins/noPendingCount/index.ts | 4 +-- src/plugins/replyTimestamp/index.tsx | 4 +-- src/plugins/showHiddenChannels/index.tsx | 4 +-- src/plugins/showMeYourName/index.tsx | 2 +- src/plugins/superReactionTweaks/index.ts | 4 +-- src/plugins/userVoiceShow/components.tsx | 2 +- src/plugins/volumeBooster/index.ts | 2 +- src/plugins/whoReacted/index.tsx | 7 ++-- 17 files changed, 68 insertions(+), 67 deletions(-) diff --git a/src/plugins/_api/notices.ts b/src/plugins/_api/notices.ts index 0c6f6e1db..ceec6f825 100644 --- a/src/plugins/_api/notices.ts +++ b/src/plugins/_api/notices.ts @@ -33,8 +33,8 @@ export default definePlugin({ replace: "if(Vencord.Api.Notices.currentNotice)return false;$&" }, { - match: /(?<=,NOTICE_DISMISS:function\(\i\){)return null!=(\i)/, - replace: "if($1.id==\"VencordNotice\")return($1=null,Vencord.Api.Notices.nextNotice(),true);$&" + match: /(?<=function (\i)\(\i\){)return null!=(\i)(?=.*NOTICE_DISMISS:\1)/, + replace: "if($2.id==\"VencordNotice\")return($2=null,Vencord.Api.Notices.nextNotice(),true);$&" } ] } diff --git a/src/plugins/anonymiseFileNames/index.tsx b/src/plugins/anonymiseFileNames/index.tsx index 526ccd12e..0e97bc7f8 100644 --- a/src/plugins/anonymiseFileNames/index.tsx +++ b/src/plugins/anonymiseFileNames/index.tsx @@ -71,7 +71,7 @@ export default definePlugin({ description: "Anonymise uploaded file names", patches: [ { - find: "instantBatchUpload:function", + find: "instantBatchUpload:", replacement: { match: /uploadFiles:(\i),/, replace: diff --git a/src/plugins/consoleJanitor/index.ts b/src/plugins/consoleJanitor/index.ts index b0c8905f7..1cb705541 100644 --- a/src/plugins/consoleJanitor/index.ts +++ b/src/plugins/consoleJanitor/index.ts @@ -119,7 +119,7 @@ export default definePlugin({ { find: "Slow dispatch on", replacement: { - match: /\i\.totalTime>100&&\i\.verbose\("Slow dispatch on ".+?\)\);/, + match: /\i\.totalTime>\i&&\i\.verbose\("Slow dispatch on ".+?\)\);/, replace: "" } }, diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index c6cd895f9..33d1d40b7 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -54,7 +54,7 @@ export default definePlugin({ replace: "$self.DecorationGridItem=$&" }, { - match: /(?<==)\i=>{let{user:\i,avatarDecoration.{300,600}decorationGridItemChurned/, + match: /(?<==)\i=>{let{user:\i,avatarDecoration/, replace: "$self.DecorationGridDecoration=$&" }, // Remove NEW label from decor avatar decorations diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 2a7a0ee72..cfffedb99 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -254,11 +254,11 @@ export default definePlugin({ }, // Allow stickers to be sent everywhere { - find: "canUseCustomStickersEverywhere:function", + find: "canUseCustomStickersEverywhere:", predicate: () => settings.store.enableStickerBypass, replacement: { - match: /canUseCustomStickersEverywhere:function\(\i\){/, - replace: "$&return true;" + match: /(?<=canUseCustomStickersEverywhere:)\i/, + replace: "()=>true" }, }, // Make stickers always available @@ -272,15 +272,15 @@ export default definePlugin({ }, // Allow streaming with high quality { - find: "canUseHighVideoUploadQuality:function", + find: "canUseHighVideoUploadQuality:", predicate: () => settings.store.enableStreamQualityBypass, replacement: [ "canUseHighVideoUploadQuality", "canStreamQuality", ].map(func => { return { - match: new RegExp(`${func}:function\\(\\i(?:,\\i)?\\){`, "g"), - replace: "$&return true;" + match: new RegExp(`(?<=${func}:)\\i`, "g"), + replace: "()=>true" }; }) }, @@ -295,10 +295,10 @@ export default definePlugin({ }, // Allow client themes to be changeable { - find: "canUseClientThemes:function", + find: "canUseClientThemes:", replacement: { - match: /canUseClientThemes:function\(\i\){/, - replace: "$&return true;" + match: /(?<=canUseClientThemes:)\i/, + replace: "()=>true" } }, { @@ -306,8 +306,8 @@ export default definePlugin({ replacement: [ { // Overwrite incoming connection settings proto with our local settings - match: /CONNECTION_OPEN:function\((\i)\){/, - replace: (m, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);` + match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/, + replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);` }, { // Overwrite non local proto changes with our local settings @@ -400,10 +400,10 @@ export default definePlugin({ }, // Allow using custom app icons { - find: "canUsePremiumAppIcons:function", + find: "canUsePremiumAppIcons:", replacement: { - match: /canUsePremiumAppIcons:function\(\i\){/, - replace: "$&return true;" + match: /(?<=canUsePremiumAppIcons:)\i/, + replace: "()=>true" } }, // Separate patch for allowing using custom app icons @@ -424,10 +424,10 @@ export default definePlugin({ }, // Allow using custom notification sounds { - find: "canUseCustomNotificationSounds:function", + find: "canUseCustomNotificationSounds:", replacement: { - match: /canUseCustomNotificationSounds:function\(\i\){/, - replace: "$&return true;" + match: /(?<=canUseCustomNotificationSounds:)\i/, + replace: "()=>true" } } ], diff --git a/src/plugins/ignoreActivities/index.tsx b/src/plugins/ignoreActivities/index.tsx index 8c36e1d75..19f22e61d 100644 --- a/src/plugins/ignoreActivities/index.tsx +++ b/src/plugins/ignoreActivities/index.tsx @@ -244,7 +244,7 @@ export default definePlugin({ patches: [ { - find: '="LocalActivityStore",', + find: '"LocalActivityStore"', replacement: [ { match: /HANG_STATUS.+?(?=!\i\(\)\(\i,\i\)&&)(?<=(\i)\.push.+?)/, @@ -253,7 +253,7 @@ export default definePlugin({ ] }, { - find: '="ActivityTrackingStore",', + find: '"ActivityTrackingStore"', replacement: { match: /getVisibleRunningGames\(\).+?;(?=for)(?<=(\i)=\i\.\i\.getVisibleRunningGames.+?)/, replace: (m, runningGames) => `${m}${runningGames}=${runningGames}.filter(({id,name})=>$self.isActivityNotIgnored({type:0,application_id:id,name}));` diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index a08aeccce..70672e9e0 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -323,35 +323,35 @@ export default definePlugin({ replacement: [ { // Add deleted=true to all target messages in the MESSAGE_DELETE event - match: /MESSAGE_DELETE:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/, + match: /function (\i)\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function.*MESSAGE_DELETE:\1)/, replace: - "MESSAGE_DELETE:function($1){" + - " var cache = $2getOrCreate($1.channelId);" + - " cache = $self.handleDelete(cache, $1, false);" + - " $2commit(cache);" + - "}," + "function $1($2){" + + " var cache = $3getOrCreate($2.channelId);" + + " cache = $self.handleDelete(cache, $2, false);" + + " $3commit(cache);" + + "}" }, { // Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event - match: /MESSAGE_DELETE_BULK:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/, + match: /function (\i)\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function.*MESSAGE_DELETE_BULK:\1)/, replace: - "MESSAGE_DELETE_BULK:function($1){" + - " var cache = $2getOrCreate($1.channelId);" + - " cache = $self.handleDelete(cache, $1, true);" + - " $2commit(cache);" + - "}," + "function $1($2){" + + " var cache = $3getOrCreate($2.channelId);" + + " cache = $self.handleDelete(cache, $2, true);" + + " $3commit(cache);" + + "}" }, { // Add current cached content + new edit time to cached message's editHistory - match: /(MESSAGE_UPDATE:function\((\i)\).+?)\.update\((\i)/, + match: /(function (\i)\((\i)\).+?)\.update\((\i)(?=.*MESSAGE_UPDATE:\2)/, replace: "$1" + - ".update($3,m =>" + - " (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" + - " $2.message.edited_timestamp && $2.message.content !== m.content ?" + - " m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" + + ".update($4,m =>" + + " (($3.message.flags & 64) === 64 || $self.shouldIgnore($3.message, true)) ? m :" + + " $3.message.edited_timestamp && $3.message.content !== m.content ?" + + " m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($3.message, m)]) :" + " m" + ")" + - ".update($3" + ".update($4" }, { // fix up key (edit last message) attempting to edit a deleted message @@ -465,12 +465,12 @@ export default definePlugin({ find: '"ReferencedMessageStore"', replacement: [ { - match: /MESSAGE_DELETE:function\((\i)\).+?},/, - replace: "MESSAGE_DELETE:function($1){}," + match: /MESSAGE_DELETE:\i,/, + replace: "MESSAGE_DELETE:()=>{}," }, { - match: /MESSAGE_DELETE_BULK:function\((\i)\).+?},/, - replace: "MESSAGE_DELETE_BULK:function($1){}," + match: /MESSAGE_DELETE_BULK:\i,/, + replace: "MESSAGE_DELETE_BULK:()=>{}," } ] }, diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index 0a87c57a9..eb0b38600 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -182,8 +182,8 @@ export default definePlugin({ { find: ".ORIGINAL_POSTER=", replacement: { - match: /\((\i)=\{\}\)\)\[(\i)\.BOT/, - replace: "($1=$self.getTagTypes()))[$2.BOT" + match: /(\i)=\{\}\)\);(?=let \i=100)/, + replace: "$1=$self.getTagTypes()));" } }, { @@ -249,8 +249,8 @@ export default definePlugin({ match: /user:\i,nick:\i,/, replace: "$&moreTags_channelId," }, { - match: /,botType:(\i),(?<=user:(\i).+?)/g, - replace: ",botType:$self.getTag({user:$2,channelId:moreTags_channelId,origType:$1,location:'not-chat'})," + match: /,botType:(\i),botVerified:(\i),(?!discriminatorClass:)(?<=user:(\i).+?)/g, + replace: ",botType:$self.getTag({user:$3,channelId:moreTags_channelId,origType:$1,location:'not-chat'}),botVerified:$2," } ] }, diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index 1ea5b5296..7c87a7ab2 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -40,15 +40,15 @@ export default definePlugin({ ] }, ...[ - '="MessageStore",', + '"MessageStore"', '"displayName","ReadStateStore")' ].map(find => ({ find, predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true, replacement: [ { - match: /(?<=MESSAGE_CREATE:function\((\i)\){)/, - replace: (_, props) => `if($self.isBlocked(${props}.message))return;` + match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/, + replace: (_, _funcName, props) => `if($self.isBlocked(${props}.message))return;` } ] })) diff --git a/src/plugins/noPendingCount/index.ts b/src/plugins/noPendingCount/index.ts index d3e27563b..4619c2f06 100644 --- a/src/plugins/noPendingCount/index.ts +++ b/src/plugins/noPendingCount/index.ts @@ -74,10 +74,10 @@ export default definePlugin({ // This prevents the Message Requests tab from always hiding due to the previous patch (and is compatible with spam requests) // In short, only the red badge is hidden. Button visibility behavior isn't changed. { - find: ".getSpamChannelsCount(),", + find: ".getSpamChannelsCount();", predicate: () => settings.store.hideMessageRequestsCount, replacement: { - match: /(?<=getSpamChannelsCount\(\),\i=)\i\.getMessageRequestsCount\(\)/, + match: /(?<=getSpamChannelsCount\(\);return )\i\.getMessageRequestsCount\(\)/, replace: "$self.getRealMessageRequestCount()" } }, diff --git a/src/plugins/replyTimestamp/index.tsx b/src/plugins/replyTimestamp/index.tsx index 851a62b9d..b0a01addb 100644 --- a/src/plugins/replyTimestamp/index.tsx +++ b/src/plugins/replyTimestamp/index.tsx @@ -69,8 +69,8 @@ export default definePlugin({ { find: ".REPLY_QUOTE_MESSAGE_BLOCKED", replacement: { - match: /(?<="aria-label":\i,children:\[)(?=\i,\i,\i\])/, - replace: "$self.ReplyTimestamp(arguments[0])," + match: /\.onClickReply,.+?}\),(?=\i,\i,\i\])/, + replace: "$&$self.ReplyTimestamp(arguments[0])," } } ], diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 01b0da4b4..7f008c8cb 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -444,7 +444,7 @@ export default definePlugin({ } }, { - find: '="GuildChannelStore",', + find: '"GuildChannelStore"', replacement: [ { // Make GuildChannelStore contain hidden channels @@ -453,7 +453,7 @@ export default definePlugin({ }, { // Filter hidden channels from GuildChannelStore.getChannels unless told otherwise - match: /(?<=getChannels\(\i)(\){.+?)return (.+?)}/, + match: /(?<=getChannels\(\i)(\){.*?)return (.+?)}/, replace: (_, rest, channels) => `,shouldIncludeHidden${rest}return $self.resolveGuildChannels(${channels},shouldIncludeHidden??arguments[0]==="@favorites");}` } ] diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx index 4f9fcf304..bbafb58d3 100644 --- a/src/plugins/showMeYourName/index.tsx +++ b/src/plugins/showMeYourName/index.tsx @@ -48,7 +48,7 @@ export default definePlugin({ authors: [Devs.Rini, Devs.TheKodeToad], patches: [ { - find: '?"@":"")', + find: '?"@":""', replacement: { match: /(?<=onContextMenu:\i,children:).*?\)}/, replace: "$self.renderUsername(arguments[0])}" diff --git a/src/plugins/superReactionTweaks/index.ts b/src/plugins/superReactionTweaks/index.ts index 188f868a5..cbcb38ada 100644 --- a/src/plugins/superReactionTweaks/index.ts +++ b/src/plugins/superReactionTweaks/index.ts @@ -42,8 +42,8 @@ export default definePlugin({ { find: ",BURST_REACTION_EFFECT_PLAY", replacement: { - match: /(BURST_REACTION_EFFECT_PLAY:\i=>{.{50,100})(\i\(\i,\i\))>=\d+/, - replace: "$1!$self.shouldPlayBurstReaction($2)" + match: /((\i)=\i=>{.{50,100})(\i\(\i,\i\))>=\i(?=.*BURST_REACTION_EFFECT_PLAY:\2)/, + replace: "$1!$self.shouldPlayBurstReaction($3)" } }, { diff --git a/src/plugins/userVoiceShow/components.tsx b/src/plugins/userVoiceShow/components.tsx index c509f6946..7a6f4dd2a 100644 --- a/src/plugins/userVoiceShow/components.tsx +++ b/src/plugins/userVoiceShow/components.tsx @@ -21,7 +21,7 @@ const getDMChannelIcon = findByCodeLazy(".getChannelIconURL({"); const VoiceStateStore = findStoreLazy("VoiceStateStore"); const UserSummaryItem = findComponentByCodeLazy("defaultRenderUser", "showDefaultAvatarsForNullUsers"); -const Avatar = findComponentByCodeLazy(".AVATAR_STATUS_TYPING_16;"); +const Avatar = findComponentByCodeLazy(".status)/2):0"); const GroupDMAvatars = findComponentByCodeLazy(".AvatarSizeSpecs[", "getAvatarURL"); const ActionButtonClasses = findByPropsLazy("actionButton", "highlight"); diff --git a/src/plugins/volumeBooster/index.ts b/src/plugins/volumeBooster/index.ts index 490bf62c2..370f4e962 100644 --- a/src/plugins/volumeBooster/index.ts +++ b/src/plugins/volumeBooster/index.ts @@ -89,7 +89,7 @@ export default definePlugin({ find: "AudioContextSettingsMigrated", replacement: [ { - match: /(?<=isLocalMute\(\i,\i\),volume:.+?volume:)\i(?=})/, + match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/, replace: "$&>200?200:$&" }, { diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx index 679fe714e..bcd070792 100644 --- a/src/plugins/whoReacted/index.tsx +++ b/src/plugins/whoReacted/index.tsx @@ -109,11 +109,12 @@ export default definePlugin({ match: /(\i)\?null:\(0,\i\.jsx\)\(\i\.\i,{className:\i\.reactionCount,.*?}\),/, replace: "$&$1?null:$self.renderUsers(this.props)," } - }, { + }, + { find: '"MessageReactionsStore"', replacement: { - match: /(?<=CONNECTION_OPEN:function\(\){)(\i)={}/, - replace: "$&;$self.reactions=$1" + match: /function (\i)\(\){(\i)={}(?=.*CONNECTION_OPEN:\1)/, + replace: "$&;$self.reactions=$2;" } }, { From 832e874c3558de2ee1e1d5819982b97f793de10e Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 26 Sep 2024 18:19:08 +0200 Subject: [PATCH 03/11] bump to v1.10.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88633f65c..082995f4f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.10.2", + "version": "1.10.3", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": { From e7956413e2fe8dece8a17eb2573a072526709ba2 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:02:36 -0300 Subject: [PATCH 04/11] Optimize slow patches --- src/plugins/messageLogger/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 70672e9e0..baa0977a6 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -323,7 +323,7 @@ export default definePlugin({ replacement: [ { // Add deleted=true to all target messages in the MESSAGE_DELETE event - match: /function (\i)\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function.*MESSAGE_DELETE:\1)/, + match: /function (?=.+?MESSAGE_DELETE:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/, replace: "function $1($2){" + " var cache = $3getOrCreate($2.channelId);" + @@ -333,7 +333,7 @@ export default definePlugin({ }, { // Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event - match: /function (\i)\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function.*MESSAGE_DELETE_BULK:\1)/, + match: /function (?=.+?MESSAGE_DELETE_BULK:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/, replace: "function $1($2){" + " var cache = $3getOrCreate($2.channelId);" + From eab0cf9966aeb5cb5d9772be93cb2fb7398c0e05 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Thu, 26 Sep 2024 18:26:13 -0400 Subject: [PATCH 05/11] VolumeBooster: fix stream on web based clients (#2916) Co-authored-by: v --- src/plugins/volumeBooster/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/volumeBooster/index.ts b/src/plugins/volumeBooster/index.ts index 370f4e962..db0242664 100644 --- a/src/plugins/volumeBooster/index.ts +++ b/src/plugins/volumeBooster/index.ts @@ -77,6 +77,11 @@ export default definePlugin({ match: /Math\.max.{0,30}\)\)/, replace: "arguments[0]" }, + // Fix streams not playing audio until you update them + { + match: /\}return"video"/, + replace: "this.updateAudioElement();$&" + }, // Patch the volume { match: /\.volume=this\._volume\/100;/, From 18f7b742109f4146e3cacc1ebf13b89e0e35a93a Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 27 Sep 2024 05:46:50 -0300 Subject: [PATCH 06/11] Fix required plugins being shown as disabled --- src/components/PluginSettings/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index c3b6e9082..8dc40147f 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -93,7 +93,7 @@ interface PluginCardProps extends React.HTMLProps { export function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) { const settings = Settings.plugins[plugin.name]; - const isEnabled = () => settings.enabled ?? false; + const isEnabled = () => Vencord.Plugins.isPluginEnabled(plugin.name); function toggleEnabled() { const wasEnabled = isEnabled(); From 43b3c137ceb5ee8b02147936ef17334a1845089b Mon Sep 17 00:00:00 2001 From: ryanamay Date: Thu, 3 Oct 2024 15:11:37 +0800 Subject: [PATCH 07/11] BlurNSFW: Fix not blurring embeds (#2862) --- src/plugins/blurNsfw/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/blurNsfw/index.ts b/src/plugins/blurNsfw/index.ts index a80f9f260..948de0ac6 100644 --- a/src/plugins/blurNsfw/index.ts +++ b/src/plugins/blurNsfw/index.ts @@ -45,8 +45,8 @@ export default definePlugin({ { find: ".embedWrapper,embed", replacement: [{ - match: /\.embedWrapper(?=.+?channel_id:(\i)\.id)/g, - replace: "$&+($1.nsfw?' vc-nsfw-img':'')" + match: /\.container/, + replace: "$&+(this.props.channel.nsfw? ' vc-nsfw-img': '')" }] } ], From 91a32e22de66b2a2afd5c7ac4d031f73ccd3132a Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Fri, 4 Oct 2024 05:28:36 -0400 Subject: [PATCH 08/11] PermissionsViewer: Fix profile button (#2925) --- src/plugins/permissionsViewer/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/permissionsViewer/index.tsx b/src/plugins/permissionsViewer/index.tsx index ca28f845f..7d6572df5 100644 --- a/src/plugins/permissionsViewer/index.tsx +++ b/src/plugins/permissionsViewer/index.tsx @@ -172,7 +172,7 @@ export default definePlugin({ { find: ".VIEW_ALL_ROLES,", replacement: { - match: /\.collapseButton,.+?}\)}\),/, + match: /\.expandButton,.+?null,/, replace: "$&$self.ViewPermissionsButton(arguments[0])," } } From 1e01f852173e0e5fe1ba92782e3e569fe7fca46e Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Fri, 4 Oct 2024 05:29:59 -0400 Subject: [PATCH 09/11] NoBlockedMessages: Fix conflict with MessageLogger (#2921) --- src/plugins/noBlockedMessages/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index 7c87a7ab2..3c4a2d751 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -25,6 +25,12 @@ import { Message } from "discord-types/general"; const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked"); +interface MessageDeleteProps { + collapsedReason: { + message: string; + }; +} + export default definePlugin({ name: "NoBlockedMessages", description: "Hides all blocked messages from chat completely.", @@ -35,7 +41,7 @@ export default definePlugin({ replacement: [ { match: /let\{[^}]*collapsedReason[^}]*\}/, - replace: "return null;$&" + replace: "if($self.shouldHide(arguments[0]))return null;$&" } ] }, @@ -68,5 +74,9 @@ export default definePlugin({ } catch (e) { new Logger("NoBlockedMessages").error("Failed to check if user is blocked:", e); } + }, + + shouldHide(props: MessageDeleteProps) { + return !props?.collapsedReason?.message.includes("deleted"); } }); From b5f626d1ffc047870be1d64bce89d7cb1508f3d6 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sat, 5 Oct 2024 08:01:40 -0300 Subject: [PATCH 10/11] Fix multiple plugins (again) --- src/plugins/_api/notices.ts | 4 +- src/plugins/consoleJanitor/index.ts | 2 +- src/plugins/fakeNitro/index.tsx | 75 ++++++++---------------- src/plugins/messageLogger/index.tsx | 44 +++++++------- src/plugins/moreUserTags/index.tsx | 4 +- src/plugins/noBlockedMessages/index.ts | 6 +- src/plugins/noPendingCount/index.ts | 4 +- src/plugins/showHiddenThings/index.ts | 11 +--- src/plugins/superReactionTweaks/index.ts | 4 +- src/plugins/volumeBooster/index.ts | 4 +- src/plugins/whoReacted/index.tsx | 4 +- 11 files changed, 64 insertions(+), 98 deletions(-) diff --git a/src/plugins/_api/notices.ts b/src/plugins/_api/notices.ts index ceec6f825..0c6f6e1db 100644 --- a/src/plugins/_api/notices.ts +++ b/src/plugins/_api/notices.ts @@ -33,8 +33,8 @@ export default definePlugin({ replace: "if(Vencord.Api.Notices.currentNotice)return false;$&" }, { - match: /(?<=function (\i)\(\i\){)return null!=(\i)(?=.*NOTICE_DISMISS:\1)/, - replace: "if($2.id==\"VencordNotice\")return($2=null,Vencord.Api.Notices.nextNotice(),true);$&" + match: /(?<=,NOTICE_DISMISS:function\(\i\){)return null!=(\i)/, + replace: "if($1.id==\"VencordNotice\")return($1=null,Vencord.Api.Notices.nextNotice(),true);$&" } ] } diff --git a/src/plugins/consoleJanitor/index.ts b/src/plugins/consoleJanitor/index.ts index 1cb705541..b0c8905f7 100644 --- a/src/plugins/consoleJanitor/index.ts +++ b/src/plugins/consoleJanitor/index.ts @@ -119,7 +119,7 @@ export default definePlugin({ { find: "Slow dispatch on", replacement: { - match: /\i\.totalTime>\i&&\i\.verbose\("Slow dispatch on ".+?\)\);/, + match: /\i\.totalTime>100&&\i\.verbose\("Slow dispatch on ".+?\)\);/, replace: "" } }, diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index cfffedb99..fb2c67c33 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -22,7 +22,7 @@ import { Devs } from "@utils/constants"; import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies"; import { getCurrentGuild } from "@utils/discord"; import { Logger } from "@utils/Logger"; -import definePlugin, { OptionType } from "@utils/types"; +import definePlugin, { OptionType, Patch } from "@utils/types"; import { findByCodeLazy, findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack"; import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, GuildMemberStore, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common"; import type { Emoji } from "@webpack/types"; @@ -194,6 +194,26 @@ const hasExternalStickerPerms = (channelId: string) => hasPermission(channelId, const hasEmbedPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.EMBED_LINKS); const hasAttachmentPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.ATTACH_FILES); +function makeBypassPatches(): Omit { + const mapping: Array<{ func: string, predicate?: () => boolean; }> = [ + { func: "canUseCustomStickersEverywhere", predicate: () => settings.store.enableStickerBypass }, + { func: "canUseHighVideoUploadQuality", predicate: () => settings.store.enableStreamQualityBypass }, + { func: "canStreamQuality", predicate: () => settings.store.enableStreamQualityBypass }, + { func: "canUseClientThemes" }, + { func: "canUseCustomNotificationSounds" }, + { func: "canUsePremiumAppIcons" } + ]; + + return { + find: "canUseCustomStickersEverywhere:", + replacement: mapping.map(({ func, predicate }) => ({ + match: new RegExp(String.raw`(?<=${func}:function\(\i(?:,\i)?\){)`), + replace: "return true;", + predicate + })) + }; +} + export default definePlugin({ name: "FakeNitro", authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN], @@ -203,6 +223,8 @@ export default definePlugin({ settings, patches: [ + // General bypass patches + makeBypassPatches(), // Patch the emoji picker in voice calls to not be bypassed by fake nitro { find: "emojiItemDisabled]", @@ -252,15 +274,6 @@ export default definePlugin({ replace: (_, rest1, rest2) => `${rest1},fakeNitroOriginal){if(!fakeNitroOriginal)return false;${rest2}` } }, - // Allow stickers to be sent everywhere - { - find: "canUseCustomStickersEverywhere:", - predicate: () => settings.store.enableStickerBypass, - replacement: { - match: /(?<=canUseCustomStickersEverywhere:)\i/, - replace: "()=>true" - }, - }, // Make stickers always available { find: '"SENDABLE"', @@ -270,20 +283,6 @@ export default definePlugin({ replace: "true?" } }, - // Allow streaming with high quality - { - find: "canUseHighVideoUploadQuality:", - predicate: () => settings.store.enableStreamQualityBypass, - replacement: [ - "canUseHighVideoUploadQuality", - "canStreamQuality", - ].map(func => { - return { - match: new RegExp(`(?<=${func}:)\\i`, "g"), - replace: "()=>true" - }; - }) - }, // Remove boost requirements to stream with high quality { find: "STREAM_FPS_OPTION.format", @@ -293,21 +292,13 @@ export default definePlugin({ replace: "" } }, - // Allow client themes to be changeable - { - find: "canUseClientThemes:", - replacement: { - match: /(?<=canUseClientThemes:)\i/, - replace: "()=>true" - } - }, { find: '"UserSettingsProtoStore"', replacement: [ { // Overwrite incoming connection settings proto with our local settings - match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/, - replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);` + match: /CONNECTION_OPEN:function\((\i)\){/, + replace: (m, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);` }, { // Overwrite non local proto changes with our local settings @@ -398,14 +389,6 @@ export default definePlugin({ replace: (_, reactNode, props) => `$self.addFakeNotice(${FakeNoticeType.Emoji},${reactNode},!!${props}?.fakeNitroNode?.fake)` } }, - // Allow using custom app icons - { - find: "canUsePremiumAppIcons:", - replacement: { - match: /(?<=canUsePremiumAppIcons:)\i/, - replace: "()=>true" - } - }, // Separate patch for allowing using custom app icons { find: /\.getCurrentDesktopIcon.{0,25}\.isPremium/, @@ -421,14 +404,6 @@ export default definePlugin({ match: /(?<=type:"(?:SOUNDBOARD_SOUNDS_RECEIVED|GUILD_SOUNDBOARD_SOUND_CREATE|GUILD_SOUNDBOARD_SOUND_UPDATE|GUILD_SOUNDBOARD_SOUNDS_UPDATE)".+?available:)\i\.available/g, replace: "true" } - }, - // Allow using custom notification sounds - { - find: "canUseCustomNotificationSounds:", - replacement: { - match: /(?<=canUseCustomNotificationSounds:)\i/, - replace: "()=>true" - } } ], diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index baa0977a6..a08aeccce 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -323,35 +323,35 @@ export default definePlugin({ replacement: [ { // Add deleted=true to all target messages in the MESSAGE_DELETE event - match: /function (?=.+?MESSAGE_DELETE:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/, + match: /MESSAGE_DELETE:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/, replace: - "function $1($2){" + - " var cache = $3getOrCreate($2.channelId);" + - " cache = $self.handleDelete(cache, $2, false);" + - " $3commit(cache);" + - "}" + "MESSAGE_DELETE:function($1){" + + " var cache = $2getOrCreate($1.channelId);" + + " cache = $self.handleDelete(cache, $1, false);" + + " $2commit(cache);" + + "}," }, { // Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event - match: /function (?=.+?MESSAGE_DELETE_BULK:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/, + match: /MESSAGE_DELETE_BULK:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/, replace: - "function $1($2){" + - " var cache = $3getOrCreate($2.channelId);" + - " cache = $self.handleDelete(cache, $2, true);" + - " $3commit(cache);" + - "}" + "MESSAGE_DELETE_BULK:function($1){" + + " var cache = $2getOrCreate($1.channelId);" + + " cache = $self.handleDelete(cache, $1, true);" + + " $2commit(cache);" + + "}," }, { // Add current cached content + new edit time to cached message's editHistory - match: /(function (\i)\((\i)\).+?)\.update\((\i)(?=.*MESSAGE_UPDATE:\2)/, + match: /(MESSAGE_UPDATE:function\((\i)\).+?)\.update\((\i)/, replace: "$1" + - ".update($4,m =>" + - " (($3.message.flags & 64) === 64 || $self.shouldIgnore($3.message, true)) ? m :" + - " $3.message.edited_timestamp && $3.message.content !== m.content ?" + - " m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($3.message, m)]) :" + + ".update($3,m =>" + + " (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" + + " $2.message.edited_timestamp && $2.message.content !== m.content ?" + + " m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" + " m" + ")" + - ".update($4" + ".update($3" }, { // fix up key (edit last message) attempting to edit a deleted message @@ -465,12 +465,12 @@ export default definePlugin({ find: '"ReferencedMessageStore"', replacement: [ { - match: /MESSAGE_DELETE:\i,/, - replace: "MESSAGE_DELETE:()=>{}," + match: /MESSAGE_DELETE:function\((\i)\).+?},/, + replace: "MESSAGE_DELETE:function($1){}," }, { - match: /MESSAGE_DELETE_BULK:\i,/, - replace: "MESSAGE_DELETE_BULK:()=>{}," + match: /MESSAGE_DELETE_BULK:function\((\i)\).+?},/, + replace: "MESSAGE_DELETE_BULK:function($1){}," } ] }, diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index eb0b38600..7a56131a5 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -182,8 +182,8 @@ export default definePlugin({ { find: ".ORIGINAL_POSTER=", replacement: { - match: /(\i)=\{\}\)\);(?=let \i=100)/, - replace: "$1=$self.getTagTypes()));" + match: /\((\i)=\{\}\)\)\[(\i)\.BOT/, + replace: "($1=$self.getTagTypes()))[$2.BOT" } }, { diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index 3c4a2d751..d3b37b026 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -47,14 +47,14 @@ export default definePlugin({ }, ...[ '"MessageStore"', - '"displayName","ReadStateStore")' + '"ReadStateStore"' ].map(find => ({ find, predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true, replacement: [ { - match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/, - replace: (_, _funcName, props) => `if($self.isBlocked(${props}.message))return;` + match: /(?<=MESSAGE_CREATE:function\((\i)\){)/, + replace: (_, props) => `if($self.isBlocked(${props}.message))return;` } ] })) diff --git a/src/plugins/noPendingCount/index.ts b/src/plugins/noPendingCount/index.ts index 4619c2f06..84ee8ec19 100644 --- a/src/plugins/noPendingCount/index.ts +++ b/src/plugins/noPendingCount/index.ts @@ -74,10 +74,10 @@ export default definePlugin({ // This prevents the Message Requests tab from always hiding due to the previous patch (and is compatible with spam requests) // In short, only the red badge is hidden. Button visibility behavior isn't changed. { - find: ".getSpamChannelsCount();", + find: ".getSpamChannelsCount()", predicate: () => settings.store.hideMessageRequestsCount, replacement: { - match: /(?<=getSpamChannelsCount\(\);return )\i\.getMessageRequestsCount\(\)/, + match: /(?<=getSpamChannelsCount\(\),\i=)\i\.getMessageRequestsCount\(\)/, replace: "$self.getRealMessageRequestCount()" } }, diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index 847dcd327..bab0b3032 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -92,16 +92,7 @@ export default definePlugin({ replace: '">0"' } }, - // empty word filter (why would anyone search "horny" in fucking server discovery... please... why are we patching this again??) - { - find: '"horny","fart"', - predicate: () => settings.store.disableDisallowedDiscoveryFilters, - replacement: { - match: /=\["egirl",.+?\]/, - replace: "=[]" - } - }, - // empty 2nd word filter + // empty word filter { find: '"pepe","nude"', predicate: () => settings.store.disableDisallowedDiscoveryFilters, diff --git a/src/plugins/superReactionTweaks/index.ts b/src/plugins/superReactionTweaks/index.ts index cbcb38ada..188f868a5 100644 --- a/src/plugins/superReactionTweaks/index.ts +++ b/src/plugins/superReactionTweaks/index.ts @@ -42,8 +42,8 @@ export default definePlugin({ { find: ",BURST_REACTION_EFFECT_PLAY", replacement: { - match: /((\i)=\i=>{.{50,100})(\i\(\i,\i\))>=\i(?=.*BURST_REACTION_EFFECT_PLAY:\2)/, - replace: "$1!$self.shouldPlayBurstReaction($3)" + match: /(BURST_REACTION_EFFECT_PLAY:\i=>{.{50,100})(\i\(\i,\i\))>=\d+/, + replace: "$1!$self.shouldPlayBurstReaction($2)" } }, { diff --git a/src/plugins/volumeBooster/index.ts b/src/plugins/volumeBooster/index.ts index db0242664..c38b2d1a5 100644 --- a/src/plugins/volumeBooster/index.ts +++ b/src/plugins/volumeBooster/index.ts @@ -94,7 +94,7 @@ export default definePlugin({ find: "AudioContextSettingsMigrated", replacement: [ { - match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/, + match: /(?<=isLocalMute\(\i,\i\),volume:.+?volume:)\i(?=})/, replace: "$&>200?200:$&" }, { @@ -109,7 +109,7 @@ export default definePlugin({ }, // Prevent the MediaEngineStore from overwriting our LocalVolumes above 200 with the ones the Discord Audio Context Settings sync sends { - find: '="MediaEngineStore",', + find: '"MediaEngineStore"', replacement: [ { match: /(\.settings\.audioContextSettings.+?)(\i\[\i\])=(\i\.volume)(.+?setLocalVolume\(\i,).+?\)/, diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx index bcd070792..24be9bef5 100644 --- a/src/plugins/whoReacted/index.tsx +++ b/src/plugins/whoReacted/index.tsx @@ -113,8 +113,8 @@ export default definePlugin({ { find: '"MessageReactionsStore"', replacement: { - match: /function (\i)\(\){(\i)={}(?=.*CONNECTION_OPEN:\1)/, - replace: "$&;$self.reactions=$2;" + match: /(?<=CONNECTION_OPEN:function\(\){)(\i)={}/, + replace: "$&;$self.reactions=$1" } }, { From 013c8d061d1c1481badb39189a80d13f7db02ccb Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:24:39 -0300 Subject: [PATCH 11/11] Bump to 1.10.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 082995f4f..a41fe162a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.10.3", + "version": "1.10.4", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": {