From e8fd3dc3efa587a1f71b86255753a502e9a24c99 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 17 Dec 2025 22:31:13 +0100 Subject: [PATCH 1/4] Fix MemberCount --- src/plugins/memberCount/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/memberCount/index.tsx b/src/plugins/memberCount/index.tsx index e2d78e2b0..e5dac9d02 100644 --- a/src/plugins/memberCount/index.tsx +++ b/src/plugins/memberCount/index.tsx @@ -72,7 +72,7 @@ export default definePlugin({ replacement: [ { match: /(?<=var\{className:(\i),.+?children):\[(\i\.useMemo[^}]+"aria-multiselectable")/, - replace: ":[$1?.startsWith('members')?$self.render():null,$2", + replace: ":[$1?.includes('members')?$self.render():null,$2", }, ], predicate: () => settings.store.memberList From 16f343be52bf85dd765d1064ac5ad3b40a0694d7 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 17 Dec 2025 22:56:07 +0100 Subject: [PATCH 2/4] FixImageQuality: fix videos & don't animate gifs if app unfocused --- src/plugins/fixImagesQuality/index.tsx | 40 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/plugins/fixImagesQuality/index.tsx b/src/plugins/fixImagesQuality/index.tsx index 4c3e6eeb3..fc9859d9b 100644 --- a/src/plugins/fixImagesQuality/index.tsx +++ b/src/plugins/fixImagesQuality/index.tsx @@ -7,6 +7,7 @@ import { definePluginSettings } from "@api/Settings"; import { Card } from "@components/Card"; import { Flex } from "@components/Flex"; +import { Margins } from "@components/margins"; import { Paragraph } from "@components/Paragraph"; import { Devs } from "@utils/constants"; import { Logger } from "@utils/Logger"; @@ -15,7 +16,7 @@ import definePlugin, { OptionType } from "@utils/types"; const settings = definePluginSettings({ originalImagesInChat: { type: OptionType.BOOLEAN, - description: "Also load the original image in Chat", + description: "Also load the original image in Chat. WARNING: Read the caveats above", default: false, } }); @@ -31,7 +32,7 @@ export default definePlugin({ find: ".handleImageLoad)", replacement: { match: /getSrc\(\i\)\{/, - replace: "$&var _vcSrc=$self.getSrc(this.props);if(_vcSrc)return _vcSrc;" + replace: "$&var _vcSrc=$self.getSrc(this.props,arguments[1]);if(_vcSrc)return _vcSrc;" } } ], @@ -47,36 +48,49 @@ export default definePlugin({
  • — In the image modal, the original image will be loaded.
  • + You can also enable original image in chat, but beware of the following caveats: - You can also enable original image in chat, but this may cause performance issues! +
      +
    • — Animated images (GIF, WebP, etc.) in chat will always animate, regardless of if the App is focused.
    • +
    • — May cause lag.
    • +
    ); }, - getSrc(props: { src: string; mediaLayoutType: string; width: number; height: number; }) { - if (!props) return; + getSrc(props: { src: string; mediaLayoutType: string; width: number; height: number; contentType: string; }, freeze?: boolean) { + if (!props?.src) return; try { - if (!settings.store.originalImagesInChat && props.mediaLayoutType === "MOSAIC") { + const { contentType, height, mediaLayoutType, src, width } = props; + if (!contentType?.startsWith("image/") || src.startsWith("data:")) return; + + console.log({ src, freeze }); + const url = new URL(src); + url.searchParams.set("animated", String(!freeze)); + + if (!settings.store.originalImagesInChat && mediaLayoutType === "MOSAIC") { // make sure the image is not too large - const pixels = props.width * props.height; + const pixels = width * height; const limit = 2000 * 1200; - if (pixels <= limit) return props.src; + if (pixels <= limit) + return url.toString(); const scale = Math.sqrt(pixels / limit); - const url = new URL(props.src); - url.searchParams.set("width", Math.round(props.width / scale).toString()); - url.searchParams.set("height", Math.round(props.height / scale).toString()); + + url.searchParams.set("width", Math.round(width / scale).toString()); + url.searchParams.set("height", Math.round(height / scale).toString()); return url.toString(); } - return props.src?.replace("https://media.discordapp.net/attachments/", "https://cdn.discordapp.com/attachments/"); + url.hostname = "cdn.discordapp.com"; + return url.toString(); } catch (e) { new Logger("FixImagesQuality").error("Failed to make image src", e); - return props.src; + return; } } }); From 74f106c9fc17012ae1fde303f58581383a6e62bc Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 17 Dec 2025 22:56:59 +0100 Subject: [PATCH 3/4] ImageZoom: load attachments from cdn instead of media proxy --- src/plugins/imageZoom/components/Magnifier.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/imageZoom/components/Magnifier.tsx b/src/plugins/imageZoom/components/Magnifier.tsx index dbe196072..7ca83a6d3 100644 --- a/src/plugins/imageZoom/components/Magnifier.tsx +++ b/src/plugins/imageZoom/components/Magnifier.tsx @@ -162,6 +162,9 @@ export const Magnifier = ErrorBoundary.wrap(({ instance, size: i const imageSrc = useMemo(() => { try { const imageUrl = new URL(instance.props.src); + if (imageUrl.pathname.startsWith("/attachments/")) + imageUrl.hostname = "cdn.discordapp.com"; + imageUrl.searchParams.set("animated", "true"); return imageUrl.toString(); } catch { From 5f5e7c34f82eaf12403cc3675bdc152700a5faa8 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 17 Dec 2025 22:57:53 +0100 Subject: [PATCH 4/4] remove stray console.log --- src/plugins/fixImagesQuality/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/fixImagesQuality/index.tsx b/src/plugins/fixImagesQuality/index.tsx index fc9859d9b..29aaabad4 100644 --- a/src/plugins/fixImagesQuality/index.tsx +++ b/src/plugins/fixImagesQuality/index.tsx @@ -67,7 +67,6 @@ export default definePlugin({ const { contentType, height, mediaLayoutType, src, width } = props; if (!contentType?.startsWith("image/") || src.startsWith("data:")) return; - console.log({ src, freeze }); const url = new URL(src); url.searchParams.set("animated", String(!freeze));