30 lines
519 B
Go
Raw Normal View History

2017-06-18 15:16:40 +00:00
package admin
import (
2017-06-18 15:44:18 +00:00
"sort"
2017-06-18 15:16:40 +00:00
"github.com/aerogo/aero"
2017-06-18 15:44:18 +00:00
"github.com/animenotifier/arn"
2017-06-18 15:16:40 +00:00
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get admin page.
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
if user == nil || user.Role != "admin" {
return ctx.Redirect("/")
}
2017-06-18 15:44:18 +00:00
types := []string{}
for typeName := range arn.DB.Types() {
types = append(types, typeName)
}
sort.Strings(types)
return ctx.HTML(components.Admin(user, types))
2017-06-18 15:16:40 +00:00
}