From 8ad33db6c28a579ac66f4676f6896c34466c168f Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Thu, 10 Apr 2025 10:44:04 -0400 Subject: [PATCH 1/4] fix plugins using the image modal (#3368) --- src/plugins/_api/dynamicImageModalApi.ts | 7 ------- src/plugins/imageZoom/index.tsx | 8 -------- src/utils/discord.css | 23 ----------------------- src/utils/discord.tsx | 5 ----- src/utils/modal.tsx | 12 +++--------- 5 files changed, 3 insertions(+), 52 deletions(-) delete mode 100644 src/utils/discord.css diff --git a/src/plugins/_api/dynamicImageModalApi.ts b/src/plugins/_api/dynamicImageModalApi.ts index 759ef001..d91a5a93 100644 --- a/src/plugins/_api/dynamicImageModalApi.ts +++ b/src/plugins/_api/dynamicImageModalApi.ts @@ -13,13 +13,6 @@ export default definePlugin({ authors: [Devs.sadan, Devs.Nuckyz], description: "Allows you to omit either width or height when opening an image modal", patches: [ - { - find: ".contain,SCALE_DOWN:", - replacement: { - match: /(?<="IMAGE"===\i\?)\i(?=\?)/, - replace: "true" - } - }, { find: ".dimensionlessImage,", replacement: { diff --git a/src/plugins/imageZoom/index.tsx b/src/plugins/imageZoom/index.tsx index 1a17b616..25a0ab7d 100644 --- a/src/plugins/imageZoom/index.tsx +++ b/src/plugins/imageZoom/index.tsx @@ -162,14 +162,6 @@ export default definePlugin({ managedStyle, patches: [ - { - find: ".contain,SCALE_DOWN:", - replacement: { - match: /imageClassName:/, - replace: `id:"${ELEMENT_ID}",$&` - } - }, - { find: ".dimensionlessImage,", replacement: [ diff --git a/src/utils/discord.css b/src/utils/discord.css deleted file mode 100644 index 746fb564..00000000 --- a/src/utils/discord.css +++ /dev/null @@ -1,23 +0,0 @@ -.vc-position-inherit { - position: inherit; -} - -/** - * copy pasted from discord css. not really webpack-findable since it's the only class in the module -**/ - -.vc-image-modal { - background: transparent !important; - box-shadow: none !important; - display: flex; - justify-content: center; - align-items: center; - border-radius: 0; -} - -@media(width <= 485px) { - .vc-image-modal { - overflow: visible; - overflow: initial; - } -} diff --git a/src/utils/discord.tsx b/src/utils/discord.tsx index ec96d0d4..ba60d98a 100644 --- a/src/utils/discord.tsx +++ b/src/utils/discord.tsx @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -import "./discord.css"; - import { MessageObject } from "@api/MessageEvents"; import { ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, i18n, IconUtils, InviteActions, MessageActions, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common"; import { Channel, Guild, Message, User } from "discord-types/general"; @@ -143,9 +141,6 @@ export function sendMessage( */ export function openImageModal(item: Except, mediaModalProps?: Omit) { return openMediaModal({ - className: "vc-image-modal", - fit: "vc-position-inherit", - shouldAnimateCarousel: true, items: [{ type: "IMAGE", original: item.original ?? item.url, diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx index d06e5803..eebdb95e 100644 --- a/src/utils/modal.tsx +++ b/src/utils/modal.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { filters, findModuleId, mapMangledModuleLazy, proxyLazyWebpack, wreq } from "@webpack"; +import { filters, findByCodeLazy, mapMangledModuleLazy } from "@webpack"; import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react"; import { LazyComponent } from "./react"; @@ -138,16 +138,10 @@ export type MediaModalProps = { fit?: string; shouldRedactExplicitContent?: boolean; shouldHideMediaOptions?: boolean; - shouldAnimateCarousel?: boolean; }; -export const openMediaModal: (props: MediaModalProps) => void = proxyLazyWebpack(() => { - const mediaModalKeyModuleId = findModuleId('"Zoomed Media Modal"'); - if (mediaModalKeyModuleId == null) return; - - const openMediaModalModule = wreq(findModuleId(mediaModalKeyModuleId, "modalKey:") as any); - return Object.values(openMediaModalModule).find(v => String(v).includes("modalKey:")); -}); +// modal key: "Media Viewer Modal" +export const openMediaModal: (props: MediaModalProps) => void = findByCodeLazy("hasMediaOptions", "shouldHideMediaOptions"); interface ModalAPI { /** From 3dd58c255120661cc79214544fb3e5f108e8e7b8 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Thu, 10 Apr 2025 10:45:22 -0400 Subject: [PATCH 2/4] fix RoleColorEverywhere (#3370) --- src/plugins/roleColorEverywhere/index.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index ffa2b5a2..b81a0cce 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -84,13 +84,7 @@ export default definePlugin({ find: ".USER_MENTION)", replacement: [ { - // FIXME(Bundler spread transform related): Remove old compatiblity once enough time has passed, if they don't revert - match: /onContextMenu:\i,color:\i,\.\.\.\i(?=,children:)(?<=user:(\i),channel:(\i).{0,500}?)/, - replace: "$&,color:$self.getColorInt($1?.id,$2?.id)", - noWarn: true - }, - { - match: /(?<=onContextMenu:\i,color:)\i(?=\},\i\),\{children)(?<=user:(\i),channel:(\i).{0,500}?)/, + match: /(?<=onContextMenu:\i,color:)\i(?=,onClick)(?<=user:(\i),channel:(\i).+?)/, replace: "$self.getColorInt($1?.id,$2?.id)", } ], From 6f23c9e67a4c706435a73339aec3383be9022e76 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 10 Apr 2025 16:56:15 +0200 Subject: [PATCH 3/4] ReadAllNotificationsButton: adjust look for new ui --- src/plugins/readAllNotificationsButton/index.tsx | 1 + src/plugins/readAllNotificationsButton/style.css | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/readAllNotificationsButton/index.tsx b/src/plugins/readAllNotificationsButton/index.tsx index 7a6737a8..419e93af 100644 --- a/src/plugins/readAllNotificationsButton/index.tsx +++ b/src/plugins/readAllNotificationsButton/index.tsx @@ -72,6 +72,7 @@ const ReadAllButton = () => (