From dad69e0d0fea7163385e72868ca16670b50659fd Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 30 Apr 2025 03:11:56 +0200 Subject: [PATCH 1/3] Fix Vencord Notifications & ImageZoom causing crashes --- src/plugins/imageZoom/index.tsx | 15 ++++++++++----- src/webpack/common/react.ts | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins/imageZoom/index.tsx b/src/plugins/imageZoom/index.tsx index 25a0ab7d..d7e8d487 100644 --- a/src/plugins/imageZoom/index.tsx +++ b/src/plugins/imageZoom/index.tsx @@ -21,6 +21,7 @@ import { definePluginSettings } from "@api/Settings"; import { makeRange } from "@components/PluginSettings/components"; import { debounce } from "@shared/debounce"; import { Devs } from "@utils/constants"; +import { Logger } from "@utils/Logger"; import definePlugin, { OptionType } from "@utils/types"; import { Menu, ReactDOM } from "@webpack/common"; import { JSX } from "react"; @@ -237,12 +238,16 @@ export default definePlugin({ }, renderMagnifier(instance) { - if (instance.props.id === ELEMENT_ID) { - if (!this.currentMagnifierElement) { - this.currentMagnifierElement = ; - this.root = ReactDOM.createRoot(this.element!); - this.root.render(this.currentMagnifierElement); + try { + if (instance.props.id === ELEMENT_ID) { + if (!this.currentMagnifierElement) { + this.currentMagnifierElement = ; + this.root = ReactDOM.createRoot(this.element!); + this.root.render(this.currentMagnifierElement); + } } + } catch (error) { + new Logger("ImageZoom").error("Failed to render magnifier:", error); } }, diff --git a/src/webpack/common/react.ts b/src/webpack/common/react.ts index 99f3f9dd..aa279d65 100644 --- a/src/webpack/common/react.ts +++ b/src/webpack/common/react.ts @@ -28,7 +28,7 @@ export let useRef: typeof React.useRef; export let useReducer: typeof React.useReducer; export let useCallback: typeof React.useCallback; -export const ReactDOM: typeof import("react-dom") & typeof import("react-dom/client") = findByPropsLazy("createPortal", "render"); +export const ReactDOM: typeof import("react-dom") & typeof import("react-dom/client") = findByPropsLazy("createPortal"); waitFor("useState", m => { React = m; From 9fa91c193d78fa8a0c32131c0ffa8aec70931c5e Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 30 Apr 2025 03:58:46 +0200 Subject: [PATCH 2/3] Fix ServerInfo, ShowMeYourName & WebContextMenus --- src/plugins/serverInfo/GuildInfoModal.tsx | 2 +- src/plugins/serverInfo/styles.css | 1 - src/plugins/showMeYourName/index.tsx | 5 +++-- src/plugins/webContextMenus.web/index.ts | 9 ++++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/serverInfo/GuildInfoModal.tsx b/src/plugins/serverInfo/GuildInfoModal.tsx index 9f2d3008..0f08af59 100644 --- a/src/plugins/serverInfo/GuildInfoModal.tsx +++ b/src/plugins/serverInfo/GuildInfoModal.tsx @@ -16,7 +16,7 @@ import { FluxDispatcher, Forms, GuildChannelStore, GuildMemberStore, GuildStore, import { Guild, User } from "discord-types/general"; const IconClasses = findByPropsLazy("icon", "acronym", "childWrapper"); -const FriendRow = findComponentByCodeLazy(".listName,discriminatorClass"); +const FriendRow = findComponentByCodeLazy("discriminatorClass:", ".isMobileOnline", "getAvatarURL"); const cl = classNameFactory("vc-gp-"); diff --git a/src/plugins/serverInfo/styles.css b/src/plugins/serverInfo/styles.css index 274b7d13..42a7899c 100644 --- a/src/plugins/serverInfo/styles.css +++ b/src/plugins/serverInfo/styles.css @@ -50,7 +50,6 @@ border-bottom: 2px solid transparent; color: var(--interactive-normal); cursor: pointer; - height: 39px; line-height: 14px; } diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx index 1f04f1f3..ac727f69 100644 --- a/src/plugins/showMeYourName/index.tsx +++ b/src/plugins/showMeYourName/index.tsx @@ -48,9 +48,10 @@ export default definePlugin({ authors: [Devs.Rini, Devs.TheKodeToad], patches: [ { - find: '?"@":""', + find: '"BaseUsername"', replacement: { - match: /(?<=onContextMenu:\i,children:)\i\+\i/, + /* TODO: remove \i+\i once change makes it to stable */ + match: /(?<=onContextMenu:\i,children:)(?:\i\+\i|\i)/, replace: "$self.renderUsername(arguments[0])" } }, diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts index a0f84dd6..45e6fa00 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -120,6 +120,13 @@ export default definePlugin({ ] }, + { + find: "Copy image not supported", + replacement: { + match: /(?<=(?:canSaveImage|canCopyImage)\(\i?\)\{.{0,50})!\i\.isPlatformEmbedded/g, + replace: "false" + } + }, // Add back Copy & Save Image { find: 'id:"copy-image"', @@ -130,7 +137,7 @@ export default definePlugin({ replace: "false" }, { - match: /return\s*?\[\i\.\i\.canCopyImage\(\)/, + match: /return\s*?\[.{0,50}?(?=\?.{0,100}?id:"copy-image")/, replace: "return [true" }, { From 096f8483852a0edf1e4e472f250f396237c662b5 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 30 Apr 2025 04:13:31 +0200 Subject: [PATCH 3/3] MutualGroupDMs: fix weird spacing --- src/plugins/mutualGroupDMs/style.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/mutualGroupDMs/style.css b/src/plugins/mutualGroupDMs/style.css index 14ea83c9..3d06568f 100644 --- a/src/plugins/mutualGroupDMs/style.css +++ b/src/plugins/mutualGroupDMs/style.css @@ -1,4 +1,3 @@ .vc-mutual-gdms-tab-bar { gap: 0; - justify-content: space-between; }