well i guess i can POST releases now!
Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
parent
10f5f51e76
commit
151b2d8fd9
13 changed files with 417 additions and 203 deletions
11
main.go
11
main.go
|
@ -46,6 +46,11 @@ func createServeMux() *http.ServeMux {
|
|||
|
||||
mux.Handle("/api/v1/admin/", global.HTTPLog(http.StripPrefix("/api/v1/admin", admin.Handler())))
|
||||
|
||||
mux.Handle("/api/v1/music/artist/", global.HTTPLog(http.StripPrefix("/api/v1/music/artist", music.ServeArtist())))
|
||||
mux.Handle("/api/v1/music/", global.HTTPLog(http.StripPrefix("/api/v1/music", music.ServeRelease())))
|
||||
mux.Handle("/api/v1/music", global.HTTPLog(music.PostRelease()))
|
||||
|
||||
mux.Handle("/music-artwork/", global.HTTPLog(http.StripPrefix("/music-artwork", music.ServeArtwork())))
|
||||
mux.Handle("/music/", global.HTTPLog(http.StripPrefix("/music", music.ServeGateway())))
|
||||
mux.Handle("/music", global.HTTPLog(music.ServeCatalog()))
|
||||
|
||||
|
@ -54,15 +59,15 @@ func createServeMux() *http.ServeMux {
|
|||
global.ServeTemplate("index.html", nil).ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
staticHandler().ServeHTTP(w, r)
|
||||
staticHandler("public").ServeHTTP(w, r)
|
||||
})))
|
||||
|
||||
return mux
|
||||
}
|
||||
|
||||
func staticHandler() http.Handler {
|
||||
func staticHandler(directory string) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
info, err := os.Stat(filepath.Join("public", filepath.Clean(r.URL.Path)))
|
||||
info, err := os.Stat(filepath.Join(directory, filepath.Clean(r.URL.Path)))
|
||||
// does the file exist?
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue