From 2af26238b58beafbce0518d3f18fe4285fc0e4d3 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Mon, 25 May 2026 11:14:46 +0200 Subject: [PATCH] no longer read user perfs on /account/info lichobile-only endpoint on the way to removal --- app/controllers/Account.scala | 42 ++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/app/controllers/Account.scala b/app/controllers/Account.scala index 0c296d93bf2..f55046d5433 100644 --- a/app/controllers/Account.scala +++ b/app/controllers/Account.scala @@ -68,26 +68,28 @@ final class Account( } def info = Auth { ctx ?=> me ?=> - negotiateJson: - for - povs <- env.round.proxyRepo.urgentGames(me) - nbChallenges <- env.challenge.api.countInFor.get(me) - playban <- env.playban.api.currentBan(me) - perfs <- ctx.pref.showRatings.optionFu(env.user.perfsRepo.perfsOf(me)) - yield Ok: - env.user.jsonView - .full(me, perfs, withProfile = false) ++ Json - .obj( - "prefs" -> lila.pref.toJson(ctx.pref, lichobileCompat = HTTPRequest.isLichobile(req)), - "nowPlaying" -> JsArray(povs.value.take(50).map(env.api.lobbyApi.nowPlaying)), - "nbChallenges" -> nbChallenges, - "online" -> true - ) - .add("kid" -> ctx.kid) - .add("troll" -> me.marks.troll) - .add("playban" -> playban) - .add("announce" -> env.web.lichobileAnnounceApi.get) - .headerCacheSeconds(15) + if !HTTPRequest.isLichobile(req) + then notFoundJson() + else + negotiateJson: + for + povs <- env.round.proxyRepo.urgentGames(me) + nbChallenges <- env.challenge.api.countInFor.get(me) + playban <- env.playban.api.currentBan(me) + yield Ok: + env.user.jsonView + .full(me, none, withProfile = false) ++ Json + .obj( + "prefs" -> lila.pref.toJson(ctx.pref, lichobileCompat = true), + "nowPlaying" -> JsArray(povs.value.take(50).map(env.api.lobbyApi.nowPlaying)), + "nbChallenges" -> nbChallenges, + "online" -> true + ) + .add("kid" -> ctx.kid) + .add("troll" -> me.marks.troll) + .add("playban" -> playban) + .add("announce" -> env.web.lichobileAnnounceApi.get) + .headerCacheSeconds(15) } def nowPlaying = Auth { _ ?=> _ ?=>