mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-14 07:15:00 -05:00
Removed convertImage method
This commit is contained in:
parent
079fa0cd3d
commit
07a2f38065
@ -43,22 +43,12 @@ class Captcha {
|
|||||||
image
|
image
|
||||||
}
|
}
|
||||||
|
|
||||||
def convertImage(image: Image): ByteArrayInputStream = {
|
|
||||||
val output = new ByteArrayOutputStream()
|
|
||||||
image.output(new File("Captcha.png"))
|
|
||||||
val img = ImageIO.read(new File("Captcha.png"))
|
|
||||||
ImageIO.write(img,"png",output)
|
|
||||||
val byte_array = output.toByteArray()
|
|
||||||
val blob = new ByteArrayInputStream(byte_array)
|
|
||||||
blob
|
|
||||||
}
|
|
||||||
|
|
||||||
def getChallenge(param: Parameters): Id = {
|
def getChallenge(param: Parameters): Id = {
|
||||||
//TODO: eval params to choose a provider
|
//TODO: eval params to choose a provider
|
||||||
val providerMap = "FilterChallenge"
|
val providerMap = "FilterChallenge"
|
||||||
val provider = filters(providerMap)
|
val provider = filters(providerMap)
|
||||||
val (image, secret) = provider.returnChallenge()
|
val (image, secret) = provider.returnChallenge()
|
||||||
val blob = convertImage(image)
|
val blob = new ByteArrayInputStream(image.bytes)
|
||||||
val token = scala.util.Random.nextInt(10000).toString
|
val token = scala.util.Random.nextInt(10000).toString
|
||||||
val id = Id(token)
|
val id = Id(token)
|
||||||
insertPstmt.setString(1, token)
|
insertPstmt.setString(1, token)
|
||||||
@ -75,7 +65,7 @@ class Captcha {
|
|||||||
val provider = filters(providerMap)
|
val provider = filters(providerMap)
|
||||||
def run(): Unit = {
|
def run(): Unit = {
|
||||||
val (image, secret) = provider.returnChallenge()
|
val (image, secret) = provider.returnChallenge()
|
||||||
val blob = convertImage(image)
|
val blob = new ByteArrayInputStream(image.bytes)
|
||||||
val token = scala.util.Random.nextInt(10000).toString
|
val token = scala.util.Random.nextInt(10000).toString
|
||||||
val id = Id(token)
|
val id = Id(token)
|
||||||
insertPstmt.setString(1, token)
|
insertPstmt.setString(1, token)
|
||||||
|
Loading…
Reference in New Issue
Block a user