From 3b53ad0c919b0b95e415640ddb83a4657aaedb0a Mon Sep 17 00:00:00 2001 From: Mufaro <81554673+mufaroxyz@users.noreply.github.com> Date: Sat, 3 May 2025 03:46:34 +0200 Subject: [PATCH 1/3] Experiments: Support new experiment link embeds & fix toolbar patch (#3372) --- src/plugins/betterFolders/index.tsx | 1 - src/plugins/experiments/index.tsx | 28 +++++++++++++------ .../imageZoom/components/Magnifier.tsx | 14 ++++++++-- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index b5049883..fc5b4436 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -64,7 +64,6 @@ function filterTreeWithTargetNode(children: any, predicate: (node: any) => boole return filterTreeWithTargetNode(children.props?.children, predicate); } - let childIsTargetChild = false; for (let i = 0; i < children.length; i++) { const shouldKeep = filterTreeWithTargetNode(children[i], predicate); diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index 82e20f73..49ae1ab7 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -31,6 +31,10 @@ import hideBugReport from "./hideBugReport.css?managed"; const KbdStyles = findByPropsLazy("key", "combo"); const BugReporterExperiment = findLazy(m => m?.definition?.id === "2024-09_bug_reporter"); +const isMacOS = navigator.platform.includes("Mac"); +const modKey = isMacOS ? "cmd" : "ctrl"; +const altKey = isMacOS ? "opt" : "alt"; + const settings = definePluginSettings({ toolbarDevMenu: { type: OptionType.BOOLEAN, @@ -48,7 +52,7 @@ export default definePlugin({ Devs.Ven, Devs.Nickyux, Devs.BanTheNons, - Devs.Nuckyz + Devs.Nuckyz, ], settings, @@ -75,9 +79,9 @@ export default definePlugin({ replace: "$&$self.WarningCard()," } }, - // change top right chat toolbar button from the help one to the dev one + // Change top right chat toolbar button from the help one to the dev one { - find: "toolbar:function", + find: ".CONTEXTLESS,isActivityPanelMode:", replacement: { match: /hasBugReporterAccess:(\i)/, replace: "_hasBugReporterAccess:$1=true" @@ -85,7 +89,7 @@ export default definePlugin({ predicate: () => settings.store.toolbarDevMenu }, - // makes the Favourites Server experiment allow favouriting DMs and threads + // Make the Favourites Server experiment allow favouriting DMs and threads { find: "useCanFavoriteChannel", replacement: { @@ -93,23 +97,29 @@ export default definePlugin({ replace: "false", } }, - // enable option to always record clips even if you are not streaming + // Enable option to always record clips even if you are not streaming { find: "isDecoupledGameClippingEnabled(){", replacement: { match: /\i\.isStaff\(\)/, replace: "true" } - } + }, + + // Enable experiment embed on sent experiment links + { + find: "dev://experiment/", + replacement: { + match: /\i\.isStaff\(\)/, + replace: "true" + } + }, ], start: () => !BugReporterExperiment.getCurrentConfig().hasBugReporterAccess && enableStyle(hideBugReport), stop: () => disableStyle(hideBugReport), settingsAboutComponent: () => { - const isMacOS = navigator.platform.includes("Mac"); - const modKey = isMacOS ? "cmd" : "ctrl"; - const altKey = isMacOS ? "opt" : "alt"; return ( More Information diff --git a/src/plugins/imageZoom/components/Magnifier.tsx b/src/plugins/imageZoom/components/Magnifier.tsx index 2acd0259..d68f916e 100644 --- a/src/plugins/imageZoom/components/Magnifier.tsx +++ b/src/plugins/imageZoom/components/Magnifier.tsx @@ -18,7 +18,7 @@ import { classNameFactory } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; -import { FluxDispatcher, useLayoutEffect, useRef, useState } from "@webpack/common"; +import { FluxDispatcher, useLayoutEffect, useMemo, useRef, useState } from "@webpack/common"; import { ELEMENT_ID } from "../constants"; import { settings } from "../index"; @@ -160,6 +160,16 @@ export const Magnifier = ErrorBoundary.wrap(({ instance, size: i } }); + const imageSrc = useMemo(() => { + try { + const imageUrl = new URL(instance.props.src); + imageUrl.searchParams.set("animated", "true"); + return imageUrl.toString(); + } catch { + return instance.props.src; + } + }, [instance.props.src]); + if (!ready) return null; const box = element.current?.getBoundingClientRect(); @@ -203,7 +213,7 @@ export const Magnifier = ErrorBoundary.wrap(({ instance, size: i }} width={`${box.width * zoom.current}px`} height={`${box.height * zoom.current}px`} - src={instance.props.src + "?animated=true"} + src={imageSrc} alt="" /> )} From 8aa92873b9a401cfa83c47ae7e367330e9d623b2 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 2 May 2025 22:52:20 -0300 Subject: [PATCH 2/3] Fix MutualGroupDMs duplicate find --- src/plugins/mutualGroupDMs/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/mutualGroupDMs/index.tsx b/src/plugins/mutualGroupDMs/index.tsx index f06cac0c..858a366c 100644 --- a/src/plugins/mutualGroupDMs/index.tsx +++ b/src/plugins/mutualGroupDMs/index.tsx @@ -88,7 +88,7 @@ export default definePlugin({ patches: [ { - find: ".MUTUAL_FRIENDS?(", + find: ".BOT_DATA_ACCESS?(", replacement: [ { match: /\i\.useEffect.{0,100}(\i)\[0\]\.section/, From 34269e2339ecae74625432062052ef27b6fbc3f2 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 2 May 2025 22:54:37 -0300 Subject: [PATCH 3/3] Bump to 1.12.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c75345d7..60fa7703 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.11.9", + "version": "1.12.0", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": {