diff --git a/client/captcha_v2.go b/client/captcha_v2.go index 50ca5c9..1a3b925 100644 --- a/client/captcha_v2.go +++ b/client/captcha_v2.go @@ -180,8 +180,8 @@ func (s *captchaV2Session) solveOnce(captchaErr *VkCaptchaError) (string, error) log.Printf("v2 captcha pow solved") base := captchaV2BaseValues(captchaErr.SessionToken) - if _, err := s.captchaRequest("captchaNotRobot.settings", base); err != nil { - return "", fmt.Errorf("captcha settings failed: %w", err) + if _, settingsErr := s.captchaRequest("captchaNotRobot.settings", base); settingsErr != nil { + return "", fmt.Errorf("captcha settings failed: %w", settingsErr) } browserFP, err := captchaV2BrowserFP() @@ -233,7 +233,9 @@ func (s *captchaV2Session) solveOnce(captchaErr *VkCaptchaError) (string, error) showType = stErr.ShowType } - _, _ = s.captchaRequest("captchaNotRobot.endSession", base) + if _, endErr := s.captchaRequest("captchaNotRobot.endSession", base); endErr != nil { + log.Printf("v2 captcha endSession failed: %v", endErr) + } return token, nil } @@ -269,7 +271,10 @@ func (s *captchaV2Session) fetchCaptchaHTML(redirectURI string) (string, error) func (s *captchaV2Session) fetchDebugInfo(scriptURL string) (string, error) { if cached, ok := captchaV2DebugCache.Load(scriptURL); ok { - return cached.(string), nil + if cachedDebugInfo, ok := cached.(string); ok { + return cachedDebugInfo, nil + } + captchaV2DebugCache.Delete(scriptURL) } body, err := s.doRaw(fhttp.MethodGet, scriptURL, nil, map[string]string{ "Accept": "text/javascript,*/*", diff --git a/server/main.go b/server/main.go index 704fa64..432802c 100644 --- a/server/main.go +++ b/server/main.go @@ -284,14 +284,6 @@ type bondFrame struct { data []byte } -func readBondHello(r io.Reader) (bondHello, error) { - var hdr [17]byte - if _, err := io.ReadFull(r, hdr[:]); err != nil { - return bondHello{}, err - } - return parseBondHelloHeader(hdr[:]) -} - func readBondHelloAfterMagic(r io.Reader, magic [4]byte) (bondHello, error) { var hdr [17]byte copy(hdr[0:4], magic[:]) @@ -662,10 +654,6 @@ func (c *bondServerConn) writeToNextLane(typ byte, seq uint64, data []byte, lane } } -func handleBondServerStream(ctx context.Context, stream *smux.Stream, connectAddr string) { - handleBondServerStreamWithHello(ctx, stream, connectAddr, readBondHello) -} - func handleBondServerStreamAfterMagic(ctx context.Context, stream *smux.Stream, connectAddr string, magic [4]byte) { handleBondServerStreamWithHello(ctx, stream, connectAddr, func(r io.Reader) (bondHello, error) { return readBondHelloAfterMagic(r, magic)