Apply Dev3 Fixes

This commit is contained in:
thororen1234 2026-04-23 08:06:25 -04:00
parent 93290c2e19
commit ba8b5179ec
No known key found for this signature in database
11 changed files with 44 additions and 100 deletions

View file

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

View file

@ -5,7 +5,7 @@
*/
import { isPluginEnabled } from "@api/PluginManager";
import { definePluginSettings } from "@api/Settings";
import { definePluginSettings, Settings } from "@api/Settings";
import fakeNitro from "@plugins/fakeNitro";
import { EquicordDevs } from "@utils/constants";
import { localStorage } from "@utils/localStorage";
@ -120,15 +120,15 @@ export default definePlugin({
find: "canUseCustomStickersEverywhere:",
replacement: [
{
match: /canStreamQuality:\i,/,
replace: "canStreamQuality:()=>true,",
match: /(?<=canUseHighVideoUploadQuality:function\(\i\)\{)/,
replace: "return true;",
},
{
match: /canUseHighVideoUploadQuality:\i,/,
replace: "canUseHighVideoUploadQuality:()=>true,",
match: /(?<=canStreamQuality:function\(\i,\i\)\{)/,
replace: "return true;",
},
],
predicate: () => settings.store.unlockQualityOptions && !isPluginEnabled(fakeNitro.name),
predicate: () => settings.store.unlockQualityOptions && !isPluginEnabled(fakeNitro.name) && !Settings.plugins[fakeNitro.name].enableStreamQualityBypass,
noWarn: true,
},
// remove guild premium tier restriction from stream fps options

View file

@ -136,7 +136,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: ""
}
},
@ -197,7 +197,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

@ -23,7 +23,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";
@ -157,26 +157,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],
@ -187,8 +167,6 @@ export default definePlugin({
settings,
patches: [
// TODO: remove
makeBypassPatches(),
{
find: "canUseCustomStickersEverywhere:",
replacement: [
@ -292,11 +270,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

@ -1143,7 +1143,7 @@ export default definePlugin({
replace: "$1Infinity"
},
{
match: /(\i)\.slice\(0,(Math\.max\(\i,\i(?:-\i\.length){2}\))\)/,
match: /(\i)\.slice\(0,(Math\.max\(\d+?,\i(?:-\i\.length){2}\))\)/,
replace: "($1.sliceTo = $2, $1)"
}
]

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

@ -679,16 +679,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)/,
@ -699,16 +689,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)/,
@ -723,18 +703,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)=>)/,
@ -853,16 +821,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

@ -94,18 +94,24 @@ export default definePlugin({
isModified: true,
settings,
patches: [
...[
'"MessageStore"',
'"ReadStateStore"'
].map(find => ({
find,
{
find: '"MessageStore"',
replacement: [
{
match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
replace: (_, _funcName, props) => `if($self.disableNotification(${props}.message)){return;};`
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
replace: (_, props) => `if($self.disableNotification(${props}.message))return;`
}
]
})),
},
{
find: '"ReadStateStore"',
replacement: [
{
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
replace: (_, props) => `if($self.disableNotification(${props}.message))return;`
}
]
},
{
find: "`forum-post-action-bar-",
replacement: [

View file

@ -26,7 +26,7 @@ import { JSX } from "react";
const SMYNC = classNameFactory();
const UserStore = findStoreLazy("UserStore");
const wrapEmojis = findByCodeLazy("lastIndex;return");
const adjustColor = findByCodeLazy("light1", "dark1", "toonStroke");
const adjustColor = findByCodeLazy("light1", '.get("hsl.s"))');
const AccessibilityStore = findStoreLazy("AccessibilityStore");
const roleColorPattern = /^role((?:\+|-)\d{0,4})?$/iu;

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

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