add blog index to admin dashboard
This commit is contained in:
parent
ee8bf6543e
commit
65366032fd
10 changed files with 603 additions and 91 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"arimelody-web/admin/account"
|
||||
"arimelody-web/admin/auth"
|
||||
"arimelody-web/admin/blog"
|
||||
"arimelody-web/admin/core"
|
||||
"arimelody-web/admin/logs"
|
||||
"arimelody-web/admin/music"
|
||||
|
|
@ -24,8 +25,10 @@ func Handler(app *model.AppState) http.Handler {
|
|||
mux.Handle("/totp", auth.LoginTOTPHandler(app))
|
||||
mux.Handle("/logout", core.RequireAccount(auth.LogoutHandler(app)))
|
||||
|
||||
mux.Handle("/music/", core.RequireAccount(http.StripPrefix("/music", music.Handler(app))))
|
||||
mux.Handle("/logs", core.RequireAccount(logs.Handler(app)))
|
||||
mux.Handle("/music/", core.RequireAccount(http.StripPrefix("/music", music.Handler(app))))
|
||||
mux.Handle("/blogs/", core.RequireAccount(http.StripPrefix("/blogs", blog.Handler(app))))
|
||||
|
||||
mux.Handle("/account/", core.RequireAccount(http.StripPrefix("/account", account.Handler(app))))
|
||||
|
||||
mux.Handle("/static/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -42,13 +45,13 @@ func Handler(app *model.AppState) http.Handler {
|
|||
view.ServeFiles("./admin/static"))).ServeHTTP(w, r)
|
||||
}))
|
||||
|
||||
mux.Handle("/", core.RequireAccount(AdminIndexHandler(app)))
|
||||
mux.Handle("/", core.RequireAccount(adminIndexHandler(app)))
|
||||
|
||||
// response wrapper to make sure a session cookie exists
|
||||
return core.EnforceSession(app, mux)
|
||||
}
|
||||
|
||||
func AdminIndexHandler(app *model.AppState) http.Handler {
|
||||
func adminIndexHandler(app *model.AppState) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
http.NotFound(w, r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue