Compare commits

..

6 commits

Author SHA1 Message Date
f33e0dcb73
offline edition 2024-12-11 16:51:17 +09:00
5b12fd1d45
katex 2 katex harder 2024-12-11 16:51:17 +09:00
10addb295c
katex left align 2024-12-11 16:51:17 +09:00
4a20dd4278
katex 2024-12-11 16:51:17 +09:00
a7f41f0608
asdf 2024-12-11 16:51:17 +09:00
66cc6754e4
owo 2024-12-11 16:51:13 +09:00
14 changed files with 50 additions and 57 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "vencord", "name": "vencord",
"private": "true", "private": "true",
"version": "1.10.9", "version": "1.10.8",
"description": "The cutest Discord client mod", "description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme", "homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": { "bugs": {

View file

@ -59,14 +59,6 @@ export default definePlugin({
replace: "$&return;" replace: "$&return;"
} }
] ]
},
{
find: ".BetterDiscord||null!=",
replacement: {
// Make hasClientMods return false
match: /(?=let \i=window;)/,
replace: "return false;"
}
} }
], ],

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { canonicalizeMatch } from "@utils/patches";
import { execFile } from "child_process"; import { execFile } from "child_process";
import { promisify } from "util"; import { promisify } from "util";
@ -27,7 +26,7 @@ interface RemoteData {
let cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null; let cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null;
const APPLE_MUSIC_BUNDLE_REGEX = /<script type="module" crossorigin src="([a-zA-Z0-9.\-/]+)"><\/script>/; const APPLE_MUSIC_BUNDLE_REGEX = /<script type="module" crossorigin src="([a-zA-Z0-9.\-/]+)"><\/script>/;
const APPLE_MUSIC_TOKEN_REGEX = canonicalizeMatch(/Promise.allSettled\(\i\)\}const \i="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)"/); const APPLE_MUSIC_TOKEN_REGEX = /\w+="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)",\w+="x-apple-jingle-correlation-key"/;
let cachedToken: string | undefined = undefined; let cachedToken: string | undefined = undefined;

View file

@ -74,9 +74,9 @@ export default definePlugin({
} }
}, },
{ {
find: 'The "interpolate" function is deprecated in v10 (use "to" instead)', find: 'react-spring: The "interpolate" function',
replacement: { 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: "" replace: ""
} }
}, },
@ -133,7 +133,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: ""
} }
}, },

View file

@ -207,8 +207,8 @@ function makeBypassPatches(): Omit<Patch, "plugin"> {
return { return {
find: "canUseCustomStickersEverywhere:", find: "canUseCustomStickersEverywhere:",
replacement: mapping.map(({ func, predicate }) => ({ replacement: mapping.map(({ func, predicate }) => ({
match: new RegExp(String.raw`(?<=${func}:)\i`), match: new RegExp(String.raw`(?<=${func}:function\(\i(?:,\i)?\){)`),
replace: "() => true", replace: "return true;",
predicate predicate
})) }))
}; };
@ -297,8 +297,8 @@ export default definePlugin({
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

View file

@ -57,7 +57,7 @@ export default definePlugin({
{ {
// https://regex101.com/r/x2mobQ/1 // https://regex101.com/r/x2mobQ/1
// searchEmojis(...,maxCount: stuff) ... endEmojis = emojis.slice(0, maxCount - gifResults.length) // 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,(\i-\i\.length)\)/,
// ,maxCount:Infinity ... endEmojis = (emojis.sliceTo = n, emojis) // ,maxCount:Infinity ... endEmojis = (emojis.sliceTo = n, emojis)
replace: ",maxCount:Infinity$2=($3.sliceTo = $4, $3)" replace: ",maxCount:Infinity$2=($3.sliceTo = $4, $3)"
} }

View file

@ -24,7 +24,7 @@ export default definePlugin({
find: "codeBlock:{react(", find: "codeBlock:{react(",
replacement: { replacement: {
match: /codeBlock:\{react\((\i),(\i),(\i)\)\{/, match: /codeBlock:\{react\((\i),(\i),(\i)\)\{/,
replace: "$&if($1.lang == 'latex' || $1.lang == 'tex') return $self.createBlock($1,$2,$3);" replace: "$&if($1.lang == 'latex') return $self.createBlock($1,$2,$3);"
} }
}, },
{ {

View file

@ -346,35 +346,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
@ -488,12 +488,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){},"
} }
] ]
}, },

View file

@ -183,8 +183,8 @@ export default definePlugin({
{ {
find: ".ORIGINAL_POSTER=", find: ".ORIGINAL_POSTER=",
replacement: { replacement: {
match: /(?=(\i)\[\i\.BOT)/, match: /\((\i)=\{\}\)\)\[(\i)\.BOT/,
replace: "$self.genTagTypes($1);" replace: "($1=$self.getTagTypes()))[$2.BOT"
} }
}, },
{ {
@ -280,7 +280,8 @@ export default definePlugin({
.filter(Boolean); .filter(Boolean);
}, },
genTagTypes(obj) { getTagTypes() {
const obj = {};
let i = 100; let i = 100;
tags.forEach(({ name }) => { tags.forEach(({ name }) => {
obj[name] = ++i; obj[name] = ++i;
@ -290,6 +291,7 @@ export default definePlugin({
obj[`${name}-OP`] = ++i; obj[`${name}-OP`] = ++i;
obj[i] = `${name}-OP`; obj[i] = `${name}-OP`;
}); });
return obj;
}, },
isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]), isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]),

View file

@ -54,8 +54,8 @@ export default definePlugin({
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;`
} }
] ]
})) }))

View file

@ -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();return", 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()"
} }
}, },

View file

@ -71,7 +71,7 @@ export default definePlugin({
replacement: [ replacement: [
{ {
// Filter out pinned channels from the private channel list // Filter out pinned channels from the private channel list
match: /(?<=channels:\i,)privateChannelIds:(\i)(?=,listRef:)/, match: /(?<=\i,{channels:\i,)privateChannelIds:(\i)/,
replace: "privateChannelIds:$1.filter(c=>!$self.isPinned(c))" replace: "privateChannelIds:$1.filter(c=>!$self.isPinned(c))"
}, },
{ {
@ -96,8 +96,8 @@ export default definePlugin({
// Fix Row Height // Fix Row Height
{ {
match: /(\.startsWith\("section-divider"\).+?return 1===)(\i)/, match: /(?<="getRowHeight",.{1,100}return 1===)\i/,
replace: "$1($2-$self.categoryLen())" replace: "($&-$self.categoryLen())"
}, },
{ {
match: /"getRowHeight",\((\i),(\i)\)=>{/, match: /"getRowHeight",\((\i),(\i)\)=>{/,
@ -124,7 +124,7 @@ export default definePlugin({
{ {
find: ".FRIENDS},\"friends\"", find: ".FRIENDS},\"friends\"",
replacement: { replacement: {
match: /(?<=\i=\i=>{).{1,100}premiumTabSelected.{0,950}showDMHeader:.+?,/, match: /(?<=\i=\i=>{).{1,100}premiumTabSelected.{1,800}showDMHeader:.+?,/,
replace: "let forceUpdate = Vencord.Util.useForceUpdater();$&_forceUpdate:forceUpdate," replace: "let forceUpdate = Vencord.Util.useForceUpdater();$&_forceUpdate:forceUpdate,"
} }
}, },

View file

@ -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,).+?\)/,

View file

@ -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"
} }
}, },
{ {