From 6fc7fc9f97ab108b5e0ae01a3ad7251f98a2c275 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:40:39 -0400 Subject: [PATCH] Fixes --- src/plugins/betterRoleContext/index.tsx | 4 +-- src/plugins/biggerStreamPreview/index.tsx | 4 +-- src/plugins/imageZoom/index.tsx | 6 ++-- src/plugins/serverInfo/GuildInfoModal.tsx | 8 ++--- .../spotifyControls/PlayerComponent.tsx | 4 +-- src/plugins/viewIcons/index.tsx | 7 ++-- src/utils/discord.tsx | 35 +++++++++---------- src/utils/modal.tsx | 30 +++++++++------- 8 files changed, 51 insertions(+), 47 deletions(-) diff --git a/src/plugins/betterRoleContext/index.tsx b/src/plugins/betterRoleContext/index.tsx index bf4cf0f3..f9c06110 100644 --- a/src/plugins/betterRoleContext/index.tsx +++ b/src/plugins/betterRoleContext/index.tsx @@ -8,7 +8,7 @@ import { definePluginSettings } from "@api/Settings"; import { getUserSettingLazy } from "@api/UserSettings"; import { ImageIcon } from "@components/Icons"; import { Devs } from "@utils/constants"; -import { getCurrentGuild, openImageModal } from "@utils/discord"; +import { getCurrentGuild, openMediaModal } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; import { Clipboard, GuildStore, Menu, PermissionStore } from "@webpack/common"; @@ -99,7 +99,7 @@ export default definePlugin({ id="vc-view-role-icon" label="View Role Icon" action={() => { - openImageModal(`${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`); + openMediaModal(`${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`); }} icon={ImageIcon} /> diff --git a/src/plugins/biggerStreamPreview/index.tsx b/src/plugins/biggerStreamPreview/index.tsx index 8cca912b..de0ca55e 100644 --- a/src/plugins/biggerStreamPreview/index.tsx +++ b/src/plugins/biggerStreamPreview/index.tsx @@ -19,7 +19,7 @@ import { NavContextMenuPatchCallback } from "@api/ContextMenu"; import { ScreenshareIcon } from "@components/Icons"; import { Devs } from "@utils/constants"; -import { openImageModal } from "@utils/discord"; +import { openMediaModal } from "@utils/discord"; import definePlugin from "@utils/types"; import { Menu } from "@webpack/common"; import { Channel, User } from "discord-types/general"; @@ -57,7 +57,7 @@ export const handleViewPreview = async ({ guildId, channelId, ownerId }: Applica const previewUrl = await ApplicationStreamPreviewStore.getPreviewURL(guildId, channelId, ownerId); if (!previewUrl) return; - openImageModal(previewUrl); + openMediaModal(previewUrl); }; export const addViewStreamContext: NavContextMenuPatchCallback = (children, { userId }: { userId: string | bigint; }) => { diff --git a/src/plugins/imageZoom/index.tsx b/src/plugins/imageZoom/index.tsx index 59b2667c..273d022e 100644 --- a/src/plugins/imageZoom/index.tsx +++ b/src/plugins/imageZoom/index.tsx @@ -156,14 +156,14 @@ export default definePlugin({ patches: [ { - find: "Messages.OPEN_IN_BROWSER", + find: ".contain,SCALE_DOWN:", replacement: { // there are 2 image thingies. one for carosuel and one for the single image. // so thats why i added global flag. // also idk if this patch is good, should it be more specific? // https://regex101.com/r/xfvNvV/1 - match: /return.{1,200}\.wrapper.{1,200}src:\i,/g, - replace: `$&id: '${ELEMENT_ID}',` + match: /\.slide,\i\),/g, + replace: `$&id:"${ELEMENT_ID}",` } }, diff --git a/src/plugins/serverInfo/GuildInfoModal.tsx b/src/plugins/serverInfo/GuildInfoModal.tsx index fb8df2ce..e2007dfe 100644 --- a/src/plugins/serverInfo/GuildInfoModal.tsx +++ b/src/plugins/serverInfo/GuildInfoModal.tsx @@ -7,7 +7,7 @@ import "./styles.css"; import { classNameFactory } from "@api/Styles"; -import { openImageModal, openUserProfile } from "@utils/discord"; +import { openMediaModal, openUserProfile } from "@utils/discord"; import { classes } from "@utils/misc"; import { ModalRoot, ModalSize, openModal } from "@utils/modal"; import { useAwaiter } from "@utils/react"; @@ -80,7 +80,7 @@ function GuildInfoModal({ guild }: GuildProps) { className={cl("banner")} src={bannerUrl} alt="" - onClick={() => openImageModal(bannerUrl)} + onClick={() => openMediaModal(bannerUrl)} /> )} @@ -89,7 +89,7 @@ function GuildInfoModal({ guild }: GuildProps) { ? openImageModal(iconUrl)} + onClick={() => openMediaModal(iconUrl)} /> :