mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-15 20:49:53 +01:00
Aufräumen
This commit is contained in:
20
ober.go
20
ober.go
@@ -26,19 +26,13 @@ func RunWebserv() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Start(ctx *fasthttp.RequestCtx) {
|
func Start(ctx *fasthttp.RequestCtx) {
|
||||||
data, err := cache.Get(seasonApiJikan)
|
season, err := GetSeasonCache()
|
||||||
if err != nil {
|
|
||||||
addErrorToCtx(ctx, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var seasonData SeasonJikan
|
|
||||||
err = json.Unmarshal(data, &seasonData)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
addErrorToCtx(ctx, err)
|
addErrorToCtx(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteIndex(ctx, &seasonData)
|
WriteIndex(ctx, season)
|
||||||
|
|
||||||
ctx.SetContentType("text/html; charset=utf-8")
|
ctx.SetContentType("text/html; charset=utf-8")
|
||||||
ctx.SetStatusCode(fasthttp.StatusOK)
|
ctx.SetStatusCode(fasthttp.StatusOK)
|
||||||
@@ -50,12 +44,6 @@ func Season(ctx *fasthttp.RequestCtx) {
|
|||||||
addErrorToCtx(ctx, err)
|
addErrorToCtx(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var seasonData SeasonJikan
|
|
||||||
err = json.Unmarshal(data, &seasonData)
|
|
||||||
if err != nil {
|
|
||||||
addErrorToCtx(ctx, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = ctx.Write(data)
|
_, err = ctx.Write(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -201,7 +189,9 @@ func WatchPost(ctx *fasthttp.RequestCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, anime := range animes {
|
for _, anime := range animes {
|
||||||
// TODO iterate animes
|
// TODO check if anime is in season
|
||||||
|
|
||||||
|
// iterate sent animes
|
||||||
detail, _, err := GetAnimeDetailData(anime.Anime)
|
detail, _, err := GetAnimeDetailData(anime.Anime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.WriteString(err.Error())
|
ctx.WriteString(err.Error())
|
||||||
|
|||||||
Reference in New Issue
Block a user