From 58beb10b78eaad7450b7556eb929cf31a19c6176 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 2 Dec 2023 16:20:11 -0800
Subject: fix(wrapped): proxy images

---
 src/lib/Tools/Wrapped.svelte | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/lib/Tools/Wrapped.svelte')

diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte
index 999b2df6..7c5f99e6 100644
--- a/src/lib/Tools/Wrapped.svelte
+++ b/src/lib/Tools/Wrapped.svelte
@@ -256,6 +256,8 @@
 
 		return string.slice(0, maxLength - 3) + ' …';
 	};
+
+	const proxy = (url: string) => `/api/proxy?url=${encodeURIComponent(url)}`;
 </script>
 
 <div id="wrapped" style={`width: ${width}px`}>
@@ -272,7 +274,7 @@
 			>
 				<div class="grid-item image-grid avatar-grid category">
 					<a href={`https://anilist.co/user/${currentUserIdentity.name}`} target="_blank">
-						<img src={wrapped.avatar.large} alt="User Avatar" />
+						<img src={proxy(wrapped.avatar.large)} alt="User Avatar" />
 					</a>
 					<div>
 						<div>
@@ -332,7 +334,7 @@
 						{#if animeList !== undefined}
 							<a href={`https://anilist.co/anime/${animeList[0].id}`} target="_blank">
 								<img
-									src={animeList[0].coverImage.extraLarge}
+									src={proxy(animeList[0].coverImage.extraLarge)}
 									alt="Highest Rated Anime Cover"
 									class="cover-image"
 								/>
@@ -363,7 +365,7 @@
 						{#if mangaList !== undefined}
 							<a href={`https://anilist.co/manga/${mangaList[0].id}`} target="_blank">
 								<img
-									src={mangaList[0].coverImage.extraLarge}
+									src={proxy(mangaList[0].coverImage.extraLarge)}
 									alt="Highest Rated Manga Cover"
 									class="cover-image"
 								/>
-- 
cgit v1.2.3

