mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 17:29:54 +01:00
NextNextSeason
This commit is contained in:
22
ober.go
22
ober.go
@@ -19,6 +19,7 @@ func RunWebserv() {
|
||||
r.GET("/", Headers(Start))
|
||||
r.GET("/api/season", Headers(Season))
|
||||
r.GET("/api/nextseason", Headers(SeasonNext))
|
||||
r.GET("/api/nextnextseason", Headers(SeasonNextNext))
|
||||
r.GET("/api/auth/{user}", Headers(AuthTest))
|
||||
r.GET("/api/anime/{id}", Headers(AnimeGet))
|
||||
r.GET("/api/animesearch", Headers(AnimeSearchGet))
|
||||
@@ -39,7 +40,7 @@ func RunWebserv() {
|
||||
}
|
||||
|
||||
func Start(ctx *fasthttp.RequestCtx) {
|
||||
season, err := GetSeasonCache(seasonApiJikan)
|
||||
season, err := GetSeasonCache(GetCurrentSeasonString())
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
@@ -77,7 +78,7 @@ func AuthTest(ctx *fasthttp.RequestCtx) {
|
||||
}
|
||||
|
||||
func Season(ctx *fasthttp.RequestCtx) {
|
||||
data, err := seasoncache.Get(seasonApiJikan)
|
||||
data, err := seasoncache.Get(GetCurrentSeasonString())
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
@@ -110,6 +111,23 @@ func SeasonNext(ctx *fasthttp.RequestCtx) {
|
||||
ctx.SetStatusCode(fasthttp.StatusOK)
|
||||
}
|
||||
|
||||
func SeasonNextNext(ctx *fasthttp.RequestCtx) {
|
||||
data, err := seasoncache.Get(GetNextNextSeasonString())
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
err = writeResponseBody(ctx, data)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.SetContentType("application/json; charset=utf-8")
|
||||
ctx.SetStatusCode(fasthttp.StatusOK)
|
||||
}
|
||||
|
||||
func AnimeGet(ctx *fasthttp.RequestCtx) {
|
||||
idVal := ctx.UserValue("id")
|
||||
if idVal == nil {
|
||||
|
||||
Reference in New Issue
Block a user