Add getShares and createShare Subsonic endpoints

This commit is contained in:
Deluan
2023-01-22 14:38:55 -05:00
parent 94cc2b2ac5
commit d0dceae094
21 changed files with 257 additions and 56 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ import (
"errors"
"net/http"
"net/url"
"path/filepath"
"path"
"strconv"
"github.com/lestrrat-go/jwx/v2/jwt"
@@ -17,12 +17,12 @@ import (
func ImageURL(r *http.Request, artID model.ArtworkID, size int) string {
link := encodeArtworkID(artID)
path := filepath.Join(consts.URLPathPublicImages, link)
uri := path.Join(consts.URLPathPublicImages, link)
params := url.Values{}
if size > 0 {
params.Add("size", strconv.Itoa(size))
}
return server.AbsoluteURL(r, path, params)
return server.AbsoluteURL(r, uri, params)
}
func encodeArtworkID(artID model.ArtworkID) string {
+5
View File
@@ -46,3 +46,8 @@ func (p *Router) routes() http.Handler {
})
return r
}
func ShareURL(r *http.Request, id string) string {
uri := path.Join(consts.URLPathPublic, id)
return server.AbsoluteURL(r, uri, nil)
}