Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add captcha-solving callback #57

Merged
merged 8 commits into from
Jul 12, 2021
Merged

Add captcha-solving callback #57

merged 8 commits into from
Jul 12, 2021

Conversation

andig
Copy link
Collaborator

@andig andig commented Jul 11, 2021

Fix #56.

Todos:

  • extract captcha for solving
  • add a solver example to login.go
  • fix go.mod

@andig
Copy link
Collaborator Author

andig commented Jul 11, 2021

Imho the staticcheck is broken as it does not respect the replace directive. Upgrade or get rid of the check?

Should be ready for review.

@andig andig requested review from bogosj and michaelharo July 11, 2021 16:29
@bogosj
Copy link
Owner

bogosj commented Jul 11, 2021

Re: staticcheck - I'd prefer to keep it around and consciously ignore errors we know aren't actually errors.

@andig
Copy link
Collaborator Author

andig commented Jul 12, 2021

Shall we include the captcha solver (legal?) or do something simple like:

tmpFile, err := ioutil.TempFile(os.TempDir(), "captcha-*.svg")
if err != nil {
	return "", fmt.Errorf("cannot create temp file: %w", err)
}

if _, err := io.Copy(tmpFile, svg); err != nil {
	return "", fmt.Errorf("cannot write temp file: %w", err)
}

_ = tmpFile.Close()

if err := open.Run(tmpFile.Name()); err != nil {
	return "", fmt.Errorf("cannot open captcha for display: %w", err)
}

fmt.Println("Captcha is now being opened in default application for svg files.")
fmt.Println()

fmt.Print("Please enter captcha: ")
reader := bufio.NewReader(os.Stdin)
captcha, err := reader.ReadString('\n')

return strings.TrimSpace(captcha), err

@andig
Copy link
Collaborator Author

andig commented Jul 12, 2021

I've changed it anyway to get rid of the forked dependency. IMHO ready to merge. And given #58 should we also do a 1.1.0 release then?

@andig andig merged commit 7276880 into bogosj:main Jul 12, 2021
@andig andig deleted the fix/captcha branch July 12, 2021 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to authenticate using cmd/login
2 participants