/api/account/playing API endpoint
parent
a34a7d6573
commit
999cf6f7d8
|
@ -58,10 +58,7 @@ object Account extends LilaController {
|
|||
def nowPlaying = Auth { implicit ctx => me =>
|
||||
negotiate(
|
||||
html = notFound,
|
||||
api = _ => lila.game.GameRepo.urgentGames(me) map { povs =>
|
||||
val nb = getInt("nb") | 9
|
||||
Ok(Json.obj("nowPlaying" -> JsArray(povs take nb map Env.api.lobbyApi.nowPlaying)))
|
||||
}
|
||||
api = _ => doNowPlaying(me, ctx.req)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -71,6 +68,16 @@ object Account extends LilaController {
|
|||
}
|
||||
}
|
||||
|
||||
def apiNowPlaying = Scoped() { req => me =>
|
||||
doNowPlaying(me, req)
|
||||
}
|
||||
|
||||
private def doNowPlaying(me: lila.user.User, req: RequestHeader) =
|
||||
lila.game.GameRepo.urgentGames(me) map { povs =>
|
||||
val nb = getInt("nb", req) | 9
|
||||
Ok(Json.obj("nowPlaying" -> JsArray(povs take nb map Env.api.lobbyApi.nowPlaying)))
|
||||
}
|
||||
|
||||
def dasher = Auth { implicit ctx => me =>
|
||||
negotiate(
|
||||
html = notFound,
|
||||
|
|
|
@ -503,6 +503,7 @@ GET /api/crosstable/:u1/:u2 controllers.Api.crosstable(u1: String, u2
|
|||
POST /api/stream/games-by-users controllers.Api.gamesByUsersStream
|
||||
GET /api/stream/event controllers.Api.eventStream
|
||||
GET /api/account controllers.Account.apiMe
|
||||
GET /api/account/playing controllers.Account.apiNowPlaying
|
||||
GET /api/account/email controllers.Account.apiEmail
|
||||
GET /api/account/kid controllers.Account.apiKid
|
||||
POST /api/account/kid controllers.Account.apiKidPost
|
||||
|
|
|
@ -54,7 +54,6 @@ final class LobbyApi(
|
|||
"username" -> lila.game.Namer.playerText(pov.opponent, withRating = false)(lightUserApi.sync)
|
||||
).add("rating" -> pov.opponent.rating)
|
||||
.add("ai" -> pov.opponent.aiLevel),
|
||||
"isMyTurn" -> pov.isMyTurn,
|
||||
"secondsLeft" -> pov.remainingSeconds
|
||||
)
|
||||
"isMyTurn" -> pov.isMyTurn
|
||||
).add("secondsLeft" -> pov.remainingSeconds)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue