2023-06-28 13:56:39 +03:00
|
|
|
package sati
|
|
|
|
|
|
|
|
type AnyTask interface {
|
|
|
|
serialize() task
|
2023-06-30 21:43:29 +03:00
|
|
|
Result() any
|
2023-06-28 13:56:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type task struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Data any `json:"data"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type TurnstileTask struct {
|
|
|
|
SiteKey string `json:"siteKey"`
|
|
|
|
PageUrl string `json:"pageUrl"`
|
|
|
|
CData *string `json:"cData,omitempty"`
|
|
|
|
Action *string `json:"action,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *TurnstileTask) serialize() task {
|
|
|
|
return task{
|
|
|
|
Type: "Turnstile",
|
|
|
|
Data: t,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-30 21:43:29 +03:00
|
|
|
func (t *TurnstileTask) Result() any {
|
|
|
|
return &TurnstileResult{}
|
|
|
|
}
|
|
|
|
|
2023-06-28 13:56:39 +03:00
|
|
|
type TurnstileResult struct {
|
|
|
|
Token string `json:"token"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ReCaptcha2Task struct {
|
|
|
|
SiteKey string `json:"siteKey"`
|
|
|
|
PageUrl string `json:"pageUrl"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *ReCaptcha2Task) serialize() task {
|
|
|
|
return task{
|
|
|
|
Type: "ReCaptcha2",
|
|
|
|
Data: t,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-30 21:43:29 +03:00
|
|
|
func (t *ReCaptcha2Task) Result() any {
|
|
|
|
return &ReCaptcha2Result{}
|
|
|
|
}
|
|
|
|
|
2023-06-28 13:56:39 +03:00
|
|
|
type ReCaptcha2Result struct {
|
|
|
|
Token string `json:"token"`
|
|
|
|
}
|