mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-09 17:36:23 +00:00
Merge branch 'main' into listenbrainz
This commit is contained in:
commit
22f23d306f
19 changed files with 120 additions and 118 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.10.8",
|
"version": "1.10.9",
|
||||||
"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": {
|
||||||
|
|
|
@ -71,13 +71,16 @@ export async function installExt(id: string) {
|
||||||
// React Devtools v4.25
|
// React Devtools v4.25
|
||||||
// v4.27 is broken in Electron, see https://github.com/facebook/react/issues/25843
|
// v4.27 is broken in Electron, see https://github.com/facebook/react/issues/25843
|
||||||
// Unfortunately, Google does not serve old versions, so this is the only way
|
// Unfortunately, Google does not serve old versions, so this is the only way
|
||||||
|
// This zip file is pinned to long commit hash so it cannot be changed remotely
|
||||||
? "https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip"
|
? "https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip"
|
||||||
: `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`;
|
: `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=${process.versions.chrome}`;
|
||||||
|
|
||||||
const buf = await get(url, {
|
const buf = await get(url, {
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "Vencord (https://github.com/Vendicated/Vencord)"
|
"User-Agent": `Electron ${process.versions.electron} ~ Vencord (https://github.com/Vendicated/Vencord)`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await extract(crxToZip(buf), extDir).catch(console.error);
|
await extract(crxToZip(buf), extDir).catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,14 @@ export default definePlugin({
|
||||||
replace: "$&return;"
|
replace: "$&return;"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".BetterDiscord||null!=",
|
||||||
|
replacement: {
|
||||||
|
// Make hasClientMods return false
|
||||||
|
match: /(?=let \i=window;)/,
|
||||||
|
replace: "return false;"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* 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";
|
||||||
|
|
||||||
|
@ -26,7 +27,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 = /\w+="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)",\w+="x-apple-jingle-correlation-key"/;
|
const APPLE_MUSIC_TOKEN_REGEX = canonicalizeMatch(/Promise.allSettled\(\i\)\}const \i="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)"/);
|
||||||
|
|
||||||
let cachedToken: string | undefined = undefined;
|
let cachedToken: string | undefined = undefined;
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,9 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: 'react-spring: The "interpolate" function',
|
find: 'The "interpolate" function is deprecated in v10 (use "to" instead)',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
|
match: /,console.warn\(\i\+'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>100&&\i\.verbose\("Slow dispatch on ".+?\)\);/,
|
match: /\i\.totalTime>\i&&\i\.verbose\("Slow dispatch on ".+?\)\);/,
|
||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -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}:function\(\i(?:,\i)?\){)`),
|
match: new RegExp(String.raw`(?<=${func}:)\i`),
|
||||||
replace: "return true;",
|
replace: "() => 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: /CONNECTION_OPEN:function\((\i)\){/,
|
match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/,
|
||||||
replace: (m, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
|
replace: (m, funcName, 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
|
||||||
|
|
|
@ -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,(\i-\i\.length)\)/,
|
match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(Math\.max\(\i,\i(?:-\i\.length){2}\))\)/,
|
||||||
// ,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)"
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: /MESSAGE_DELETE:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/,
|
match: /function (?=.+?MESSAGE_DELETE:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
|
||||||
replace:
|
replace:
|
||||||
"MESSAGE_DELETE:function($1){" +
|
"function $1($2){" +
|
||||||
" var cache = $2getOrCreate($1.channelId);" +
|
" var cache = $3getOrCreate($2.channelId);" +
|
||||||
" cache = $self.handleDelete(cache, $1, false);" +
|
" cache = $self.handleDelete(cache, $2, false);" +
|
||||||
" $2commit(cache);" +
|
" $3commit(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: /MESSAGE_DELETE_BULK:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/,
|
match: /function (?=.+?MESSAGE_DELETE_BULK:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
|
||||||
replace:
|
replace:
|
||||||
"MESSAGE_DELETE_BULK:function($1){" +
|
"function $1($2){" +
|
||||||
" var cache = $2getOrCreate($1.channelId);" +
|
" var cache = $3getOrCreate($2.channelId);" +
|
||||||
" cache = $self.handleDelete(cache, $1, true);" +
|
" cache = $self.handleDelete(cache, $2, true);" +
|
||||||
" $2commit(cache);" +
|
" $3commit(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: /(MESSAGE_UPDATE:function\((\i)\).+?)\.update\((\i)/,
|
match: /(function (\i)\((\i)\).+?)\.update\((\i)(?=.*MESSAGE_UPDATE:\2)/,
|
||||||
replace: "$1" +
|
replace: "$1" +
|
||||||
".update($3,m =>" +
|
".update($4,m =>" +
|
||||||
" (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" +
|
" (($3.message.flags & 64) === 64 || $self.shouldIgnore($3.message, true)) ? m :" +
|
||||||
" $2.message.edited_timestamp && $2.message.content !== m.content ?" +
|
" $3.message.edited_timestamp && $3.message.content !== m.content ?" +
|
||||||
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" +
|
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($3.message, m)]) :" +
|
||||||
" m" +
|
" m" +
|
||||||
")" +
|
")" +
|
||||||
".update($3"
|
".update($4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// 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:function\((\i)\).+?},/,
|
match: /MESSAGE_DELETE:\i,/,
|
||||||
replace: "MESSAGE_DELETE:function($1){},"
|
replace: "MESSAGE_DELETE:()=>{},"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /MESSAGE_DELETE_BULK:function\((\i)\).+?},/,
|
match: /MESSAGE_DELETE_BULK:\i,/,
|
||||||
replace: "MESSAGE_DELETE_BULK:function($1){},"
|
replace: "MESSAGE_DELETE_BULK:()=>{},"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -183,8 +183,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".ORIGINAL_POSTER=",
|
find: ".ORIGINAL_POSTER=",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\((\i)=\{\}\)\)\[(\i)\.BOT/,
|
match: /(?=(\i)\[\i\.BOT)/,
|
||||||
replace: "($1=$self.getTagTypes()))[$2.BOT"
|
replace: "$self.genTagTypes($1);"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -280,8 +280,7 @@ export default definePlugin({
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
},
|
},
|
||||||
|
|
||||||
getTagTypes() {
|
genTagTypes(obj) {
|
||||||
const obj = {};
|
|
||||||
let i = 100;
|
let i = 100;
|
||||||
tags.forEach(({ name }) => {
|
tags.forEach(({ name }) => {
|
||||||
obj[name] = ++i;
|
obj[name] = ++i;
|
||||||
|
@ -291,7 +290,6 @@ 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`]),
|
||||||
|
|
|
@ -54,8 +54,8 @@ export default definePlugin({
|
||||||
predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true,
|
predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
|
match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
|
||||||
replace: (_, props) => `if($self.isBlocked(${props}.message))return;`
|
replace: (_, _funcName, 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();return",
|
||||||
predicate: () => settings.store.hideMessageRequestsCount,
|
predicate: () => settings.store.hideMessageRequestsCount,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=getSpamChannelsCount\(\),\i=)\i\.getMessageRequestsCount\(\)/,
|
match: /(?<=getSpamChannelsCount\(\);return )\i\.getMessageRequestsCount\(\)/,
|
||||||
replace: "$self.getRealMessageRequestCount()"
|
replace: "$self.getRealMessageRequestCount()"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
5
src/plugins/noUnblockToJump/README.md
Normal file
5
src/plugins/noUnblockToJump/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# No Unblock To Jump
|
||||||
|
|
||||||
|
Removes the popup preventing you to jump to a message from a blocked/ignored user (eg: in search results)
|
||||||
|
|
||||||
|
![A modal popup telling you to unblock a user to jump their message](https://github.com/user-attachments/assets/0e4b859d-f3b3-4101-9a83-829afb473d1e)
|
|
@ -26,25 +26,46 @@ export default definePlugin({
|
||||||
authors: [Devs.dzshn],
|
authors: [Devs.dzshn],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
|
// Clicking on search results to jump
|
||||||
find: '.id,"Search Results"',
|
find: '.id,"Search Results"',
|
||||||
replacement: {
|
replacement: [
|
||||||
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
{
|
||||||
replace: "if(false)$1"
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
||||||
}
|
replace: "if(false)$1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/,
|
||||||
|
replace: "if(false)$1"
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
// Jump buttton in top right corner of messages
|
||||||
find: "renderJumpButton()",
|
find: "renderJumpButton()",
|
||||||
replacement: {
|
replacement: [
|
||||||
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
{
|
||||||
replace: "if(false)$1"
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
||||||
}
|
replace: "if(false)$1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/,
|
||||||
|
replace: "if(false)$1"
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
// Clicking on replied messages to jump
|
||||||
find: "flash:!0,returnMessageId",
|
find: "flash:!0,returnMessageId",
|
||||||
replacement: {
|
replacement: [
|
||||||
match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
{
|
||||||
replace: "false?$1"
|
match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
||||||
}
|
replace: "false?$1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/,
|
||||||
|
replace: "false?$1"
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,7 +57,7 @@ const UrlReplacementRules: Record<string, URLReplacementRule> = {
|
||||||
description: "Open Tidal links in the Tidal app",
|
description: "Open Tidal links in the Tidal app",
|
||||||
},
|
},
|
||||||
itunes: {
|
itunes: {
|
||||||
match: /^https:\/\/music\.apple\.com\/([a-z]{2}\/)?(album|artist|playlist|song|curator)\/([^/?#]+)\/?([^/?#]+)?(?:\?.*)?(?:#.*)?$/,
|
match: /^https:\/\/(?:geo\.)?music\.apple\.com\/([a-z]{2}\/)?(album|artist|playlist|song|curator)\/([^/?#]+)\/?([^/?#]+)?(?:\?.*)?(?:#.*)?$/,
|
||||||
replace: (_, lang, type, name, id) => id ? `itunes://music.apple.com/us/${type}/${name}/${id}` : `itunes://music.apple.com/us/${type}/${name}`,
|
replace: (_, lang, type, name, id) => id ? `itunes://music.apple.com/us/${type}/${name}/${id}` : `itunes://music.apple.com/us/${type}/${name}`,
|
||||||
description: "Open Apple Music links in the iTunes app"
|
description: "Open Apple Music links in the iTunes app"
|
||||||
},
|
},
|
||||||
|
|
|
@ -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: /(?<=\i,{channels:\i,)privateChannelIds:(\i)/,
|
match: /(?<=channels:\i,)privateChannelIds:(\i)(?=,listRef:)/,
|
||||||
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: /(?<="getRowHeight",.{1,100}return 1===)\i/,
|
match: /(\.startsWith\("section-divider"\).+?return 1===)(\i)/,
|
||||||
replace: "($&-$self.categoryLen())"
|
replace: "$1($2-$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.{1,800}showDMHeader:.+?,/,
|
match: /(?<=\i=\i=>{).{1,100}premiumTabSelected.{0,950}showDMHeader:.+?,/,
|
||||||
replace: "let forceUpdate = Vencord.Util.useForceUpdater();$&_forceUpdate:forceUpdate,"
|
replace: "let forceUpdate = Vencord.Util.useForceUpdater();$&_forceUpdate:forceUpdate,"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,7 +20,7 @@ import { definePluginSettings, Settings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common";
|
import { ChannelStore, ComponentDispatch, FluxDispatcher as Dispatcher, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common";
|
||||||
import { Message } from "discord-types/general";
|
import { Message } from "discord-types/general";
|
||||||
|
|
||||||
const Kangaroo = findByPropsLazy("jumpToMessage");
|
const Kangaroo = findByPropsLazy("jumpToMessage");
|
||||||
|
@ -60,24 +60,24 @@ export default definePlugin({
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
Dispatcher.subscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
|
||||||
Dispatcher.subscribe("MESSAGE_END_EDIT", onEndEdit);
|
|
||||||
Dispatcher.subscribe("MESSAGE_START_EDIT", onStartEdit);
|
|
||||||
Dispatcher.subscribe("CREATE_PENDING_REPLY", onCreatePendingReply);
|
|
||||||
document.addEventListener("keydown", onKeydown);
|
document.addEventListener("keydown", onKeydown);
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
Dispatcher.unsubscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
|
||||||
Dispatcher.unsubscribe("MESSAGE_END_EDIT", onEndEdit);
|
|
||||||
Dispatcher.unsubscribe("MESSAGE_START_EDIT", onStartEdit);
|
|
||||||
Dispatcher.unsubscribe("CREATE_PENDING_REPLY", onCreatePendingReply);
|
|
||||||
document.removeEventListener("keydown", onKeydown);
|
document.removeEventListener("keydown", onKeydown);
|
||||||
},
|
},
|
||||||
});
|
|
||||||
|
|
||||||
const onDeletePendingReply = () => replyIdx = -1;
|
flux: {
|
||||||
const onEndEdit = () => editIdx = -1;
|
DELETE_PENDING_REPLY() {
|
||||||
|
replyIdx = -1;
|
||||||
|
},
|
||||||
|
MESSAGE_END_EDIT() {
|
||||||
|
editIdx = -1;
|
||||||
|
},
|
||||||
|
MESSAGE_START_EDIT: onStartEdit,
|
||||||
|
CREATE_PENDING_REPLY: onCreatePendingReply
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function calculateIdx(messages: Message[], id: string) {
|
function calculateIdx(messages: Message[], id: string) {
|
||||||
const idx = messages.findIndex(m => m.id === id);
|
const idx = messages.findIndex(m => m.id === id);
|
||||||
|
@ -109,6 +109,8 @@ function onKeydown(e: KeyboardEvent) {
|
||||||
if (!isUp && e.key !== "ArrowDown") return;
|
if (!isUp && e.key !== "ArrowDown") return;
|
||||||
if (!isCtrl(e) || isAltOrMeta(e)) return;
|
if (!isCtrl(e) || isAltOrMeta(e)) return;
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
if (e.shiftKey)
|
if (e.shiftKey)
|
||||||
nextEdit(isUp);
|
nextEdit(isUp);
|
||||||
else
|
else
|
||||||
|
@ -194,9 +196,10 @@ function nextReply(isUp: boolean) {
|
||||||
channel,
|
channel,
|
||||||
message,
|
message,
|
||||||
shouldMention: shouldMention(message),
|
shouldMention: shouldMention(message),
|
||||||
showMentionToggle: channel.guild_id !== null && message.author.id !== meId,
|
showMentionToggle: channel.isPrivate() && message.author.id !== meId,
|
||||||
_isQuickReply: true
|
_isQuickReply: true
|
||||||
});
|
});
|
||||||
|
ComponentDispatch.dispatchToLastSubscribed("TEXTAREA_FOCUS");
|
||||||
jumpIfOffScreen(channel.id, message.id);
|
jumpIfOffScreen(channel.id, message.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,7 @@ const opt = (description: string) => ({
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
showTimeouts: opt("Show member timeout icons in chat."),
|
showTimeouts: opt("Show member timeout icons in chat."),
|
||||||
showInvitesPaused: opt("Show the invites paused tooltip in the server list."),
|
showInvitesPaused: opt("Show the invites paused tooltip in the server list."),
|
||||||
showModView: opt("Show the member mod view context menu item in all servers."),
|
showModView: opt("Show the member mod view context menu item in all servers.")
|
||||||
disableDiscoveryFilters: opt("Disable filters in Server Discovery search that hide servers that don't meet discovery criteria."),
|
|
||||||
disableDisallowedDiscoveryFilters: opt("Disable filters in Server Discovery search that hide NSFW & disallowed servers."),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
|
@ -40,6 +38,8 @@ export default definePlugin({
|
||||||
tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"],
|
tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"],
|
||||||
description: "Displays various hidden & moderator-only things regardless of permissions.",
|
description: "Displays various hidden & moderator-only things regardless of permissions.",
|
||||||
authors: [Devs.Dolfies],
|
authors: [Devs.Dolfies],
|
||||||
|
settings,
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "showCommunicationDisabledStyles",
|
find: "showCommunicationDisabledStyles",
|
||||||
|
@ -82,43 +82,6 @@ export default definePlugin({
|
||||||
match: /\i(?=\?null)/,
|
match: /\i(?=\?null)/,
|
||||||
replace: "false"
|
replace: "false"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
find: "prod_discoverable_guilds",
|
|
||||||
predicate: () => settings.store.disableDiscoveryFilters,
|
|
||||||
replacement: {
|
|
||||||
match: /\{"auto_removed:.*?\}/,
|
|
||||||
replace: "{}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// remove the 200 server minimum
|
|
||||||
{
|
|
||||||
find: '">200"',
|
|
||||||
predicate: () => settings.store.disableDiscoveryFilters,
|
|
||||||
replacement: {
|
|
||||||
match: '">200"',
|
|
||||||
replace: '">0"'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// empty word filter
|
|
||||||
{
|
|
||||||
find: '"pepe","nude"',
|
|
||||||
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
|
||||||
replacement: {
|
|
||||||
match: /(?<=[?=])\["pepe",.+?\]/,
|
|
||||||
replace: "[]",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// patch request that queries if term is allowed
|
|
||||||
{
|
|
||||||
find: ".GUILD_DISCOVERY_VALID_TERM,query:",
|
|
||||||
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
|
||||||
all: true,
|
|
||||||
replacement: {
|
|
||||||
match: /\i\.\i\.get\(\{url:\i\.\i\.GUILD_DISCOVERY_VALID_TERM,query:\{term:\i\},oldFormErrors:!0,rejectWithError:!1\}\)/g,
|
|
||||||
replace: "Promise.resolve({ body: { valid: true } })"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
settings,
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default definePlugin({
|
||||||
find: "AudioContextSettingsMigrated",
|
find: "AudioContextSettingsMigrated",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=isLocalMute\(\i,\i\),volume:.+?volume:)\i(?=})/,
|
match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/,
|
||||||
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: /(?<=CONNECTION_OPEN:function\(\){)(\i)={}/,
|
match: /function (\i)\(\){(\i)={}(?=.*CONNECTION_OPEN:\1)/,
|
||||||
replace: "$&;$self.reactions=$1"
|
replace: "$&;$self.reactions=$2;"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue