From a38ee2835d9377d79665982320add26fe02aa0c5 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 18 Jun 2025 20:25:39 -0400 Subject: [PATCH] refactor: clean up getImageUrl function and improve activity display --- src/front/components/Lanyard/index.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/front/components/Lanyard/index.tsx b/src/front/components/Lanyard/index.tsx index 70781c3..9f2b1bd 100644 --- a/src/front/components/Lanyard/index.tsx +++ b/src/front/components/Lanyard/index.tsx @@ -18,7 +18,8 @@ const activityTypes: Record = { const getImageUrl = (activity: LanyardActivity, size: "large" | "small") => { const width = size === "large" ? 120 : 40; if (!activity.assets || !activity.assets.large_image) { - if (size === "large") return `https://dcdn.dstn.to/app-icons/${activity.application_id}?size=128`; + if (size === "large") + return `https://dcdn.dstn.to/app-icons/${activity.application_id}?size=128`; } if (!activity.assets) return null; @@ -28,7 +29,7 @@ const getImageUrl = (activity: LanyardActivity, size: "large" | "small") => { if (!image) return null; if (image.startsWith("mp:external")) { - return `https://wsrv.nl/?w=${width}&url=https://media.discordapp.net/${image.slice(3)}` + return `https://media.discordapp.net/${image.slice(3)}?size=${width}`; } if (image.startsWith("mp:app-assets")) { @@ -74,7 +75,10 @@ export default () => { {" "}
-
{activityTypes[activity.type]}{!largeImage && ` ${activity.name}`}
+
+ {activityTypes[activity.type]} + {!largeImage && ` ${activity.name}`} +
{largeImage && (