fix some broken plugins (#4142)

Co-authored-by: sadan4 <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
V 2026-04-24 00:30:52 +02:00 • committed by GitHub
parent 392d76fe6f
commit f749baf81e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 23 additions and 85 deletions

View file

@ -135,7 +135,7 @@ export default definePlugin({
{
find: 'The "interpolate" function is deprecated in v10 (use "to" instead)',
replacement: {
match: /,console.warn\(\i\+'The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
replace: ""
}
},
@ -196,7 +196,7 @@ export default definePlugin({
find: "Slow dispatch on",
replacement: [
{
match: /\i\.totalTime>\i&&\i\.verbose\([`"]Slow dispatch on.{0,55}\);/,
match: /\i\.totalTime>\d+?&&\i\.verbose\([`"]Slow dispatch on.{0,55}\);/,
replace: ""
},
]

View file

@ -22,7 +22,7 @@ import { ApngBlendOp, ApngDisposeOp, parseAPNG } from "@utils/apng";
import { Devs } from "@utils/constants";
import { getCurrentGuild } from "@utils/discord";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType, Patch } from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
import type { Emoji, Message, Sticker } from "@vencord/discord-types";
import { StickerFormatType } from "@vencord/discord-types/enums";
import { findByCodeLazy, findByPropsLazy, proxyLazyWebpack } from "@webpack";
@ -151,26 +151,6 @@ 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<Patch, "plugin"> {
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: "canUsePremiumAppIcons" }
];
return {
find: "canUseCustomStickersEverywhere:",
replacement: mapping.map(({ func, predicate }) => ({
match: new RegExp(String.raw`(?<=${func}:)\i`),
replace: "() => true",
noWarn: true,
predicate
}))
};
}
export default definePlugin({
name: "FakeNitro",
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN, Devs.sadan],
@ -181,8 +161,6 @@ export default definePlugin({
settings,
patches: [
// TODO: remove
makeBypassPatches(),
{
find: "canUseCustomStickersEverywhere:",
replacement: [
@ -286,11 +264,6 @@ export default definePlugin({
match: /(?<=CONNECTION_OPEN:function\((\i)\){)/,
replace: (_, props) => `$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
},
{
match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/,
replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`,
noWarn: true
},
{
// Overwrite non local proto changes with our local settings
match: /let{settings:/,

View file

@ -58,7 +58,7 @@ export default definePlugin({
{
// https://regex101.com/r/x2mobQ/1
// searchEmojis(...,maxCount: stuff) ... endEmojis = emojis.slice(0, maxCount - gifResults.length)
match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(Math\.max\(\i,\i(?:-\i\.length){2}\))\)/,
match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(Math\.max\(\d+?,\i(?:-\i\.length){2}\))\)/,
// ,maxCount:Infinity ... endEmojis = (emojis.sliceTo = n, emojis)
replace: ",maxCount:Infinity$2=($3.sliceTo = $4, $3)"
}

View file

@ -93,7 +93,7 @@ export default definePlugin({
{
// https://regex101.com/r/07gpzP/1
// ($1 renderHeaderContent=function { ... switch (x) ... case FAVORITES:return) ($2) ($3 case default: ... return r.jsx(($<searchComp>), {...props}))
match: /(renderHeaderContent\(\).{1,150}FAVORITES:return)(.{1,150});(case.{1,200}default:.{0,50}?return\(0,\i\.jsx\)\((?<searchComp>\i\..{1,10}),)/,
match: /(renderHeaderContent\(\).{1,150}FAVORITES:return)(.{1,150});(case.{1,200}default:.{0,50}?return\(0,\i\.jsx\)\((?<searchComp>\i\.\i),)/,
replace: "$1 this.state.resultType === 'Favorites' ? $self.renderSearchBar(this, $<searchComp>) : $2;$3"
},
{

View file

@ -362,16 +362,6 @@ export default definePlugin({
return;
`
},
{
noWarn: true,
match: /function (?=.+?MESSAGE_DELETE:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
replace:
"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.{0,100}(\i\.\i)\.getOrCreate)/,
@ -382,16 +372,6 @@ export default definePlugin({
return;
`
},
{
match: /function (?=.+?MESSAGE_DELETE_BULK:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
noWarn: true,
replace:
"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)/,
@ -406,18 +386,6 @@ export default definePlugin({
.update($3
`
},
{
noWarn: true,
match: /(function (\i)\((\i)\).+?)\.update\((\i)(?=.*MESSAGE_UPDATE:\2)/,
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)]) :" +
" m" +
")" +
".update($4"
},
{
// fix up key (edit last message) attempting to edit a deleted message
match: /(?<=getLastEditableMessage\(\i\)\{.{0,200}\.find\((\i)=>)/,
@ -533,16 +501,6 @@ export default definePlugin({
{
match: /(?<=MESSAGE_DELETE_BULK:function\(\i\)\{)/,
replace: "return;"
},
{
match: /MESSAGE_DELETE:\i,/,
replace: "MESSAGE_DELETE:()=>{},",
noWarn: true
},
{
match: /MESSAGE_DELETE_BULK:\i,/,
replace: "MESSAGE_DELETE_BULK:()=>{},",
noWarn: true
}
]
},

View file

@ -63,19 +63,26 @@ export default definePlugin({
}
]
},
...[
'"MessageStore"',
'"ReadStateStore"'
].map(find => ({
find,
{
find: '"MessageStore"',
predicate: () => settings.store.ignoreMessages,
replacement: [
{
match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
replace: (_, _funcName, props) => `if($self.shouldIgnoreMessage(${props}.message))return;`
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
replace: (_, props) => `if($self.shouldIgnoreMessage(${props}.message))return;`
}
]
}))
},
{
find: '"ReadStateStore"',
predicate: () => settings.store.ignoreMessages,
replacement: [
{
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
replace: (_, props) => `if($self.shouldIgnoreMessage(${props}.message))return;`
}
]
}
],
shouldIgnoreMessage(message: Message) {

View file

@ -99,7 +99,7 @@ export default definePlugin({
find: "AudioContextSettingsMigrated",
replacement: [
{
match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/,
match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\(0,\i\.\i\)\(\i,\i,\{volume:)\1(?=\}\))/,
replace: "$&>200?200:$&"
},
{

View file

@ -92,8 +92,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;"
}
},
{