From 17418f82af53362338aebe9602373a3c8fa027f7 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Tue, 3 Dec 2024 10:53:23 +0100 Subject: [PATCH] fix(avatarproxy): add support for Emby avatars (#1128) Refactoring avatarproxy to retrieve avatars from the Jellyfin API instead of the public endpoint broke Emby avatars that doesn't have this API method. fix #1101 --- server/routes/avatarproxy.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/routes/avatarproxy.ts b/server/routes/avatarproxy.ts index 2d72e2f19..5938fa945 100644 --- a/server/routes/avatarproxy.ts +++ b/server/routes/avatarproxy.ts @@ -54,9 +54,15 @@ router.get('/:jellyfinUserId', async (req, res) => { default: 'mm', size: 200, }); - const jellyfinAvatarUrl = `${getHostname()}/UserImage?UserId=${ - req.params.jellyfinUserId - }`; + + const setttings = getSettings(); + const jellyfinAvatarUrl = + setttings.main.mediaServerType === MediaServerType.JELLYFIN + ? `${getHostname()}/UserImage?UserId=${req.params.jellyfinUserId}` + : `${getHostname()}/Users/${ + req.params.jellyfinUserId + }/Images/Primary?quality=90`; + let imageData = await avatarImageCache.getImage( jellyfinAvatarUrl, fallbackUrl