From c0e3174d0946f24585903690542ece0a5847bbbb Mon Sep 17 00:00:00 2001 From: jeffvli Date: Wed, 19 Jul 2023 23:58:22 -0700 Subject: [PATCH] Fix artist image placeholders for Navidrome --- .../api/navidrome/navidrome-normalize.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/renderer/api/navidrome/navidrome-normalize.ts b/src/renderer/api/navidrome/navidrome-normalize.ts index 50842fa2..3c5ef2e1 100644 --- a/src/renderer/api/navidrome/navidrome-normalize.ts +++ b/src/renderer/api/navidrome/navidrome-normalize.ts @@ -5,6 +5,19 @@ import z from 'zod'; import { ndType } from './navidrome-types'; import { ssType } from '/@/renderer/api/subsonic/subsonic-types'; +const getImageUrl = (args: { url: string | null }) => { + const { url } = args; + if (url === '/app/artist-placeholder.webp') { + return null; + } + + if (url?.match('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9')) { + return null; + } + + return url; +}; + const getCoverArtUrl = (args: { baseUrl: string | undefined; coverArtId: string; @@ -146,8 +159,7 @@ const normalizeAlbumArtist = ( }, server: ServerListItem | null, ): AlbumArtist => { - const imageUrl = - item.largeImageUrl === '/app/artist-placeholder.webp' ? null : item.largeImageUrl; + const imageUrl = getImageUrl({ url: item?.largeImageUrl || null }); return { albumCount: item.albumCount, @@ -166,7 +178,7 @@ const normalizeAlbumArtist = ( similarArtists: item.similarArtists?.map((artist) => ({ id: artist.id, - imageUrl: artist?.artistImageUrl || null, + imageUrl: getImageUrl({ url: artist?.artistImageUrl || null }), name: artist.name, })) || null, songCount: item.songCount,