Make internal method unexported
This commit is contained in:
parent
2814c818bd
commit
9fcd1c9354
1 changed files with 4 additions and 7 deletions
|
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/navidrome/navidrome/utils"
|
"github.com/navidrome/navidrome/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (api *Router) ServeStream(ctx context.Context, w http.ResponseWriter, r *http.Request, stream *core.Stream, id string) {
|
func (api *Router) serveStream(ctx context.Context, w http.ResponseWriter, r *http.Request, stream *core.Stream, id string) {
|
||||||
if stream.Seekable() {
|
if stream.Seekable() {
|
||||||
http.ServeContent(w, r, stream.Name(), stream.ModTime(), stream)
|
http.ServeContent(w, r, stream.Name(), stream.ModTime(), stream)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -73,7 +73,7 @@ func (api *Router) Stream(w http.ResponseWriter, r *http.Request) (*responses.Su
|
||||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
w.Header().Set("X-Content-Duration", strconv.FormatFloat(float64(stream.Duration()), 'G', -1, 32))
|
w.Header().Set("X-Content-Duration", strconv.FormatFloat(float64(stream.Duration()), 'G', -1, 32))
|
||||||
|
|
||||||
api.ServeStream(ctx, w, r, stream, id)
|
api.serveStream(ctx, w, r, stream, id)
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ func (api *Router) Download(w http.ResponseWriter, r *http.Request) (*responses.
|
||||||
disposition := fmt.Sprintf("attachment; filename=\"%s\"", stream.Name())
|
disposition := fmt.Sprintf("attachment; filename=\"%s\"", stream.Name())
|
||||||
w.Header().Set("Content-Disposition", disposition)
|
w.Header().Set("Content-Disposition", disposition)
|
||||||
|
|
||||||
api.ServeStream(ctx, w, r, stream, id)
|
api.serveStream(ctx, w, r, stream, id)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
case *model.Album:
|
case *model.Album:
|
||||||
setHeaders(v.Name)
|
setHeaders(v.Name)
|
||||||
|
|
@ -150,8 +150,5 @@ func (api *Router) Download(w http.ResponseWriter, r *http.Request) (*responses.
|
||||||
err = model.ErrNotFound
|
err = model.ErrNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
return nil, err
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue