add Navidrome/Jellyfin image cache invalidation

This commit is contained in:
Kendall Garner 2025-09-24 08:05:22 -07:00
parent eea36f720a
commit 2feef206fb
No known key found for this signature in database
GPG key ID: 9355F387FE765C94
3 changed files with 13 additions and 2 deletions

View file

@ -30,6 +30,7 @@ const getCoverArtUrl = (args: {
coverArtId: string;
credential: string | undefined;
size: number;
updated: string;
}) => {
const size = args.size ? args.size : 250;
@ -43,7 +44,10 @@ const getCoverArtUrl = (args: {
`&${args.credential}` +
'&v=1.13.0' +
'&c=Feishin' +
`&size=${size}`
`&size=${size}` +
// A dummy variable to invalidate the cached image if the item is updated
// This is adapted from how Navidrome web does it
`&_=${args.updated}`
);
};
@ -140,6 +144,7 @@ const normalizeSong = (
coverArtId: id,
credential: server?.credential,
size: imageSize || 100,
updated: item.updatedAt,
});
const imagePlaceholderUrl = null;
@ -216,6 +221,7 @@ const normalizeAlbum = (
coverArtId: item.coverArtId || item.id,
credential: server?.credential,
size: imageSize || 300,
updated: item.updatedAt,
});
const imagePlaceholderUrl = null;
@ -282,6 +288,7 @@ const normalizeAlbumArtist = (
coverArtId: `ar-${item.id}`,
credential: server?.credential,
size: 300,
updated: item.updatedAt || '',
});
}
@ -344,6 +351,7 @@ const normalizePlaylist = (
coverArtId: item.id,
credential: server?.credential,
size: imageSize || 300,
updated: item.updatedAt,
});
const imagePlaceholderUrl = null;