feat: add geetest support
All checks were successful
release-tag / release (push) Successful in 2m4s
All checks were successful
release-tag / release (push) Successful in 2m4s
This commit is contained in:
@ -203,6 +203,23 @@ func (a *ruCaptchaApi) endpointIn(params url.Values) ruCaptchaResponse {
|
||||
Data: data,
|
||||
Proxy: extractRuCaptchaProxy(params),
|
||||
})
|
||||
case "geetest":
|
||||
task := &sati.GeeTest3Task{
|
||||
Proxy: extractRuCaptchaProxy(params),
|
||||
SiteKey: params.Get("gt"),
|
||||
PageUrl: params.Get("pageurl"),
|
||||
Challenge: params.Get("challenge"),
|
||||
}
|
||||
if task.SiteKey == "" || task.PageUrl == "" || task.Challenge == "" {
|
||||
return &simpleResponse{0, "ERROR_BAD_PARAMETERS"}
|
||||
}
|
||||
|
||||
if params.Has("api_server") {
|
||||
apiServer := params.Get("api_server")
|
||||
task.ApiServer = &apiServer
|
||||
}
|
||||
|
||||
id = a.ctx.Registry.CreateTask(task)
|
||||
default:
|
||||
return &simpleResponse{0, "ERROR_ZERO_CAPTCHA_FILESIZE"}
|
||||
}
|
||||
@ -228,6 +245,14 @@ func (a *ruCaptchaApi) convertTaskResult(task *Task) string {
|
||||
return result.Token
|
||||
case *sati.FunCaptchaResult:
|
||||
return result.Token
|
||||
case *sati.GeeTest3Result:
|
||||
data, _ := json.Marshal(&struct {
|
||||
Challenge string `json:"geetest_challenge"`
|
||||
Validate string `json:"geetest_validate"`
|
||||
Seccode string `json:"geetest_seccode"`
|
||||
}{result.Challenge, result.Validate, result.Seccode})
|
||||
|
||||
return string(data)
|
||||
}
|
||||
|
||||
a.ctx.Logger.WithFields(logrus.Fields{
|
||||
|
Reference in New Issue
Block a user