Merge remote-tracking branch 'ornicar/master' into v2
commit
72d022b1a4
|
@ -291,7 +291,7 @@ object Study extends LilaController {
|
|||
val baseData = Env.round.jsonView.userAnalysisJson(pov, ctx.pref, initialFen, setup.orientation, owner = false, me = ctx.me)
|
||||
val analysis = baseData ++ Json.obj(
|
||||
"treeParts" -> partitionTreeJsonWriter.writes {
|
||||
lila.study.TreeBuilder.makeRoot(chapter.root)
|
||||
lila.study.TreeBuilder.makeRoot(chapter.root, setup.variant)
|
||||
}
|
||||
)
|
||||
val data = lila.study.JsonView.JsData(
|
||||
|
|
|
@ -214,7 +214,7 @@ object Team extends LilaController {
|
|||
|
||||
private def OnePerWeek[A <: Result](me: UserModel)(a: => Fu[A])(implicit ctx: Context): Fu[Result] =
|
||||
api.hasCreatedRecently(me) flatMap { did =>
|
||||
if (did && !Granter(_.SuperAdmin)(me)) Forbidden(views.html.site.message.teamCreateLimit).fuccess
|
||||
if (did && !Granter(_.ManageTeam)(me)) Forbidden(views.html.site.message.teamCreateLimit).fuccess
|
||||
else a
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ object layout {
|
|||
if (ctx.kid) span(st.title := trans.kidMode.txt(), cls := "kiddo")("😊")
|
||||
else ctx.isBot option botImage,
|
||||
"lichess",
|
||||
span(cls := "extension")(if (isProd) ".org" else " dev")
|
||||
span(cls := "extension")(if (isProd) ".org" else ".dev")
|
||||
)
|
||||
),
|
||||
menu map { sideMenu =>
|
||||
|
|
|
@ -75,7 +75,8 @@ private[round] final class Round(
|
|||
case ResignForce(playerId) => handle(playerId) { pov =>
|
||||
(pov.game.resignable && !pov.game.hasAi && pov.game.hasClock) ?? {
|
||||
socketMap.ask[Boolean](pov.gameId)(IsGone(!pov.color, _)) flatMap {
|
||||
case true => finisher.rageQuit(pov.game, Some(pov.color))
|
||||
case true if !pov.game.variant.insufficientWinningMaterial(pov.game.board, pov.color) => finisher.rageQuit(pov.game, Some(pov.color))
|
||||
case true => finisher.rageQuit(pov.game, None)
|
||||
case _ => fuccess(List(Event.Reload))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ final class StudySocket(
|
|||
pos.chapterId.value.some
|
||||
)
|
||||
notifyVersion("addNode", Json.obj(
|
||||
"n" -> TreeBuilder.toBranch(node),
|
||||
"n" -> TreeBuilder.toBranch(node, variant),
|
||||
"p" -> pos,
|
||||
"w" -> who(uid),
|
||||
"d" -> dests.dests,
|
||||
|
|
|
@ -18,10 +18,10 @@ object TreeBuilder {
|
|||
val sit = chess.Game(variant.some, root.fen.value.some).situation
|
||||
sit.playable(false) ?? sit.destinations
|
||||
}
|
||||
makeRoot(root).copy(dests = dests.some)
|
||||
makeRoot(root, variant).copy(dests = dests.some)
|
||||
}
|
||||
|
||||
def toBranch(node: Node): tree.Branch =
|
||||
def toBranch(node: Node, variant: Variant): tree.Branch =
|
||||
tree.Branch(
|
||||
id = node.id,
|
||||
ply = node.ply,
|
||||
|
@ -35,12 +35,12 @@ object TreeBuilder {
|
|||
clock = node.clock,
|
||||
crazyData = node.crazyData,
|
||||
eval = node.score.map(_.eval),
|
||||
children = toBranches(node.children),
|
||||
opening = FullOpeningDB findByFen node.fen.value,
|
||||
children = toBranches(node.children, variant),
|
||||
opening = Variant.openingSensibleVariants(variant) ?? FullOpeningDB.findByFen(node.fen.value),
|
||||
forceVariation = node.forceVariation
|
||||
)
|
||||
|
||||
def makeRoot(root: Node.Root) =
|
||||
def makeRoot(root: Node.Root, variant: Variant) =
|
||||
tree.Root(
|
||||
ply = root.ply,
|
||||
fen = root.fen.value,
|
||||
|
@ -52,10 +52,10 @@ object TreeBuilder {
|
|||
clock = root.clock,
|
||||
crazyData = root.crazyData,
|
||||
eval = root.score.map(_.eval),
|
||||
children = toBranches(root.children),
|
||||
opening = FullOpeningDB findByFen root.fen.value
|
||||
children = toBranches(root.children, variant),
|
||||
opening = Variant.openingSensibleVariants(variant) ?? FullOpeningDB.findByFen(root.fen.value)
|
||||
)
|
||||
|
||||
private def toBranches(children: Node.Children): List[tree.Branch] =
|
||||
children.nodes.map(toBranch)(scala.collection.breakOut)
|
||||
private def toBranches(children: Node.Children, variant: Variant): List[tree.Branch] =
|
||||
children.nodes.map(toBranch(_, variant))(scala.collection.breakOut)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
url("fonts/lichess.svg#lichess") format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
font-display: block;
|
||||
}
|
||||
|
||||
[data-icon]:before {
|
||||
|
|
|
@ -176,7 +176,6 @@ class ThreadedWasmWorker extends AbstractWorker {
|
|||
};
|
||||
});
|
||||
return ThreadedWasmWorker.global.then(global => {
|
||||
console.log(global);
|
||||
this.instance = global.instance;
|
||||
const protocol = new Protocol(this.send.bind(this), this.workerOpts);
|
||||
this.listener = protocol.received.bind(protocol);
|
||||
|
|
Loading…
Reference in New Issue