mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-03-31 17:23:39 -04:00
Pick a random captcha provider instead of params
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
parent
d3d5296ccd
commit
98c304ccd4
@ -30,11 +30,16 @@ class BackgroundTask(throttle: Int, timeLimit: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def getRandomParam(): Parameters = {
|
private def getRandomParam(): Parameters = {
|
||||||
val level = Config.allowedLevels.toList(Config.getNextRandomInt(Config.allowedLevels.size))
|
val captcha = pickRandom(Config.captchaConfig)
|
||||||
val media = Config.allowedMedia.toList(Config.getNextRandomInt(Config.allowedMedia.size))
|
val level = pickRandom(captcha.allowedLevels)
|
||||||
val inputType = Config.allowedInputType.toList(Config.getNextRandomInt(Config.allowedInputType.size))
|
val media = pickRandom(captcha.allowedMedia)
|
||||||
|
val inputType = pickRandom(captcha.allowedInputType)
|
||||||
|
|
||||||
Parameters(level, media, inputType, Some(Size(0,0)))
|
Parameters(level, media, inputType, Some(Size(0, 0)))
|
||||||
|
}
|
||||||
|
|
||||||
|
private def pickRandom[T](list: List[T]): T = {
|
||||||
|
list(Config.getNextRandomInt(list.size))
|
||||||
}
|
}
|
||||||
|
|
||||||
def beginThread(delay: Int): Unit = {
|
def beginThread(delay: Int): Unit = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user