Pick a random captcha provider instead of params

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
Rahul Rudragoudar 2021-04-21 14:39:20 +05:30
parent d3d5296ccd
commit 98c304ccd4
No known key found for this signature in database
GPG Key ID: 0D2CE231A7287EBC
1 changed files with 9 additions and 4 deletions

View File

@ -30,11 +30,16 @@ class BackgroundTask(throttle: Int, timeLimit: Int) {
}
private def getRandomParam(): Parameters = {
val level = Config.allowedLevels.toList(Config.getNextRandomInt(Config.allowedLevels.size))
val media = Config.allowedMedia.toList(Config.getNextRandomInt(Config.allowedMedia.size))
val inputType = Config.allowedInputType.toList(Config.getNextRandomInt(Config.allowedInputType.size))
val captcha = pickRandom(Config.captchaConfig)
val level = pickRandom(captcha.allowedLevels)
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 = {