fix(AntiGateV2): match task type case-insensitively

master
sati.ac 2023-07-13 23:20:38 +03:00
parent 4d861f037e
commit e47a96a597
1 changed files with 5 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"io" "io"
"net/http" "net/http"
"reflect" "reflect"
"strings"
"git.sati.ac/sati.ac/sati-go" "git.sati.ac/sati.ac/sati-go"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
@ -147,8 +148,8 @@ func (a *antigateV2Api) createTask(request struct {
var id uint32 var id uint32
switch taskType { switch strings.ToLower(taskType) {
case "TurnstileTask", "TurnstileTaskProxyless": case "turnstiletask", "turnstiletaskproxyless":
var task struct { var task struct {
WebsiteURL string `json:"websiteURL"` WebsiteURL string `json:"websiteURL"`
WebsiteKey string `json:"websiteKey"` WebsiteKey string `json:"websiteKey"`
@ -160,7 +161,7 @@ func (a *antigateV2Api) createTask(request struct {
SiteKey: task.WebsiteKey, SiteKey: task.WebsiteKey,
Action: task.Action, Action: task.Action,
}) })
case "RecaptchaV2Task", "RecaptchaV2TaskProxyless": case "recaptchav2task", "recaptchav2taskproxyless":
var task struct { var task struct {
WebsiteURL string `json:"websiteURL"` WebsiteURL string `json:"websiteURL"`
WebsiteKey string `json:"websiteKey"` WebsiteKey string `json:"websiteKey"`
@ -170,7 +171,7 @@ func (a *antigateV2Api) createTask(request struct {
PageUrl: task.WebsiteURL, PageUrl: task.WebsiteURL,
SiteKey: task.WebsiteKey, SiteKey: task.WebsiteKey,
}) })
case "FunCaptchaTask", "FunCaptchaTaskProxyless": case "funcaptchatask", "funcaptchataskproxyless":
var task struct { var task struct {
WebsiteURL string `json:"websiteURL"` WebsiteURL string `json:"websiteURL"`
WebsitePublicKey string `json:"websitePublicKey"` WebsitePublicKey string `json:"websitePublicKey"`