Skip to content

Commit

Permalink
download images on fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio committed Jul 7, 2023
1 parent 4263227 commit f380b15
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ func captchaStart(c *gin.Context) {
err = session.SubmitAnswer(2)
if err == nil {
c.JSON(200, gin.H{"token": token, "status": "success"})
return
}
log.Println("Retrying...")
}

// Download the images
images, err = funcaptcha.DownloadChallenge(session.ConciseChallenge.URLs, true)
if err != nil {
c.JSON(500, gin.H{"error": "failed to download images"})
}
c.JSON(http.StatusNetworkAuthenticationRequired, gin.H{"token": token, "session": session, "status": "captcha", "images": images})
}
Expand Down

0 comments on commit f380b15

Please sign in to comment.