From 5636f9d9797bf64170db56447f4bf38f8fadf169 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Tue, 9 Apr 2024 17:09:23 -0300
Subject: [PATCH 01/13] Array support for find + ResurrectHome: View Server
Home Button on Server Guide (#2283)
---
scripts/generateReport.ts | 3 +
.../VencordSettings/PatchHelperTab.tsx | 52 ++++++++---
src/plugins/index.ts | 2 +
src/plugins/resurrectHome/index.tsx | 92 +++++++++++++++++--
src/utils/types.ts | 2 +-
src/webpack/patchWebpack.ts | 3 +-
6 files changed, 131 insertions(+), 23 deletions(-)
diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts
index 41e38429..bb764063 100644
--- a/scripts/generateReport.ts
+++ b/scripts/generateReport.ts
@@ -299,6 +299,9 @@ function runTime(token: string) {
delete patch.predicate;
delete patch.group;
+ if (!Array.isArray(patch.find))
+ patch.find = [patch.find];
+
if (!Array.isArray(patch.replacement))
patch.replacement = [patch.replacement];
diff --git a/src/components/VencordSettings/PatchHelperTab.tsx b/src/components/VencordSettings/PatchHelperTab.tsx
index 064c872a..c08c366c 100644
--- a/src/components/VencordSettings/PatchHelperTab.tsx
+++ b/src/components/VencordSettings/PatchHelperTab.tsx
@@ -33,8 +33,8 @@ if (IS_DEV) {
var differ = require("diff") as typeof import("diff");
}
-const findCandidates = debounce(function ({ find, setModule, setError }) {
- const candidates = search(find);
+const findCandidates = debounce(function ({ finds, setModule, setError }) {
+ const candidates = search(...finds);
const keys = Object.keys(candidates);
const len = keys.length;
if (len === 0)
@@ -180,7 +180,8 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) {
return (
<>
- replacement
+ {/* FormTitle adds a class if className is not set, so we set it to an empty string to prevent that */}
+ replacement
{!isFunc && (
-
Cheat Sheet
+
Cheat Sheet
{Object.entries({
"\\i": "Special regex escape sequence that matches identifiers (varnames, classnames, etc.)",
"$$": "Insert a $",
@@ -220,11 +221,12 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) {
interface FullPatchInputProps {
setFind(v: string): void;
+ setFinds(v: string[]): void;
setMatch(v: string): void;
setReplacement(v: string | ReplaceFn): void;
}
-function FullPatchInput({ setFind, setMatch, setReplacement }: FullPatchInputProps) {
+function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPatchInputProps) {
const [fullPatch, setFullPatch] = React.useState
("");
const [fullPatchError, setFullPatchError] = React.useState("");
@@ -256,7 +258,8 @@ function FullPatchInput({ setFind, setMatch, setReplacement }: FullPatchInputPro
if (!parsed.replacement.match) throw new Error("No 'replacement.match' field");
if (!parsed.replacement.replace) throw new Error("No 'replacement.replace' field");
- setFind(parsed.find);
+ setFind(JSON.stringify(parsed.find));
+ setFinds(parsed.find instanceof Array ? parsed.find : [parsed.find]);
setMatch(parsed.replacement.match instanceof RegExp ? parsed.replacement.match.source : parsed.replacement.match);
setReplacement(parsed.replacement.replace);
setFullPatchError("");
@@ -266,7 +269,7 @@ function FullPatchInput({ setFind, setMatch, setReplacement }: FullPatchInputPro
}
return <>
- Paste your full JSON patch here to fill out the fields
+ Paste your full JSON patch here to fill out the fields
{fullPatchError !== "" && {fullPatchError}}
>;
@@ -274,6 +277,7 @@ function FullPatchInput({ setFind, setMatch, setReplacement }: FullPatchInputPro
function PatchHelper() {
const [find, setFind] = React.useState("");
+ const [finds, setFinds] = React.useState([]);
const [match, setMatch] = React.useState("");
const [replacement, setReplacement] = React.useState("");
@@ -285,20 +289,39 @@ function PatchHelper() {
const code = React.useMemo(() => {
return `
{
- find: ${JSON.stringify(find)},
+ find: ${finds.length > 1 ? `[${finds.map(f => JSON.stringify(f)).join(", ")}]` : finds.length > 0 ? JSON.stringify(finds[0]) : "[]"},
replacement: {
match: /${match.replace(/(?full patch
- find
+ find
- match
+ match
+
>>();
+
+function ViewServerHomeButton() {
+ return (
+
+ {tooltipProps => (
+
+ )}
+
+ );
+}
+
+function useForceServerHome() {
+ const { forceServerHome } = settings.use(["forceServerHome"]);
+ const [shouldViewServerHome, setShouldViewServerHome] = useState(currentShouldViewServerHome);
+
+ useEffect(() => {
+ shouldViewServerHomeStates.add(setShouldViewServerHome);
+
+ return () => {
+ shouldViewServerHomeStates.delete(setShouldViewServerHome);
+ };
+ }, []);
+
+ return shouldViewServerHome || forceServerHome;
+}
+
+function useDisableViewServerHome() {
+ useEffect(() => () => {
+ currentShouldViewServerHome = false;
+ for (const setState of shouldViewServerHomeStates) {
+ setState(false);
+ }
+ }, []);
+}
const settings = definePluginSettings({
forceServerHome: {
@@ -30,12 +89,6 @@ const settings = definePluginSettings({
}
});
-function useForceServerHome() {
- const { forceServerHome } = settings.use(["forceServerHome"]);
-
- return forceServerHome;
-}
-
export default definePlugin({
name: "ResurrectHome",
description: "Re-enables the Server Home tab when there isn't a Server Guide. Also has an option to force the Server Home over the Server Guide, which is accessible through right-clicking the Server Guide.",
@@ -92,14 +145,37 @@ export default definePlugin({
match: /getMutableGuildChannelsForGuild\(\i\);return\(0,\i\.useStateFromStores\).+?\]\)(?=}function)/,
replace: m => `${m}&&!$self.useForceServerHome()`
}
+ },
+ // Add View Server Home Button to Server Guide
+ {
+ find: "487e85_1",
+ replacement: {
+ match: /(?<=text:(\i)\?\i\.\i\.Messages\.SERVER_GUIDE:\i\.\i\.Messages\.GUILD_HOME,)/,
+ replace: "badge:$self.ViewServerHomeButton({serverGuide:$1}),"
+ }
+ },
+ // Disable view Server Home override when the Server Home is unmouted
+ {
+ find: "69386d_5",
+ replacement: {
+ match: /location:"69386d_5".+?;/,
+ replace: "$&$self.useDisableViewServerHome();"
+ }
}
],
+ ViewServerHomeButton: ErrorBoundary.wrap(({ serverGuide }: { serverGuide?: boolean; }) => {
+ if (serverGuide !== true) return null;
+
+ return ;
+ }),
+
useForceServerHome,
+ useDisableViewServerHome,
contextMenus: {
"guild-context"(children, props) {
- const forceServerHome = useForceServerHome();
+ const { forceServerHome } = settings.use(["forceServerHome"]);
if (!props?.guild) return;
diff --git a/src/utils/types.ts b/src/utils/types.ts
index bec7cb0b..fc34b96d 100644
--- a/src/utils/types.ts
+++ b/src/utils/types.ts
@@ -36,7 +36,7 @@ export interface PatchReplacement {
export interface Patch {
plugin: string;
- find: string;
+ find: string | string[];
replacement: PatchReplacement | PatchReplacement[];
/** Whether this patch should apply to multiple modules */
all?: boolean;
diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts
index db47c875..2ce4939b 100644
--- a/src/webpack/patchWebpack.ts
+++ b/src/webpack/patchWebpack.ts
@@ -186,7 +186,8 @@ function patchFactories(factories: Record code.replace(match, replace));
if (patch.predicate && !patch.predicate()) continue;
- if (code.includes(patch.find)) {
+ // we change all patch.find to array in plugins/index
+ if ((patch.find as string[]).every(f => code.includes(f))) {
patchedBy.add(patch.plugin);
const previousMod = mod;
From 89dc74d5d7436ea090b759c5fa89c497f04ddf4f Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Sun, 14 Apr 2024 00:57:59 +0200
Subject: [PATCH 02/13] partially revert "Array support for find +
ResurrectHome: View Server Home Button on Server Guide (#2283)"
This reverts commit 5636f9d9797bf64170db56447f4bf38f8fadf169.
It breaks Vesktop which is not acceptable. Need to resolve this conflict and add this back later
---
scripts/generateReport.ts | 3 --
.../VencordSettings/PatchHelperTab.tsx | 52 +++++--------------
src/plugins/index.ts | 2 -
src/utils/types.ts | 2 +-
src/webpack/patchWebpack.ts | 3 +-
5 files changed, 15 insertions(+), 47 deletions(-)
diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts
index bb764063..41e38429 100644
--- a/scripts/generateReport.ts
+++ b/scripts/generateReport.ts
@@ -299,9 +299,6 @@ function runTime(token: string) {
delete patch.predicate;
delete patch.group;
- if (!Array.isArray(patch.find))
- patch.find = [patch.find];
-
if (!Array.isArray(patch.replacement))
patch.replacement = [patch.replacement];
diff --git a/src/components/VencordSettings/PatchHelperTab.tsx b/src/components/VencordSettings/PatchHelperTab.tsx
index c08c366c..064c872a 100644
--- a/src/components/VencordSettings/PatchHelperTab.tsx
+++ b/src/components/VencordSettings/PatchHelperTab.tsx
@@ -33,8 +33,8 @@ if (IS_DEV) {
var differ = require("diff") as typeof import("diff");
}
-const findCandidates = debounce(function ({ finds, setModule, setError }) {
- const candidates = search(...finds);
+const findCandidates = debounce(function ({ find, setModule, setError }) {
+ const candidates = search(find);
const keys = Object.keys(candidates);
const len = keys.length;
if (len === 0)
@@ -180,8 +180,7 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) {
return (
<>
- {/* FormTitle adds a class if className is not set, so we set it to an empty string to prevent that */}
- replacement
+ replacement
{!isFunc && (
-
Cheat Sheet
+
Cheat Sheet
{Object.entries({
"\\i": "Special regex escape sequence that matches identifiers (varnames, classnames, etc.)",
"$$": "Insert a $",
@@ -221,12 +220,11 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) {
interface FullPatchInputProps {
setFind(v: string): void;
- setFinds(v: string[]): void;
setMatch(v: string): void;
setReplacement(v: string | ReplaceFn): void;
}
-function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPatchInputProps) {
+function FullPatchInput({ setFind, setMatch, setReplacement }: FullPatchInputProps) {
const [fullPatch, setFullPatch] = React.useState
("");
const [fullPatchError, setFullPatchError] = React.useState("");
@@ -258,8 +256,7 @@ function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPat
if (!parsed.replacement.match) throw new Error("No 'replacement.match' field");
if (!parsed.replacement.replace) throw new Error("No 'replacement.replace' field");
- setFind(JSON.stringify(parsed.find));
- setFinds(parsed.find instanceof Array ? parsed.find : [parsed.find]);
+ setFind(parsed.find);
setMatch(parsed.replacement.match instanceof RegExp ? parsed.replacement.match.source : parsed.replacement.match);
setReplacement(parsed.replacement.replace);
setFullPatchError("");
@@ -269,7 +266,7 @@ function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPat
}
return <>
- Paste your full JSON patch here to fill out the fields
+ Paste your full JSON patch here to fill out the fields
{fullPatchError !== "" && {fullPatchError}}
>;
@@ -277,7 +274,6 @@ function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPat
function PatchHelper() {
const [find, setFind] = React.useState("");
- const [finds, setFinds] = React.useState([]);
const [match, setMatch] = React.useState("");
const [replacement, setReplacement] = React.useState("");
@@ -289,39 +285,20 @@ function PatchHelper() {
const code = React.useMemo(() => {
return `
{
- find: ${finds.length > 1 ? `[${finds.map(f => JSON.stringify(f)).join(", ")}]` : finds.length > 0 ? JSON.stringify(finds[0]) : "[]"},
+ find: ${JSON.stringify(find)},
replacement: {
match: /${match.replace(/(?full patch
- find
+ find
- match
+ match
-
code.replace(match, replace));
if (patch.predicate && !patch.predicate()) continue;
- // we change all patch.find to array in plugins/index
- if ((patch.find as string[]).every(f => code.includes(f))) {
+ if (code.includes(patch.find)) {
patchedBy.add(patch.plugin);
const previousMod = mod;
From e5bd5534db78103b522ab7f977a45c238492c870 Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Sun, 14 Apr 2024 01:35:04 +0200
Subject: [PATCH 03/13] Fix SpotifyControls
---
.../spotifyControls/PlayerComponent.tsx | 18 ++++-------
src/plugins/spotifyControls/index.tsx | 30 +++++++++++++++----
2 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/src/plugins/spotifyControls/PlayerComponent.tsx b/src/plugins/spotifyControls/PlayerComponent.tsx
index ae28631c..105b3b18 100644
--- a/src/plugins/spotifyControls/PlayerComponent.tsx
+++ b/src/plugins/spotifyControls/PlayerComponent.tsx
@@ -18,7 +18,6 @@
import "./spotifyStyles.css";
-import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { ImageIcon, LinkIcon, OpenExternalIcon } from "@components/Icons";
import { debounce } from "@shared/debounce";
@@ -376,17 +375,10 @@ export function Player() {
} as React.CSSProperties;
return (
- (
-
-
Failed to render Spotify Modal :(
-
Check the console for errors
-
- )}>
-
-
-
-
-
-
+
+
+
+
+
);
}
diff --git a/src/plugins/spotifyControls/index.tsx b/src/plugins/spotifyControls/index.tsx
index d7e4f645..06595892 100644
--- a/src/plugins/spotifyControls/index.tsx
+++ b/src/plugins/spotifyControls/index.tsx
@@ -18,6 +18,7 @@
import { Settings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
+import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
@@ -49,10 +50,10 @@ export default definePlugin({
{
find: "showTaglessAccountPanel:",
replacement: {
- // return React.createElement(AccountPanel, { ..., showTaglessAccountPanel: blah })
- match: /return ?(.{0,30}\(.{1,3},\{[^}]+?,showTaglessAccountPanel:.+?\}\))/,
- // return [Player, Panel]
- replace: "return [$self.renderPlayer(),$1]"
+ // react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah })
+ match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?showTaglessAccountPanel:)/,
+ // react.jsx(WrapperComponent, { VencordOriginal: AccountPanel, ...
+ replace: "$self.PanelWrapper,{VencordOriginal:$1,"
}
},
{
@@ -78,6 +79,25 @@ export default definePlugin({
}
}
],
+
start: () => toggleHoverControls(Settings.plugins.SpotifyControls.hoverControls),
- renderPlayer: () =>
+
+ PanelWrapper({ VencordOriginal, ...props }) {
+ return (
+ <>
+ (
+
+
Failed to render Spotify Modal :(
+
Check the console for errors
+
+ )}
+ >
+
+
+
+
+ >
+ );
+ }
});
From af7d1b9df2690be27ecd868624fa8e66e9b44044 Mon Sep 17 00:00:00 2001
From: Elvyra <88881326+EdVraz@users.noreply.github.com>
Date: Sun, 14 Apr 2024 01:36:56 +0200
Subject: [PATCH 04/13] fix ShowMeYourName (#2354)
---
src/plugins/showMeYourName/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx
index 62d0645d..a9db1af9 100644
--- a/src/plugins/showMeYourName/index.tsx
+++ b/src/plugins/showMeYourName/index.tsx
@@ -49,7 +49,7 @@ export default definePlugin({
{
find: ".useCanSeeRemixBadge)",
replacement: {
- match: /(?<=onContextMenu:\i,children:).*?\}/,
+ match: /(?<=onContextMenu:\i,children:).*?\)}/,
replace: "$self.renderUsername(arguments[0])}"
}
},
From 59fc922aee50233bef91282e67a37e9c2c6d66b6 Mon Sep 17 00:00:00 2001
From: AutumnVN
Date: Sun, 14 Apr 2024 06:40:27 +0700
Subject: [PATCH 05/13] viewIcons: fix for banners (#2351)
---
src/plugins/viewIcons/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx
index 6eb773c2..f71777ad 100644
--- a/src/plugins/viewIcons/index.tsx
+++ b/src/plugins/viewIcons/index.tsx
@@ -174,7 +174,7 @@ export default definePlugin({
find: ".NITRO_BANNER,",
replacement: {
// style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl,
- match: /style:\{(?=backgroundImage:(\i)\?"url\("\.concat\((\i),)/,
+ match: /style:\{(?=backgroundImage:(null!=\i)\?"url\("\.concat\((\i),)/,
replace:
// onClick: () => shouldShowBanner && ev.target.style.backgroundImage && openImage(bannerUrl), style: { cursor: shouldShowBanner ? "pointer" : void 0,
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
From 00427c53d8dbac36584736bd30a376e61b860c78 Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Sun, 14 Apr 2024 01:50:18 +0200
Subject: [PATCH 06/13] fix pronoundb
---
src/plugins/pronoundb/index.ts | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/plugins/pronoundb/index.ts b/src/plugins/pronoundb/index.ts
index b1e74158..61edd191 100644
--- a/src/plugins/pronoundb/index.ts
+++ b/src/plugins/pronoundb/index.ts
@@ -36,25 +36,24 @@ export default definePlugin({
authors: [Devs.Tyman, Devs.TheKodeToad, Devs.Ven],
description: "Adds pronouns to user messages using pronoundb",
patches: [
- // Add next to username (compact mode)
{
find: "showCommunicationDisabledStyles",
- replacement: {
- match: /("span",{id:\i,className:\i,children:\i}\))/,
- replace: "$1, $self.CompactPronounsChatComponentWrapper(arguments[0])"
- }
- },
- // Patch the chat timestamp element (normal mode)
- {
- find: "showCommunicationDisabledStyles",
- replacement: {
- match: /(?<=return\s*\(0,\i\.jsxs?\)\(.+!\i&&)(\(0,\i.jsxs?\)\(.+?\{.+?\}\))/,
- replace: "[$1, $self.PronounsChatComponentWrapper(arguments[0])]"
- }
+ replacement: [
+ // Add next to username (compact mode)
+ {
+ match: /("span",{id:\i,className:\i,children:\i}\))/,
+ replace: "$1, $self.CompactPronounsChatComponentWrapper(arguments[0])"
+ },
+ // Patch the chat timestamp element (normal mode)
+ {
+ match: /(?<=return\s*\(0,\i\.jsxs?\)\(.+!\i&&)(\(0,\i.jsxs?\)\(.+?\{.+?\}\))/,
+ replace: "[$1, $self.PronounsChatComponentWrapper(arguments[0])]"
+ }
+ ]
},
// Patch the profile popout username header to use our pronoun hook instead of Discord's pronouns
{
- find: ".userTagNoNickname",
+ find: ".pronouns,children",
replacement: [
{
match: /{user:(\i),[^}]*,pronouns:(\i),[^}]*}=\i;/,
From 99f523b87c04ed422d60ae2862c0962ee24c0386 Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Sun, 14 Apr 2024 02:12:25 +0200
Subject: [PATCH 07/13] fix extractAndLoadChunks for when there are no chunks
to be loaded
---
src/webpack/webpack.ts | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts
index 0790e8bf..10c7d7ee 100644
--- a/src/webpack/webpack.ts
+++ b/src/webpack/webpack.ts
@@ -406,13 +406,15 @@ export function findExportedComponentLazy(...props: stri
});
}
+const DefaultExtractAndLoadChunksRegex = /(?:Promise\.all\((\[\i\.\i\(".+?"\).+?\])\)|Promise\.resolve\(\)).then\(\i\.bind\(\i,"(.+?)"\)\)/;
+
/**
* Extract and load chunks using their entry point
* @param code An array of all the code the module factory containing the lazy chunk loading must include
* @param matcher A RegExp that returns the chunk ids array as the first capture group and the entry point id as the second. Defaults to a matcher that captures the lazy chunk loading found in the module factory
* @returns A promise that resolves when the chunks were loaded
*/
-export async function extractAndLoadChunks(code: string[], matcher: RegExp = /Promise\.all\((\[\i\.\i\(".+?"\).+?\])\).then\(\i\.bind\(\i,"(.+?)"\)\)/) {
+export async function extractAndLoadChunks(code: string[], matcher: RegExp = DefaultExtractAndLoadChunksRegex) {
const module = findModuleFactory(...code);
if (!module) {
const err = new Error("extractAndLoadChunks: Couldn't find module factory");
@@ -434,7 +436,7 @@ export async function extractAndLoadChunks(code: string[], matcher: RegExp = /Pr
}
const [, rawChunkIds, entryPointId] = match;
- if (!rawChunkIds || Number.isNaN(entryPointId)) {
+ if (Number.isNaN(entryPointId)) {
const err = new Error("extractAndLoadChunks: Matcher didn't return a capturing group with the chunk ids array, or the entry point id returned as the second group wasn't a number");
logger.warn(err, "Code:", code, "Matcher:", matcher);
@@ -445,9 +447,11 @@ export async function extractAndLoadChunks(code: string[], matcher: RegExp = /Pr
return;
}
- const chunkIds = Array.from(rawChunkIds.matchAll(/\("(.+?)"\)/g)).map((m: any) => m[1]);
+ if (rawChunkIds) {
+ const chunkIds = Array.from(rawChunkIds.matchAll(/\("(.+?)"\)/g)).map((m: any) => m[1]);
+ await Promise.all(chunkIds.map(id => wreq.e(id)));
+ }
- await Promise.all(chunkIds.map(id => wreq.e(id)));
wreq(entryPointId);
}
@@ -459,7 +463,7 @@ export async function extractAndLoadChunks(code: string[], matcher: RegExp = /Pr
* @param matcher A RegExp that returns the chunk ids array as the first capture group and the entry point id as the second. Defaults to a matcher that captures the lazy chunk loading found in the module factory
* @returns A function that returns a promise that resolves when the chunks were loaded, on first call
*/
-export function extractAndLoadChunksLazy(code: string[], matcher: RegExp = /Promise\.all\((\[\i\.\i\(".+?"\).+?\])\).then\(\i\.bind\(\i,"(.+?)"\)\)/) {
+export function extractAndLoadChunksLazy(code: string[], matcher = DefaultExtractAndLoadChunksRegex) {
if (IS_DEV) lazyWebpackSearchHistory.push(["extractAndLoadChunks", [code, matcher]]);
return () => extractAndLoadChunks(code, matcher);
From 0f5a75aa4bc27af20b47ba3139d3f33f85901bde Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Sun, 14 Apr 2024 02:39:04 +0200
Subject: [PATCH 08/13] bump to v1.7.6
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 0f79d21a..75ef41e5 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
- "version": "1.7.5",
+ "version": "1.7.6",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {
From 52f8a85ab9fbc7f802318147c7618391ff8b0e13 Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Sun, 14 Apr 2024 14:25:05 +0200
Subject: [PATCH 09/13] fix(FavoriteEmojiFirst): don't lower suggestion count
on hover
---
src/plugins/favEmojiFirst/index.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/favEmojiFirst/index.ts b/src/plugins/favEmojiFirst/index.ts
index f34b1388..afc72a1d 100644
--- a/src/plugins/favEmojiFirst/index.ts
+++ b/src/plugins/favEmojiFirst/index.ts
@@ -83,6 +83,6 @@ export default definePlugin({
if (!aIsFavorite && bIsFavorite) return 1;
return 0;
- }).slice(0, query.results.emojis.sliceTo ?? 10);
+ }).slice(0, query.results.emojis.sliceTo ?? Infinity);
}
});
From 356a2c290dfcd9a9d757a3d59989ee28ae8b1b49 Mon Sep 17 00:00:00 2001
From: AutumnVN
Date: Wed, 17 Apr 2024 03:10:15 +0700
Subject: [PATCH 10/13] fix: RoleColorEverywhere, PictureInPicture, NoMosaic
(#2356)
---
src/plugins/noMosaic/index.ts | 69 ++---------------------
src/plugins/noMosaic/styles.css | 8 ---
src/plugins/pictureInPicture/index.tsx | 6 +-
src/plugins/roleColorEverywhere/index.tsx | 2 +-
4 files changed, 10 insertions(+), 75 deletions(-)
delete mode 100644 src/plugins/noMosaic/styles.css
diff --git a/src/plugins/noMosaic/index.ts b/src/plugins/noMosaic/index.ts
index 802f65e5..4715bde5 100644
--- a/src/plugins/noMosaic/index.ts
+++ b/src/plugins/noMosaic/index.ts
@@ -5,15 +5,9 @@
*/
import { definePluginSettings } from "@api/Settings";
-import { disableStyle, enableStyle } from "@api/Styles";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
-import style from "./styles.css?managed";
-
-const MAX_WIDTH = 550;
-const MAX_HEIGHT = 350;
-
const settings = definePluginSettings({
inlineVideo: {
description: "Play videos without carousel modal",
@@ -33,15 +27,11 @@ export default definePlugin({
patches: [
{
- find: ".oneByTwoLayoutThreeGrid",
- replacement: [{
- match: /mediaLayoutType:\i\.\i\.MOSAIC/,
- replace: "mediaLayoutType:'RESPONSIVE'",
- },
- {
- match: /null!==\(\i=\i\.get\(\i\)\)&&void 0!==\i\?\i:"INVALID"/,
- replace: '"INVALID"',
- }]
+ find: "isGroupableMedia:function()",
+ replacement: {
+ match: /=>"IMAGE"===\i\|\|"VIDEO"===\i;/,
+ replace: "=>false;"
+ }
},
{
find: "renderAttachments(",
@@ -51,52 +41,5 @@ export default definePlugin({
replace: "$&$1.content_type?.startsWith('image/')&&"
}
},
- {
- find: "Messages.REMOVE_ATTACHMENT_TOOLTIP_TEXT",
- replacement: [{
- match: /\i===\i\.\i\.MOSAIC/,
- replace: "true"
- },
- {
- match: /\i!==\i\.\i\.MOSAIC/,
- replace: "false"
- }]
- },
- {
- find: ".messageAttachment,",
- replacement: {
- match: /\{width:\i,height:\i\}=(\i).*?(?=className:\i\(\)\(\i\.messageAttachment,)/,
- replace: "$&style:$self.style($1),"
- }
- }
- ],
-
- style({ width, height }) {
- if (!width || !height) return {};
-
- if (width > MAX_WIDTH || height > MAX_HEIGHT) {
- if (width / height > MAX_WIDTH / MAX_HEIGHT) {
- height = Math.ceil(MAX_WIDTH / (width / height));
- width = MAX_WIDTH;
- } else {
- width = Math.ceil(MAX_HEIGHT * (width / height));
- height = MAX_HEIGHT;
- }
- }
-
- return {
- maxWidth: width,
- width: "100%",
- aspectRatio: `${width} / ${height}`
- };
-
- },
-
- start() {
- enableStyle(style);
- },
-
- stop() {
- disableStyle(style);
- }
+ ]
});
diff --git a/src/plugins/noMosaic/styles.css b/src/plugins/noMosaic/styles.css
deleted file mode 100644
index 3a8a8e46..00000000
--- a/src/plugins/noMosaic/styles.css
+++ /dev/null
@@ -1,8 +0,0 @@
-[class^="nonMediaAttachmentsContainer_"] [class*="messageAttachment_"] {
- position: relative;
-}
-
-[class^="nonMediaAttachmentsContainer_"],
-[class^="nonMediaAttachmentItem_"]:has([class^="messageAttachment_"][style^="max-width"]) {
- width: 100%;
-}
diff --git a/src/plugins/pictureInPicture/index.tsx b/src/plugins/pictureInPicture/index.tsx
index ca766aff..0a22f06d 100644
--- a/src/plugins/pictureInPicture/index.tsx
+++ b/src/plugins/pictureInPicture/index.tsx
@@ -10,7 +10,7 @@ import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
-import { React, Tooltip } from "@webpack/common";
+import { Tooltip } from "@webpack/common";
const settings = definePluginSettings({
loop: {
@@ -28,9 +28,9 @@ export default definePlugin({
settings,
patches: [
{
- find: ".nonMediaAttachment]",
+ find: ".nonMediaMosaicItem]",
replacement: {
- match: /\.nonMediaAttachment\]:!(\i).{0,10}children:\[(\S)/,
+ match: /\.nonMediaMosaicItem\]:!(\i).{0,10}children:\[(\S)/,
replace: "$&,$1&&$2&&$self.renderPiPButton(),"
},
},
diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx
index b421eb7f..6d53906f 100644
--- a/src/plugins/roleColorEverywhere/index.tsx
+++ b/src/plugins/roleColorEverywhere/index.tsx
@@ -94,7 +94,7 @@ export default definePlugin({
find: "renderPrioritySpeaker",
replacement: [
{
- match: /renderName\(\).{0,100}speaking:.{50,100}jsx.{5,10}{/,
+ match: /renderName\(\).{0,100}speaking:.{50,150}"div",{/,
replace: "$&...$self.getVoiceProps(this.props),"
}
],
From 3a79e41d67fd03946d3234c611b3b63e8c0f86c8 Mon Sep 17 00:00:00 2001
From: Elvyra <88881326+EdVraz@users.noreply.github.com>
Date: Tue, 16 Apr 2024 22:11:25 +0200
Subject: [PATCH 11/13] fix MessageLogger (#2358)
---
src/plugins/messageLogger/index.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx
index 8a1e2391..c8b46439 100644
--- a/src/plugins/messageLogger/index.tsx
+++ b/src/plugins/messageLogger/index.tsx
@@ -337,12 +337,12 @@ export default definePlugin({
{
// Attachment renderer
// Module 96063
- find: ".removeAttachmentHoverButton",
+ find: ".removeMosaicItemHoverButton",
group: true,
replacement: [
{
- match: /(className:\i,attachment:\i),/,
- replace: "$1,attachment: {deleted},"
+ match: /(className:\i,item:\i),/,
+ replace: "$1,item: deleted,"
},
{
match: /\[\i\.obscured\]:.+?,/,
From 23b0841cc759999177f1bef579ebb11a46da3375 Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Wed, 17 Apr 2024 04:44:42 +0200
Subject: [PATCH 12/13] fix ShowConnections
---
src/plugins/customRPC/index.tsx | 3 +--
src/plugins/showConnections/index.tsx | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/plugins/customRPC/index.tsx b/src/plugins/customRPC/index.tsx
index e70f8c90..35fb64d1 100644
--- a/src/plugins/customRPC/index.tsx
+++ b/src/plugins/customRPC/index.tsx
@@ -27,7 +27,6 @@ import { ApplicationAssetUtils, FluxDispatcher, Forms, GuildStore, React, Select
const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile");
const ActivityClassName = findByPropsLazy("activity", "buttonColor");
-const Colors = findByPropsLazy("profileColors");
async function getApplicationAsset(key: string): Promise {
if (/https?:\/\/(cdn|media)\.discordapp\.(com|net)\/attachments\//.test(key)) return "mp:" + key.replace(/https?:\/\/(cdn|media)\.discordapp\.(com|net)\//, "");
@@ -406,7 +405,7 @@ export default definePlugin({
If you want to use image link, download your image and reupload the image to Imgur and get the image link by right-clicking the image and select "Copy image address".
-
+
{activity[0] &&
any = findByCodeLazy(',"--profile-gradient-primary-color"');
+const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy('--profile-gradient-primary-color":');
const enum Spacing {
COMPACT,
From 538b87062a9f45ab88e4acb54e33ef0e48159be8 Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Wed, 17 Apr 2024 04:44:56 +0200
Subject: [PATCH 13/13] bump to v1.7.7
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 75ef41e5..723a40cb 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
- "version": "1.7.6",
+ "version": "1.7.7",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {