mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 17:29:54 +01:00
GetAnimeDetail
This commit is contained in:
22
ober.go
22
ober.go
@@ -181,7 +181,7 @@ func Register(ctx *fasthttp.RequestCtx) {
|
||||
|
||||
func WatchPost(ctx *fasthttp.RequestCtx) {
|
||||
auth := ctx.Request.Header.Peek("X-HUSO-AUTH")
|
||||
if ctx.UserValue("user") == nil || auth == nil || string(auth) == "" {
|
||||
if ctx.UserValue("user") == nil || auth == nil || string(auth) == "" || string(ctx.Request.Header.ContentType()) != "application/json" {
|
||||
ctx.SetStatusCode(fasthttp.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@@ -190,6 +190,26 @@ func WatchPost(ctx *fasthttp.RequestCtx) {
|
||||
ctx.SetStatusCode(fasthttp.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
body := ctx.PostBody()
|
||||
var animes []Anime
|
||||
err := json.Unmarshal(body, &animes)
|
||||
if err != nil || len(animes) == 0 {
|
||||
ctx.WriteString(err.Error())
|
||||
ctx.SetStatusCode(fasthttp.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
for _, anime := range animes {
|
||||
// TODO iterate animes
|
||||
detail, _, err := GetAnimeDetailData(anime.Anime)
|
||||
if err != nil {
|
||||
ctx.WriteString(err.Error())
|
||||
ctx.SetStatusCode(fasthttp.StatusNotFound)
|
||||
return
|
||||
}
|
||||
fmt.Printf("%+v\n", detail)
|
||||
}
|
||||
}
|
||||
|
||||
func GheddoAuth(username, auth string) bool {
|
||||
|
||||
Reference in New Issue
Block a user