Skip to content

Commit 7c05561

Browse files
authored
Merge pull request #40 from Vendicated/main
dec 2
2 parents 10e0af8 + 48a9aef commit 7c05561

File tree

13 files changed

+56
-49
lines changed

13 files changed

+56
-49
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vencord",
33
"private": "true",
4-
"version": "1.10.8",
4+
"version": "1.10.9",
55
"description": "The cutest Discord client mod",
66
"homepage": "https://github.com/Vendicated/Vencord#readme",
77
"bugs": {

src/plugins/_core/noTrack.ts

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ export default definePlugin({
5959
replace: "$&return;"
6060
}
6161
]
62+
},
63+
{
64+
find: ".BetterDiscord||null!=",
65+
replacement: {
66+
// Make hasClientMods return false
67+
match: /(?=let \i=window;)/,
68+
replace: "return false;"
69+
}
6270
}
6371
],
6472

src/plugins/appleMusic.desktop/native.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7+
import { canonicalizeMatch } from "@utils/patches";
78
import { execFile } from "child_process";
89
import { promisify } from "util";
910

@@ -26,7 +27,7 @@ interface RemoteData {
2627
let cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null;
2728

2829
const APPLE_MUSIC_BUNDLE_REGEX = /<script type="module" crossorigin src="([a-zA-Z0-9.\-/]+)"><\/script>/;
29-
const APPLE_MUSIC_TOKEN_REGEX = /\w+="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)",\w+="x-apple-jingle-correlation-key"/;
30+
const APPLE_MUSIC_TOKEN_REGEX = canonicalizeMatch(/Promise.allSettled\(\i\)\}const \i="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)"/);
3031

3132
let cachedToken: string | undefined = undefined;
3233

