2016-12-06 03:36:31 +00:00
|
|
|
package users
|
|
|
|
|
|
|
|
import (
|
2017-06-10 00:19:31 +00:00
|
|
|
"net/http"
|
|
|
|
|
2016-12-06 03:36:31 +00:00
|
|
|
"github.com/aerogo/aero"
|
2017-06-10 00:19:31 +00:00
|
|
|
"github.com/animenotifier/arn"
|
2016-12-06 03:36:31 +00:00
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
)
|
|
|
|
|
2017-07-19 11:08:12 +00:00
|
|
|
// Active ...
|
|
|
|
func Active(ctx *aero.Context) string {
|
|
|
|
users, err := arn.GetListOfUsersCached("active users")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx.HTML(components.Users(users))
|
|
|
|
}
|
|
|
|
|
|
|
|
// Osu ...
|
|
|
|
func Osu(ctx *aero.Context) string {
|
|
|
|
users, err := arn.GetListOfUsersCached("active osu users")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
|
|
|
|
}
|
|
|
|
|
2017-10-07 08:52:59 +00:00
|
|
|
if len(users) > 50 {
|
|
|
|
users = users[:50]
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx.HTML(components.OsuRankingList(users))
|
2017-07-19 11:08:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Staff ...
|
|
|
|
func Staff(ctx *aero.Context) string {
|
|
|
|
users, err := arn.GetListOfUsersCached("active staff users")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx.HTML(components.Users(users))
|
|
|
|
}
|
|
|
|
|
|
|
|
// AnimeWatching ...
|
|
|
|
func AnimeWatching(ctx *aero.Context) string {
|
|
|
|
users, err := arn.GetListOfUsersCached("active anime watching users")
|
2017-06-10 00:19:31 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx.HTML(components.Users(users))
|
2016-12-06 03:36:31 +00:00
|
|
|
}
|