fix: captcha
This commit is contained in:
1 parent
53d7fe8486
commit
d73f42603a
2 files changed
+8
-7
No files matched your search
@@ -40,16 +40,11 @@ func ParseError(errData map[string]any) *Error {
|
|||||||
if sidNum, ok2 := errData["captcha_sid"].(float64); ok2 {
|
if sidNum, ok2 := errData["captcha_sid"].(float64); ok2 {
|
||||||
captchaSid = fmt.Sprintf("%.0f", sidNum)
|
captchaSid = fmt.Sprintf("%.0f", sidNum)
|
||||||
} else {
|
} else {
|
||||||
Log.Warnf("[Captcha] missing captcha_sid in error data")
|
Log.Debugf("[Captcha] captcha_sid not present in error data")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
captchaImg, ok := errData["captcha_img"].(string)
|
captchaImg, _ := errData["captcha_img"].(string)
|
||||||
if !ok {
|
|
||||||
Log.Warnf("[Captcha] missing captcha_img in error data")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
errorMsg, ok := errData["error_msg"].(string)
|
errorMsg, ok := errData["error_msg"].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -169,6 +169,12 @@ func (c *Client) solveCaptcha(
|
|||||||
|
|
||||||
// buildCaptchaRetryData формирует тело POST для следующей попытки captcha.
|
// buildCaptchaRetryData формирует тело POST для следующей попытки captcha.
|
||||||
func buildCaptchaRetryData(link, escapedName, token1 string, captchaErr *captcha.Error, successToken, captchaKey string) string {
|
func buildCaptchaRetryData(link, escapedName, token1 string, captchaErr *captcha.Error, successToken, captchaKey string) string {
|
||||||
|
if captchaErr.CaptchaSid == "" {
|
||||||
|
return fmt.Sprintf(
|
||||||
|
"vk_join_link=https://vk.ru/call/join/%s&name=%s&success_token=%s&access_token=%s",
|
||||||
|
link, escapedName, neturl.QueryEscape(successToken), token1,
|
||||||
|
)
|
||||||
|
}
|
||||||
if captchaKey != "" {
|
if captchaKey != "" {
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"vk_join_link=https://vk.ru/call/join/%s&name=%s&captcha_key=%s&captcha_sid=%s&access_token=%s",
|
"vk_join_link=https://vk.ru/call/join/%s&name=%s&captcha_key=%s&captcha_sid=%s&access_token=%s",
|
||||||
|
|||||||
Reference in new issue
Block a user