fix(share): force share image to be square (to fix aspect ratio) (#4122)
* fix(ui): update artist link rendering and improve button styles Signed-off-by: Deluan <deluan@navidrome.org> * square share player --------- Signed-off-by: Deluan <deluan@navidrome.org> Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -37,8 +37,9 @@ func (pub *Router) handleImages(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
size := p.IntOr("size", 0)
|
size := p.IntOr("size", 0)
|
||||||
|
square := p.BoolOr("square", false)
|
||||||
|
|
||||||
imgReader, lastUpdate, err := pub.artwork.Get(ctx, artId, size, false)
|
imgReader, lastUpdate, err := pub.artwork.Get(ctx, artId, size, square)
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(err, context.Canceled):
|
case errors.Is(err, context.Canceled):
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const SharePlayer = () => {
|
|||||||
return {
|
return {
|
||||||
name: s.title,
|
name: s.title,
|
||||||
musicSrc: shareStreamUrl(s.id),
|
musicSrc: shareStreamUrl(s.id),
|
||||||
cover: shareCoverUrl(s.id),
|
cover: shareCoverUrl(s.id, true),
|
||||||
singer: s.artist,
|
singer: s.artist,
|
||||||
duration: s.duration,
|
duration: s.duration,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,14 @@ export const shareDownloadUrl = (id) => {
|
|||||||
return shareUrl(config.publicBaseUrl + '/d/' + id)
|
return shareUrl(config.publicBaseUrl + '/d/' + id)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const shareCoverUrl = (id) => {
|
export const shareCoverUrl = (id, square) => {
|
||||||
return shareUrl(config.publicBaseUrl + '/img/' + id + '?size=300')
|
return shareUrl(
|
||||||
|
config.publicBaseUrl +
|
||||||
|
'/img/' +
|
||||||
|
id +
|
||||||
|
'?size=300' +
|
||||||
|
(square ? '&square=true' : ''),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const docsUrl = (path) => `https://www.navidrome.org${path}`
|
export const docsUrl = (path) => `https://www.navidrome.org${path}`
|
||||||
|
|||||||
Reference in New Issue
Block a user