New log endpoint

This commit is contained in:
daru
2022-05-14 14:10:04 +02:00
parent 50e0defc28
commit f0555e8d6a
2 changed files with 13 additions and 1 deletions

12
ober.go
View File

@@ -20,6 +20,7 @@ func RunWebserv() {
r.GET("/api/anime/{id}", Headers(AnimeGet))
r.GET("/api/animesearch", Headers(AnimeSearchGet))
r.GET("/api/appointment", Headers(AppointmentGet))
r.GET("/api/log", Headers(LogGet))
r.GET("/api/user/{user?}", Headers(UserGet))
r.GET("/api/watch/{user?}", Headers(WatchGet))
r.GET("/api/watchext/{user?}", Headers(WatchExtendedGet))
@@ -140,6 +141,17 @@ func AppointmentGet(ctx *fasthttp.RequestCtx) {
ctx.SetStatusCode(fasthttp.StatusNotImplemented)
}
func LogGet(ctx *fasthttp.RequestCtx) {
_, err := ctx.WriteString(logOut.String())
if err != nil {
addErrorToCtx(ctx, err)
ctx.SetStatusCode(fasthttp.StatusInternalServerError)
return
}
ctx.SetContentType("text/plain; charset=utf-8")
ctx.SetStatusCode(fasthttp.StatusOK)
}
func UserGet(ctx *fasthttp.RequestCtx) {
usrVal := ctx.UserValue("user")
users := make([]User, 0)