improve export of a single game
This commit is contained in:
parent
3428119b3c
commit
e89b7f1ef1
|
@ -34,7 +34,7 @@ object Game extends LilaController {
|
||||||
val config = GameApiV2.OneConfig(
|
val config = GameApiV2.OneConfig(
|
||||||
format = if (HTTPRequest acceptsJson ctx.req) GameApiV2.Format.JSON else GameApiV2.Format.PGN,
|
format = if (HTTPRequest acceptsJson ctx.req) GameApiV2.Format.JSON else GameApiV2.Format.PGN,
|
||||||
imported = getBool("imported"),
|
imported = getBool("imported"),
|
||||||
flags = requestPgnFlags(ctx.req)
|
flags = requestPgnFlags(ctx.req, extended = true)
|
||||||
)
|
)
|
||||||
lila.mon.export.pgn.game()
|
lila.mon.export.pgn.game()
|
||||||
Env.api.gameApiV2.exportOne(game, config) flatMap { content =>
|
Env.api.gameApiV2.exportOne(game, config) flatMap { content =>
|
||||||
|
@ -71,7 +71,7 @@ object Game extends LilaController {
|
||||||
perfType = ~get("perfType", req) split "," flatMap { lila.rating.PerfType(_) } toSet,
|
perfType = ~get("perfType", req) split "," flatMap { lila.rating.PerfType(_) } toSet,
|
||||||
color = get("color", req) flatMap chess.Color.apply,
|
color = get("color", req) flatMap chess.Color.apply,
|
||||||
analysed = getBoolOpt("analysed", req),
|
analysed = getBoolOpt("analysed", req),
|
||||||
flags = requestPgnFlags(req),
|
flags = requestPgnFlags(req, extended = false),
|
||||||
perSecond = MaxPerSecond(me match {
|
perSecond = MaxPerSecond(me match {
|
||||||
case Some(m) if m is user.id => 50
|
case Some(m) if m is user.id => 50
|
||||||
case Some(_) if oauth => 20 // bonus for oauth logged in only (not for XSRF)
|
case Some(_) if oauth => 20 // bonus for oauth logged in only (not for XSRF)
|
||||||
|
@ -89,13 +89,13 @@ object Game extends LilaController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def requestPgnFlags(req: RequestHeader) =
|
private def requestPgnFlags(req: RequestHeader, extended: Boolean) =
|
||||||
lila.game.PgnDump.WithFlags(
|
lila.game.PgnDump.WithFlags(
|
||||||
moves = getBoolOpt("moves", req) | true,
|
moves = getBoolOpt("moves", req) | true,
|
||||||
tags = getBoolOpt("tags", req) | true,
|
tags = getBoolOpt("tags", req) | true,
|
||||||
clocks = getBoolOpt("clocks", req) | false,
|
clocks = getBoolOpt("clocks", req) | extended,
|
||||||
evals = getBoolOpt("evals", req) | false,
|
evals = getBoolOpt("evals", req) | extended,
|
||||||
opening = getBoolOpt("opening", req) | false
|
opening = getBoolOpt("opening", req) | extended
|
||||||
)
|
)
|
||||||
|
|
||||||
private def gameContentType(config: GameApiV2.Config) = config.format match {
|
private def gameContentType(config: GameApiV2.Config) = config.format match {
|
||||||
|
|
|
@ -69,10 +69,8 @@ atom = atom.some) {
|
||||||
<div class="pgn_options">
|
<div class="pgn_options">
|
||||||
<strong>PGN</strong>
|
<strong>PGN</strong>
|
||||||
<div>
|
<div>
|
||||||
<a data-icon="x" class="text" rel="nofollow" href="@routes.Game.exportOne(game.id)?evals=1&clocks=1&opening=1">@trans.downloadAnnotated()</a>
|
<a data-icon="x" class="text" rel="nofollow" href="@routes.Game.exportOne(game.id)">@trans.downloadAnnotated()</a>
|
||||||
@if(analysis.isDefined) {
|
<a data-icon="x" class="text" rel="nofollow" href="@routes.Game.exportOne(game.id)?evals=0&clocks=0">@trans.downloadRaw()</a>
|
||||||
<a data-icon="x" class="text" rel="nofollow" href="@routes.Game.exportOne(game.id)">@trans.downloadRaw()</a>
|
|
||||||
}
|
|
||||||
@if(game.isPgnImport) {
|
@if(game.isPgnImport) {
|
||||||
<a data-icon="x" class="text" rel="nofollow" href="@routes.Game.exportOne(game.id)?imported=1">@trans.downloadImported()</a>
|
<a data-icon="x" class="text" rel="nofollow" href="@routes.Game.exportOne(game.id)?imported=1">@trans.downloadImported()</a>
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,18 +52,6 @@ chessground = false) {
|
||||||
<div class="underboard_content">
|
<div class="underboard_content">
|
||||||
<div class="analysis_panels">
|
<div class="analysis_panels">
|
||||||
<div class="panel fen_pgn">
|
<div class="panel fen_pgn">
|
||||||
<p><strong>FEN</strong><input readonly="true" spellcheck="false" class="copyable autoselect fen" /></p>
|
|
||||||
<p><strong>PGN</strong>
|
|
||||||
<a data-icon="x" rel="nofollow" href="@routes.Game.exportOne(game.id)?evals=1&clocks=1&opening=1"> @trans.downloadAnnotated()</a>
|
|
||||||
@if(analysis.isDefined) {
|
|
||||||
/
|
|
||||||
<a data-icon="x" rel="nofollow" href="@routes.Game.exportOne(game.id)"> @trans.downloadRaw()</a>
|
|
||||||
}
|
|
||||||
@if(game.isPgnImport) {
|
|
||||||
/
|
|
||||||
<a data-icon="x" rel="nofollow" href="@routes.Game.exportOne(game.id)?imported=1"> @trans.downloadImported()</a>
|
|
||||||
}
|
|
||||||
</p>
|
|
||||||
<div class="pgn">@pgn</div>
|
<div class="pgn">@pgn</div>
|
||||||
</div>
|
</div>
|
||||||
@cross.map { c =>
|
@cross.map { c =>
|
||||||
|
|
Loading…
Reference in a new issue