src/plugins/consoleJanitor/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ export default definePlugin({
7474
}
7575
},
7676
{
77-
find: 'react-spring: The "interpolate" function',
77+
find: 'The "interpolate" function is deprecated in v10 (use "to" instead)',
7878
replacement: {
79-
match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
79+
match: /,console.warn\(\i\+'The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
8080
replace: ""
8181
}
8282
},
@@ -133,7 +133,7 @@ export default definePlugin({
133133
{
134134
find: "Slow dispatch on",
135135
replacement: {
136-
match: /\i\.totalTime>100&&\i\.verbose\("Slow dispatch on ".+?\)\);/,
136+
match: /\i\.totalTime>\i&&\i\.verbose\("Slow dispatch on ".+?\)\);/,
137137
replace: ""
138138
}
139139
},

src/plugins/fakeNitro/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ function makeBypassPatches(): Omit<Patch, "plugin"> {
207207
return {
208208
find: "canUseCustomStickersEverywhere:",
209209
replacement: mapping.map(({ func, predicate }) => ({
210-
match: new RegExp(String.raw`(?<=${func}:function\(\i(?:,\i)?\){)`),
211-
replace: "return true;",
210+
match: new RegExp(String.raw`(?<=${func}:)\i`),
211+
replace: "() => true",
212212
predicate
213213
}))
214214
};
@@ -297,8 +297,8 @@ export default definePlugin({
297297
replacement: [
298298
{
299299
// Overwrite incoming connection settings proto with our local settings
300-
match: /CONNECTION_OPEN:function\((\i)\){/,
301-
replace: (m, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
300+
match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/,
301+
replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
302302
},
303303
{
304304
// Overwrite non local proto changes with our local settings

src/plugins/favEmojiFirst/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default definePlugin({
5757
{
5858
// https://regex101.com/r/x2mobQ/1
5959
// searchEmojis(...,maxCount: stuff) ... endEmojis = emojis.slice(0, maxCount - gifResults.length)
60-
match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(\i-\i\.length)\)/,
60+
match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(Math\.max\(\i,\i(?:-\i\.length){2}\))\)/,
6161
// ,maxCount:Infinity ... endEmojis = (emojis.sliceTo = n, emojis)
6262
replace: ",maxCount:Infinity$2=($3.sliceTo = $4, $3)"
6363
}

src/plugins/messageLogger/index.tsx

+22-22
Original file line numberDiff line numberDiff line change
@@ -346,35 +346,35 @@ export default definePlugin({
346346
replacement: [
347347
{
348348
// Add deleted=true to all target messages in the MESSAGE_DELETE event
349-
match: /MESSAGE_DELETE:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/,
349+
match: /function (?=.+?MESSAGE_DELETE:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
350350
replace:
351-
"MESSAGE_DELETE:function($1){" +
352-
" var cache = $2getOrCreate($1.channelId);" +
353-
" cache = $self.handleDelete(cache, $1, false);" +
354-
" $2commit(cache);" +
355-
"},"
351+
"function $1($2){" +
352+
" var cache = $3getOrCreate($2.channelId);" +
353+
" cache = $self.handleDelete(cache, $2, false);" +
354+
" $3commit(cache);" +
355+
"}"
356356
},
357357
{
358358
// Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event
359-
match: /MESSAGE_DELETE_BULK:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/,
359+
match: /function (?=.+?MESSAGE_DELETE_BULK:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
360360
replace:
361-
"MESSAGE_DELETE_BULK:function($1){" +
362-
" var cache = $2getOrCreate($1.channelId);" +
363-
" cache = $self.handleDelete(cache, $1, true);" +
364-
" $2commit(cache);" +
365-
"},"
361+
"function $1($2){" +
362+
" var cache = $3getOrCreate($2.channelId);" +
363+
" cache = $self.handleDelete(cache, $2, true);" +
364+
" $3commit(cache);" +
365+
"}"
366366
},
367367
{
368368
// Add current cached content + new edit time to cached message's editHistory
369-
match: /(MESSAGE_UPDATE:function\((\i)\).+?)\.update\((\i)/,
369+
match: /(function (\i)\((\i)\).+?)\.update\((\i)(?=.*MESSAGE_UPDATE:\2)/,
370370
replace: "$1" +
371-
".update($3,m =>" +
372-
" (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" +
373-
" $2.message.edited_timestamp && $2.message.content !== m.content ?" +
374-
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" +
371+
".update($4,m =>" +
372+
" (($3.message.flags & 64) === 64 || $self.shouldIgnore($3.message, true)) ? m :" +
373+
" $3.message.edited_timestamp && $3.message.content !== m.content ?" +
374+
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($3.message, m)]) :" +
375375
" m" +
376376
")" +
377-
".update($3"
377+
".update($4"
378378
},
379379
{
380380
// fix up key (edit last message) attempting to edit a deleted message
@@ -488,12 +488,12 @@ export default definePlugin({
488488
find: '"ReferencedMessageStore"',
489489
replacement: [
490490
{
491-
match: /MESSAGE_DELETE:function\((\i)\).+?},/,
492-
replace: "MESSAGE_DELETE:function($1){},"
491+
match: /MESSAGE_DELETE:\i,/,
492+
replace: "MESSAGE_DELETE:()=>{},"
493493
},
494494
{
495-
match: /MESSAGE_DELETE_BULK:function\((\i)\).+?},/,
496-
replace: "MESSAGE_DELETE_BULK:function($1){},"
495+
match: /MESSAGE_DELETE_BULK:\i,/,
496+
replace: "MESSAGE_DELETE_BULK:()=>{},"
497497
}
498498
]
499499
},

src/plugins/moreUserTags/index.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ export default definePlugin({
183183
{
184184
find: ".ORIGINAL_POSTER=",
185185
replacement: {
186-
match: /\((\i)=\{\}\)\)\[(\i)\.BOT/,
187-
replace: "($1=$self.getTagTypes()))[$2.BOT"
186+
match: /(?=(\i)\[\i\.BOT)/,
187+
replace: "$self.genTagTypes($1);"
188188
}
189189
},
190190
{
@@ -280,8 +280,7 @@ export default definePlugin({
280280
.filter(Boolean);
281281
},
282282

283-
getTagTypes() {
284-
const obj = {};
283+
genTagTypes(obj) {
285284
let i = 100;
286285
tags.forEach(({ name }) => {
287286
obj[name] = ++i;
@@ -291,7 +290,6 @@ export default definePlugin({
291290
obj[`${name}-OP`] = ++i;
292291
obj[i] = `${name}-OP`;
293292
});
294-
return obj;
295293
},
296294

297295
isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]),

src/plugins/noBlockedMessages/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export default definePlugin({
5454
predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true,
5555
replacement: [
5656
{
57-
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
58-
replace: (_, props) => `if($self.isBlocked(${props}.message))return;`
57+
match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
58+
replace: (_, _funcName, props) => `if($self.isBlocked(${props}.message))return;`
5959
}
6060
]
6161
}))

src/plugins/noPendingCount/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ export default definePlugin({
7474
// This prevents the Message Requests tab from always hiding due to the previous patch (and is compatible with spam requests)
7575
// In short, only the red badge is hidden. Button visibility behavior isn't changed.
7676
{
77-
find: ".getSpamChannelsCount()",
77+
find: ".getSpamChannelsCount();return",
7878
predicate: () => settings.store.hideMessageRequestsCount,
7979
replacement: {
80-
match: /(?<=getSpamChannelsCount\(\),\i=)\i\.getMessageRequestsCount\(\)/,
80+
match: /(?<=getSpamChannelsCount\(\);return )\i\.getMessageRequestsCount\(\)/,
8181
replace: "$self.getRealMessageRequestCount()"
8282
}
8383
},

src/plugins/pinDms/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default definePlugin({
7171
replacement: [
7272
{
7373
// Filter out pinned channels from the private channel list
74-
match: /(?<=\i,{channels:\i,)privateChannelIds:(\i)/,
74+
match: /(?<=channels:\i,)privateChannelIds:(\i)(?=,listRef:)/,
7575
replace: "privateChannelIds:$1.filter(c=>!$self.isPinned(c))"
7676
},
7777
{
@@ -96,8 +96,8 @@ export default definePlugin({
9696

9797
// Fix Row Height
9898
{
99-
match: /(?<="getRowHeight",.{1,100}return 1===)\i/,
100-
replace: "($&-$self.categoryLen())"
99+
match: /(\.startsWith\("section-divider"\).+?return 1===)(\i)/,
100+
replace: "$1($2-$self.categoryLen())"
101101
},
102102
{
103103
match: /"getRowHeight",\((\i),(\i)\)=>{/,
@@ -124,7 +124,7 @@ export default definePlugin({
124124
{
125125
find: ".FRIENDS},\"friends\"",
126126
replacement: {
127-
match: /(?<=\i=\i=>{).{1,100}premiumTabSelected.{1,800}showDMHeader:.+?,/,
127+
match: /(?<=\i=\i=>{).{1,100}premiumTabSelected.{0,950}showDMHeader:.+?,/,
128128
replace: "let forceUpdate = Vencord.Util.useForceUpdater();$&_forceUpdate:forceUpdate,"
129129
}
130130
},

src/plugins/volumeBooster/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default definePlugin({
9494
find: "AudioContextSettingsMigrated",
9595
replacement: [
9696
{
97-
match: /(?<=isLocalMute\(\i,\i\),volume:.+?volume:)\i(?=})/,
97+
match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/,
9898
replace: "$&>200?200:$&"
9999
},
100100
{
@@ -109,7 +109,7 @@ export default definePlugin({
109109
},
110110
// Prevent the MediaEngineStore from overwriting our LocalVolumes above 200 with the ones the Discord Audio Context Settings sync sends
111111
{
112-
find: '"MediaEngineStore"',
112+
find: '="MediaEngineStore",',
113113
replacement: [
114114
{
115115
match: /(\.settings\.audioContextSettings.+?)(\i\[\i\])=(\i\.volume)(.+?setLocalVolume\(\i,).+?\)/,

src/plugins/whoReacted/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ export default definePlugin({
113113
{
114114
find: '"MessageReactionsStore"',
115115
replacement: {
116-
match: /(?<=CONNECTION_OPEN:function\(\){)(\i)={}/,
117-
replace: "$&;$self.reactions=$1"
116+
match: /function (\i)\(\){(\i)={}(?=.*CONNECTION_OPEN:\1)/,
117+
replace: "$&;$self.reactions=$2;"
118118
}
119119
},
120120
{

0 commit comments

Comments
 (0)