diff --git a/captcha.go b/captcha.go index b63e31e..05b5bf5 100644 --- a/captcha.go +++ b/captcha.go @@ -28,7 +28,18 @@ func captchaStart(c *gin.Context) { c.JSON(500, gin.H{"error": err.Error()}) return } - c.JSON(http.StatusNetworkAuthenticationRequired, gin.H{"token": token, "session": session, "status": "captcha"}) + // Get form data (check if download_images is true) + download_images := c.Query("download_images") + var images []string + if download_images == "true" { + // Get Base64 encoded image + images, err = funcaptcha.DownloadChallenge(session.ConciseChallenge.URLs, true) + if err != nil { + c.JSON(500, gin.H{"error": err.Error()}) + return + } + } + c.JSON(http.StatusNetworkAuthenticationRequired, gin.H{"token": token, "session": session, "status": "captcha", "images": images}) } func captchaVerify(c *gin.Context) { diff --git a/go.mod b/go.mod index 3ff0201..49355c2 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/acheong08/OpenAIAuth v0.0.0-20230530050836-f2a06cd52911 github.com/acheong08/endless v0.0.0-20230529075213-74050cf641c8 - github.com/acheong08/funcaptcha v0.2.1-0.20230630144406-9ea6dc9f0cb5 + github.com/acheong08/funcaptcha v0.2.1-0.20230630145745-51cc6ac9a96f github.com/bogdanfinn/fhttp v0.5.23 github.com/bogdanfinn/tls-client v1.4.0 github.com/gin-gonic/gin v1.9.0 diff --git a/go.sum b/go.sum index cf9baa2..23f22dc 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/acheong08/funcaptcha v0.2.1-0.20230630142159-995a408a9719 h1:rO0AtqUa github.com/acheong08/funcaptcha v0.2.1-0.20230630142159-995a408a9719/go.mod h1:VupbjtVAODvgyAB3Zo86fOA53G+UAmaV/Rk9jUCGuTU= github.com/acheong08/funcaptcha v0.2.1-0.20230630144406-9ea6dc9f0cb5 h1:wP+zQ+QVaAuH2uLasVvwzdHG1LCmq67AmOhbO7dzsXA= github.com/acheong08/funcaptcha v0.2.1-0.20230630144406-9ea6dc9f0cb5/go.mod h1:VupbjtVAODvgyAB3Zo86fOA53G+UAmaV/Rk9jUCGuTU= +github.com/acheong08/funcaptcha v0.2.1-0.20230630145745-51cc6ac9a96f h1:uMHN8VOKu/BCGlJCxZX43Ibq+fdfsiRdtD/OFnSiHfI= +github.com/acheong08/funcaptcha v0.2.1-0.20230630145745-51cc6ac9a96f/go.mod h1:VupbjtVAODvgyAB3Zo86fOA53G+UAmaV/Rk9jUCGuTU= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/bogdanfinn/fhttp v0.5.23 h1:4Xb5OjYArB8GpnUw4A4r5jmt8UW0/Cvey3R9nS2dC9U=