Fix multiple plugins (again)
This commit is contained in:
parent
1e01f85217
commit
b5f626d1ff
11 changed files with 64 additions and 98 deletions
|
@ -33,8 +33,8 @@ export default definePlugin({
|
||||||
replace: "if(Vencord.Api.Notices.currentNotice)return false;$&"
|
replace: "if(Vencord.Api.Notices.currentNotice)return false;$&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=function (\i)\(\i\){)return null!=(\i)(?=.*NOTICE_DISMISS:\1)/,
|
match: /(?<=,NOTICE_DISMISS:function\(\i\){)return null!=(\i)/,
|
||||||
replace: "if($2.id==\"VencordNotice\")return($2=null,Vencord.Api.Notices.nextNotice(),true);$&"
|
replace: "if($1.id==\"VencordNotice\")return($1=null,Vencord.Api.Notices.nextNotice(),true);$&"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "Slow dispatch on",
|
find: "Slow dispatch on",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\i\.totalTime>\i&&\i\.verbose\("Slow dispatch on ".+?\)\);/,
|
match: /\i\.totalTime>100&&\i\.verbose\("Slow dispatch on ".+?\)\);/,
|
||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { Devs } from "@utils/constants";
|
||||||
import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies";
|
import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies";
|
||||||
import { getCurrentGuild } from "@utils/discord";
|
import { getCurrentGuild } from "@utils/discord";
|
||||||
import { Logger } from "@utils/Logger";
|
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 { 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 { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, GuildMemberStore, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
||||||
import type { Emoji } from "@webpack/types";
|
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 hasEmbedPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.EMBED_LINKS);
|
||||||
const hasAttachmentPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.ATTACH_FILES);
|
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: "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({
|
export default definePlugin({
|
||||||
name: "FakeNitro",
|
name: "FakeNitro",
|
||||||
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN],
|
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN],
|
||||||
|
@ -203,6 +223,8 @@ export default definePlugin({
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
|
// General bypass patches
|
||||||
|
makeBypassPatches(),
|
||||||
// Patch the emoji picker in voice calls to not be bypassed by fake nitro
|
// Patch the emoji picker in voice calls to not be bypassed by fake nitro
|
||||||
{
|
{
|
||||||
find: "emojiItemDisabled]",
|
find: "emojiItemDisabled]",
|
||||||
|
@ -252,15 +274,6 @@ export default definePlugin({
|
||||||
replace: (_, rest1, rest2) => `${rest1},fakeNitroOriginal){if(!fakeNitroOriginal)return false;${rest2}`
|
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
|
// Make stickers always available
|
||||||
{
|
{
|
||||||
find: '"SENDABLE"',
|
find: '"SENDABLE"',
|
||||||
|
@ -270,20 +283,6 @@ export default definePlugin({
|
||||||
replace: "true?"
|
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
|
// Remove boost requirements to stream with high quality
|
||||||
{
|
{
|
||||||
find: "STREAM_FPS_OPTION.format",
|
find: "STREAM_FPS_OPTION.format",
|
||||||
|
@ -293,21 +292,13 @@ export default definePlugin({
|
||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Allow client themes to be changeable
|
|
||||||
{
|
|
||||||
find: "canUseClientThemes:",
|
|
||||||
replacement: {
|
|
||||||
match: /(?<=canUseClientThemes:)\i/,
|
|
||||||
replace: "()=>true"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
find: '"UserSettingsProtoStore"',
|
find: '"UserSettingsProtoStore"',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Overwrite incoming connection settings proto with our local settings
|
// Overwrite incoming connection settings proto with our local settings
|
||||||
match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/,
|
match: /CONNECTION_OPEN:function\((\i)\){/,
|
||||||
replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
|
replace: (m, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Overwrite non local proto changes with our local settings
|
// 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)`
|
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
|
// Separate patch for allowing using custom app icons
|
||||||
{
|
{
|
||||||
find: /\.getCurrentDesktopIcon.{0,25}\.isPremium/,
|
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,
|
match: /(?<=type:"(?:SOUNDBOARD_SOUNDS_RECEIVED|GUILD_SOUNDBOARD_SOUND_CREATE|GUILD_SOUNDBOARD_SOUND_UPDATE|GUILD_SOUNDBOARD_SOUNDS_UPDATE)".+?available:)\i\.available/g,
|
||||||
replace: "true"
|
replace: "true"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// Allow using custom notification sounds
|
|
||||||
{
|
|
||||||
find: "canUseCustomNotificationSounds:",
|
|
||||||
replacement: {
|
|
||||||
match: /(?<=canUseCustomNotificationSounds:)\i/,
|
|
||||||
replace: "()=>true"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -323,35 +323,35 @@ export default definePlugin({
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Add deleted=true to all target messages in the MESSAGE_DELETE event
|
// 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:
|
replace:
|
||||||
"function $1($2){" +
|
"MESSAGE_DELETE:function($1){" +
|
||||||
" var cache = $3getOrCreate($2.channelId);" +
|
" var cache = $2getOrCreate($1.channelId);" +
|
||||||
" cache = $self.handleDelete(cache, $2, false);" +
|
" cache = $self.handleDelete(cache, $1, false);" +
|
||||||
" $3commit(cache);" +
|
" $2commit(cache);" +
|
||||||
"}"
|
"},"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event
|
// 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:
|
replace:
|
||||||
"function $1($2){" +
|
"MESSAGE_DELETE_BULK:function($1){" +
|
||||||
" var cache = $3getOrCreate($2.channelId);" +
|
" var cache = $2getOrCreate($1.channelId);" +
|
||||||
" cache = $self.handleDelete(cache, $2, true);" +
|
" cache = $self.handleDelete(cache, $1, true);" +
|
||||||
" $3commit(cache);" +
|
" $2commit(cache);" +
|
||||||
"}"
|
"},"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Add current cached content + new edit time to cached message's editHistory
|
// 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" +
|
replace: "$1" +
|
||||||
".update($4,m =>" +
|
".update($3,m =>" +
|
||||||
" (($3.message.flags & 64) === 64 || $self.shouldIgnore($3.message, true)) ? m :" +
|
" (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" +
|
||||||
" $3.message.edited_timestamp && $3.message.content !== m.content ?" +
|
" $2.message.edited_timestamp && $2.message.content !== m.content ?" +
|
||||||
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($3.message, m)]) :" +
|
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" +
|
||||||
" m" +
|
" m" +
|
||||||
")" +
|
")" +
|
||||||
".update($4"
|
".update($3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// fix up key (edit last message) attempting to edit a deleted message
|
// fix up key (edit last message) attempting to edit a deleted message
|
||||||
|
@ -465,12 +465,12 @@ export default definePlugin({
|
||||||
find: '"ReferencedMessageStore"',
|
find: '"ReferencedMessageStore"',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /MESSAGE_DELETE:\i,/,
|
match: /MESSAGE_DELETE:function\((\i)\).+?},/,
|
||||||
replace: "MESSAGE_DELETE:()=>{},"
|
replace: "MESSAGE_DELETE:function($1){},"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /MESSAGE_DELETE_BULK:\i,/,
|
match: /MESSAGE_DELETE_BULK:function\((\i)\).+?},/,
|
||||||
replace: "MESSAGE_DELETE_BULK:()=>{},"
|
replace: "MESSAGE_DELETE_BULK:function($1){},"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -182,8 +182,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".ORIGINAL_POSTER=",
|
find: ".ORIGINAL_POSTER=",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(\i)=\{\}\)\);(?=let \i=100)/,
|
match: /\((\i)=\{\}\)\)\[(\i)\.BOT/,
|
||||||
replace: "$1=$self.getTagTypes()));"
|
replace: "($1=$self.getTagTypes()))[$2.BOT"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,14 +47,14 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
...[
|
...[
|
||||||
'"MessageStore"',
|
'"MessageStore"',
|
||||||
'"displayName","ReadStateStore")'
|
'"ReadStateStore"'
|
||||||
].map(find => ({
|
].map(find => ({
|
||||||
find,
|
find,
|
||||||
predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true,
|
predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
|
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
|
||||||
replace: (_, _funcName, props) => `if($self.isBlocked(${props}.message))return;`
|
replace: (_, props) => `if($self.isBlocked(${props}.message))return;`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -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)
|
// 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.
|
// In short, only the red badge is hidden. Button visibility behavior isn't changed.
|
||||||
{
|
{
|
||||||
find: ".getSpamChannelsCount();",
|
find: ".getSpamChannelsCount()",
|
||||||
predicate: () => settings.store.hideMessageRequestsCount,
|
predicate: () => settings.store.hideMessageRequestsCount,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=getSpamChannelsCount\(\);return )\i\.getMessageRequestsCount\(\)/,
|
match: /(?<=getSpamChannelsCount\(\),\i=)\i\.getMessageRequestsCount\(\)/,
|
||||||
replace: "$self.getRealMessageRequestCount()"
|
replace: "$self.getRealMessageRequestCount()"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -92,16 +92,7 @@ export default definePlugin({
|
||||||
replace: '">0"'
|
replace: '">0"'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// empty word filter (why would anyone search "horny" in fucking server discovery... please... why are we patching this again??)
|
// empty word filter
|
||||||
{
|
|
||||||
find: '"horny","fart"',
|
|
||||||
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
|
||||||
replacement: {
|
|
||||||
match: /=\["egirl",.+?\]/,
|
|
||||||
replace: "=[]"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// empty 2nd word filter
|
|
||||||
{
|
{
|
||||||
find: '"pepe","nude"',
|
find: '"pepe","nude"',
|
||||||
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
||||||
|
|
|
@ -42,8 +42,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ",BURST_REACTION_EFFECT_PLAY",
|
find: ",BURST_REACTION_EFFECT_PLAY",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /((\i)=\i=>{.{50,100})(\i\(\i,\i\))>=\i(?=.*BURST_REACTION_EFFECT_PLAY:\2)/,
|
match: /(BURST_REACTION_EFFECT_PLAY:\i=>{.{50,100})(\i\(\i,\i\))>=\d+/,
|
||||||
replace: "$1!$self.shouldPlayBurstReaction($3)"
|
replace: "$1!$self.shouldPlayBurstReaction($2)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default definePlugin({
|
||||||
find: "AudioContextSettingsMigrated",
|
find: "AudioContextSettingsMigrated",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/,
|
match: /(?<=isLocalMute\(\i,\i\),volume:.+?volume:)\i(?=})/,
|
||||||
replace: "$&>200?200:$&"
|
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
|
// Prevent the MediaEngineStore from overwriting our LocalVolumes above 200 with the ones the Discord Audio Context Settings sync sends
|
||||||
{
|
{
|
||||||
find: '="MediaEngineStore",',
|
find: '"MediaEngineStore"',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(\.settings\.audioContextSettings.+?)(\i\[\i\])=(\i\.volume)(.+?setLocalVolume\(\i,).+?\)/,
|
match: /(\.settings\.audioContextSettings.+?)(\i\[\i\])=(\i\.volume)(.+?setLocalVolume\(\i,).+?\)/,
|
||||||
|
|
|
@ -113,8 +113,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: '"MessageReactionsStore"',
|
find: '"MessageReactionsStore"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /function (\i)\(\){(\i)={}(?=.*CONNECTION_OPEN:\1)/,
|
match: /(?<=CONNECTION_OPEN:function\(\){)(\i)={}/,
|
||||||
replace: "$&;$self.reactions=$2;"
|
replace: "$&;$self.reactions=$1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue