54 lines
888 B
Go
54 lines
888 B
Go
package sati
|
|
|
|
type AnyTask interface {
|
|
serialize() task
|
|
Result() any
|
|
}
|
|
|
|
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,
|
|
}
|
|
}
|
|
|
|
func (t *TurnstileTask) Result() any {
|
|
return &TurnstileResult{}
|
|
}
|
|
|
|
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,
|
|
}
|
|
}
|
|
|
|
func (t *ReCaptcha2Task) Result() any {
|
|
return &ReCaptcha2Result{}
|
|
}
|
|
|
|
type ReCaptcha2Result struct {
|
|
Token string `json:"token"`
|
|
}
|