mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-18 21:07:44 +03:00
Invalidate cached images when album changes
This commit is contained in:
parent
0049d8d311
commit
1ec105a245
@ -133,16 +133,8 @@ const AlbumDetails = ({ record }) => {
|
|||||||
return genreDateLine.join(' · ')
|
return genreDateLine.join(' · ')
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageUrl = subsonic.url(
|
const imageUrl = subsonic.getCoverArtUrl(record, 300)
|
||||||
'getCoverArt',
|
const fullImageUrl = subsonic.getCoverArtUrl(record)
|
||||||
record.coverArtId || 'not_found',
|
|
||||||
{ size: 300 }
|
|
||||||
)
|
|
||||||
|
|
||||||
const fullImageUrl = subsonic.url(
|
|
||||||
'getCoverArt',
|
|
||||||
record.coverArtId || 'not_found'
|
|
||||||
)
|
|
||||||
|
|
||||||
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
||||||
const handleCloseLightbox = React.useCallback(
|
const handleCloseLightbox = React.useCallback(
|
||||||
|
@ -98,9 +98,7 @@ const Cover = withContentRect('bounds')(
|
|||||||
return (
|
return (
|
||||||
<div ref={measureRef}>
|
<div ref={measureRef}>
|
||||||
<img
|
<img
|
||||||
src={subsonic.url('getCoverArt', album.coverArtId || 'not_found', {
|
src={subsonic.getCoverArtUrl(album, 300)}
|
||||||
size: 300,
|
|
||||||
})}
|
|
||||||
alt={album.album}
|
alt={album.album}
|
||||||
className={classes.cover}
|
className={classes.cover}
|
||||||
/>
|
/>
|
||||||
|
@ -28,10 +28,12 @@ const mapToAudioLists = (item) => {
|
|||||||
artistId: item.albumArtistId,
|
artistId: item.albumArtistId,
|
||||||
duration: item.duration,
|
duration: item.duration,
|
||||||
musicSrc: subsonic.url('stream', id, { ts: true }),
|
musicSrc: subsonic.url('stream', id, { ts: true }),
|
||||||
cover: subsonic.url(
|
cover: subsonic.getCoverArtUrl(
|
||||||
'getCoverArt',
|
{
|
||||||
config.devFastAccessCoverArt ? item.albumId : id,
|
coverArtId: config.devFastAccessCoverArt ? item.albumId : id,
|
||||||
{ size: 300 }
|
updatedAt: item.updatedAt,
|
||||||
|
},
|
||||||
|
300
|
||||||
),
|
),
|
||||||
scrobbled: false,
|
scrobbled: false,
|
||||||
uuid: uuidv4(),
|
uuid: uuidv4(),
|
||||||
|
@ -32,4 +32,19 @@ const unstar = (id) => fetchUtils.fetchJson(url('unstar', id))
|
|||||||
|
|
||||||
const download = (id) => (window.location.href = url('download', id))
|
const download = (id) => (window.location.href = url('download', id))
|
||||||
|
|
||||||
export default { url, scrobble, download, star, unstar }
|
const getCoverArtUrl = (record, size) => {
|
||||||
|
const options = {
|
||||||
|
...(record.updatedAt && { _: record.updatedAt }),
|
||||||
|
...(size && { size }),
|
||||||
|
}
|
||||||
|
return url('getCoverArt', record.coverArtId || 'not_found', options)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
url,
|
||||||
|
getCoverArtUrl: getCoverArtUrl,
|
||||||
|
scrobble,
|
||||||
|
download,
|
||||||
|
star,
|
||||||
|
unstar,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user