From b00e432c2defd857189196a0e69e7c077976ea14 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sun, 24 Jul 2022 14:13:22 +1000 Subject: [PATCH] Turns out I reverted the code I needed rather than the one that will delete all messages, nice --- api/src/util/handlers/Message.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts index ed17995b..f98bc2a5 100644 --- a/api/src/util/handlers/Message.ts +++ b/api/src/util/handlers/Message.ts @@ -180,8 +180,16 @@ export async function postHandleMessage(message: Message) { } }; + const { endpointPublic, resizeWidthMax, resizeHeightMax } = Config.get().cdn; + const resizeWidth = Math.min(resizeWidthMax ?? 1, width ?? 100); + const resizeHeight = Math.min(resizeHeightMax ?? 1, height ?? 100); if (author_name) embed.author = { name: author_name }; - if (image) embed.thumbnail = { proxy_url: image, url: image, width: width, height: height }; + if (image) embed.thumbnail = { + proxy_url: `${endpointPublic}/external/resize/${encodeURIComponent(image)}?width=${resizeWidth}&height=${resizeHeight}`, + url: image, + width: width, + height: height + }; if (title) embed.title = title; if (url) embed.url = url; if (description) embed.description = description;