- Add sized, resized WebP cover responses - Request appropriately sized artwork in mobile --------- Co-authored-by: Rem Helper <remhelper@abunchofknowitalls.com> Reviewed-on: https://git.abunchofknowitalls.com/joshuafhiggins/otunes/pulls/16
18 lines
624 B
TypeScript
18 lines
624 B
TypeScript
export type CoverImageSize = 64 | 128 | 192 | 256 | 384 | 512 | 768 | 1024
|
|
|
|
function withCoverImageSize(uri: string, size?: CoverImageSize) {
|
|
return size ? `${uri}?size=${size}` : uri
|
|
}
|
|
|
|
export function artistCoverUrl(artistId: string, size?: CoverImageSize) {
|
|
return withCoverImageSize(`/api/artist/${artistId}/cover`, size)
|
|
}
|
|
|
|
export function albumCoverUrl(albumId: string, size?: CoverImageSize) {
|
|
return withCoverImageSize(`/api/album/${albumId}/cover`, size)
|
|
}
|
|
|
|
export function playlistCoverUrl(playlistId: string, size?: CoverImageSize) {
|
|
return withCoverImageSize(`/api/playlist/${playlistId}/cover`, size)
|
|
}
|