mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 21:17:37 +03:00
Change visibility of helper function
This commit is contained in:
parent
490a7fcf52
commit
2372f1d12b
1 changed files with 4 additions and 4 deletions
|
@ -99,7 +99,7 @@ func (app *Router) RX(r chi.Router, pathPrefix string, constructor rest.Reposito
|
||||||
r.Post("/", rest.Post(constructor))
|
r.Post("/", rest.Post(constructor))
|
||||||
}
|
}
|
||||||
r.Route("/{id}", func(r chi.Router) {
|
r.Route("/{id}", func(r chi.Router) {
|
||||||
r.Use(UrlParams)
|
r.Use(urlParams)
|
||||||
r.Get("/", rest.Get(constructor))
|
r.Get("/", rest.Get(constructor))
|
||||||
if persistable {
|
if persistable {
|
||||||
r.Put("/", rest.Put(constructor))
|
r.Put("/", rest.Put(constructor))
|
||||||
|
@ -117,7 +117,7 @@ func (app *Router) addPlaylistTrackRoute(r chi.Router) {
|
||||||
getPlaylist(app.ds)(w, r)
|
getPlaylist(app.ds)(w, r)
|
||||||
})
|
})
|
||||||
r.Route("/{id}", func(r chi.Router) {
|
r.Route("/{id}", func(r chi.Router) {
|
||||||
r.Use(UrlParams)
|
r.Use(urlParams)
|
||||||
r.Put("/", func(w http.ResponseWriter, r *http.Request) {
|
r.Put("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
reorderItem(app.ds)(w, r)
|
reorderItem(app.ds)(w, r)
|
||||||
})
|
})
|
||||||
|
@ -125,14 +125,14 @@ func (app *Router) addPlaylistTrackRoute(r chi.Router) {
|
||||||
deleteFromPlaylist(app.ds)(w, r)
|
deleteFromPlaylist(app.ds)(w, r)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
r.With(UrlParams).Post("/", func(w http.ResponseWriter, r *http.Request) {
|
r.With(urlParams).Post("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
addToPlaylist(app.ds)(w, r)
|
addToPlaylist(app.ds)(w, r)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Middleware to convert Chi URL params (from Context) to query params, as expected by our REST package
|
// Middleware to convert Chi URL params (from Context) to query params, as expected by our REST package
|
||||||
func UrlParams(next http.Handler) http.Handler {
|
func urlParams(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := chi.RouteContext(r.Context())
|
ctx := chi.RouteContext(r.Context())
|
||||||
parts := make([]string, 0)
|
parts := make([]string, 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue