aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/user/[user]/badges/+page.svelte18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index 24a3de8f..f40837ed 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -283,8 +283,22 @@
}, {});
};
- const thumbnail = (url: string | undefined) =>
- url && url.includes('catbox.moe') ? url.replace('catbox.moe/', 'catbox.moe/thumbs/t_') : url;
+ const thumbnail = (url: string | undefined) => {
+ if (url && url.includes('catbox.moe') && !url.includes('gif'))
+ return url.replace('catbox.moe/', 'catbox.moe/thumbs/t_');
+
+ if (url && url.includes('discordapp')) {
+ const match = url.match(/attachments\/(\d+)\/(\d+)\/(.+)/);
+
+ if (match) {
+ const [_, server, id, file] = match;
+
+ return `https://media.discordapp.net/attachments/${server}/${id}/${file}?width=144&height=200`;
+ }
+ }
+
+ return url;
+ };
</script>
<HeadTitle route={`${data.username}'s Badge Wall`} path={`/user/${data.username}`} />