diff --git a/api/AntiGateV2.go b/api/AntiGateV2.go index 88a9813..fcac225 100644 --- a/api/AntiGateV2.go +++ b/api/AntiGateV2.go @@ -5,6 +5,7 @@ import ( "io" "net/http" "reflect" + "strconv" "strings" "git.sati.ac/sati.ac/sati-go" @@ -83,9 +84,23 @@ var ( ) func (a *antigateV2Api) getTaskResult(request struct { - TaskId uint32 `json:"taskId"` + TaskId any `json:"taskId"` }) any { - task := a.ctx.Registry.Get(request.TaskId) + var taskId uint32 + switch id := request.TaskId.(type) { + case float64: + taskId = uint32(id) + case string: + parsed, err := strconv.ParseUint(id, 10, 32) + if err != nil { + return errorBadRequest + } + taskId = uint32(parsed) + default: + return errorBadRequest + } + + task := a.ctx.Registry.Get(taskId) if task == nil { return errorNoSuchCaptchaId }