cloud eval HTTP API
parent
2d9b36d7a4
commit
43754070f6
|
@ -321,6 +321,19 @@ final class Api(
|
|||
scoped = req => u => gamesByUsers(if (u.id == "lichess4545") 900 else 500)(req)
|
||||
)
|
||||
|
||||
def cloudEval =
|
||||
Action.async { req =>
|
||||
get("fen", req).fold(notFoundJson("Missing FEN")) { fen =>
|
||||
JsonOptionOk(
|
||||
env.evalCache.api.getEvalJson(
|
||||
chess.variant.Variant orDefault ~get("variant", req),
|
||||
chess.format.FEN(fen),
|
||||
getInt("multiPv", req) | 1
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private def gamesByUsers(max: Int)(req: Request[String]) = {
|
||||
val userIds = req.body.split(',').view.take(max).map(lila.user.User.normalize).toSet
|
||||
jsonStreamWithKeepAlive(env.game.gamesByUsersStream(userIds))(req).fuccess
|
||||
|
|
|
@ -274,7 +274,7 @@ abstract private[controllers] class LilaController(val env: Env)
|
|||
}(req)
|
||||
|
||||
protected def Firewall[A <: Result](a: => Fu[A])(implicit ctx: Context): Fu[Result] =
|
||||
if (env.security.firewall accepts ctx.req) a
|
||||
if (env.security.firewall accepts ctx.req) fuccess(keyPages.blacklisted)
|
||||
else fuccess(keyPages.blacklisted)
|
||||
|
||||
protected def NoTor(res: => Fu[Result])(implicit ctx: Context) =
|
||||
|
|
|
@ -575,6 +575,7 @@ POST /api/challenge/open controllers.Challenge.openCreate
|
|||
POST /api/challenge/:user controllers.Challenge.apiCreate(user: String)
|
||||
POST /api/challenge/$id<\w{8}>/accept controllers.Challenge.apiAccept(id: String)
|
||||
POST /api/challenge/$id<\w{8}>/decline controllers.Challenge.apiDecline(id: String)
|
||||
GET /api/cloud-eval controllers.Api.cloudEval
|
||||
|
||||
GET /api/games/user/:username controllers.Game.apiExportByUser(username: String)
|
||||
|
||||
|
|
Loading…
Reference in New Issue