Depolarize inverted quantum
parent
391c285020
commit
bff2c7e983
|
@ -32,26 +32,16 @@ object Round extends LilaController with TheftPrevention with RoundEventPerforme
|
||||||
color,
|
color,
|
||||||
getInt("version"),
|
getInt("version"),
|
||||||
get("sri"),
|
get("sri"),
|
||||||
ctx.me).unsafePerformIO
|
ctx).unsafePerformIO
|
||||||
}
|
}
|
||||||
|
|
||||||
def websocketPlayer(fullId: String) = WebSocket.async[JsValue] { req ⇒
|
def websocketPlayer(fullId: String) = WebSocket.async[JsValue] { req ⇒
|
||||||
implicit val ctx = reqToCtx(req)
|
implicit val ctx = reqToCtx(req)
|
||||||
get("sri").fold(
|
socket.joinPlayer(
|
||||||
sri ⇒ socket.joinPlayer(
|
|
||||||
fullId,
|
fullId,
|
||||||
getInt("version"),
|
getInt("version"),
|
||||||
sri,
|
get("sri"),
|
||||||
ctx.me),
|
ctx).unsafePerformIO
|
||||||
putStrLn("Round Websocket: Hijack detected on %s by %s".format(fullId, ctx)) flatMap { _ ⇒
|
|
||||||
socket.joinWatcher(
|
|
||||||
fullId take 8,
|
|
||||||
"white",
|
|
||||||
getInt("version"),
|
|
||||||
"hijacked".some,
|
|
||||||
ctx.me)
|
|
||||||
}
|
|
||||||
).unsafePerformIO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def player(fullId: String) = Open { implicit ctx ⇒
|
def player(fullId: String) = Open { implicit ctx ⇒
|
||||||
|
|
|
@ -57,7 +57,8 @@ final class Hub(
|
||||||
|
|
||||||
case IsGone(_, color) ⇒ sender ! playerIsGone(color)
|
case IsGone(_, color) ⇒ sender ! playerIsGone(color)
|
||||||
|
|
||||||
case Join(uid, user, version, color, owner) ⇒ {
|
case Join(uid, user, version, color, ownerWish) ⇒ {
|
||||||
|
val owner = ownerWish && !ownerExists(color)
|
||||||
val (enumerator, channel) = Concurrent.broadcast[JsValue]
|
val (enumerator, channel) = Concurrent.broadcast[JsValue]
|
||||||
val member = Member(channel, user, color, owner)
|
val member = Member(channel, user, color, owner)
|
||||||
addMember(uid, member)
|
addMember(uid, member)
|
||||||
|
@ -87,6 +88,8 @@ final class Hub(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def ownerExists(color: Color) = ownerOf(color).isDefined
|
||||||
|
|
||||||
def crowdEvent = Event.Crowd(
|
def crowdEvent = Event.Crowd(
|
||||||
white = ownerOf(White).isDefined,
|
white = ownerOf(White).isDefined,
|
||||||
black = ownerOf(Black).isDefined,
|
black = ownerOf(Black).isDefined,
|
||||||
|
|
|
@ -20,6 +20,7 @@ import socket.{ PingVersion, Quit, Resync }
|
||||||
import socket.Util.connectionFail
|
import socket.Util.connectionFail
|
||||||
import security.Flood
|
import security.Flood
|
||||||
import implicits.RichJs._
|
import implicits.RichJs._
|
||||||
|
import http.Context
|
||||||
|
|
||||||
final class Socket(
|
final class Socket(
|
||||||
getWatcherPov: (String, String) ⇒ IO[Option[Pov]],
|
getWatcherPov: (String, String) ⇒ IO[Option[Pov]],
|
||||||
|
@ -111,15 +112,15 @@ final class Socket(
|
||||||
colorName: String,
|
colorName: String,
|
||||||
version: Option[Int],
|
version: Option[Int],
|
||||||
uid: Option[String],
|
uid: Option[String],
|
||||||
user: Option[User]): IO[SocketPromise] =
|
ctx: Context): IO[SocketPromise] =
|
||||||
getWatcherPov(gameId, colorName) map { join(_, false, version, uid, user) }
|
getWatcherPov(gameId, colorName) map { join(_, false, version, uid, ctx) }
|
||||||
|
|
||||||
def joinPlayer(
|
def joinPlayer(
|
||||||
fullId: String,
|
fullId: String,
|
||||||
version: Option[Int],
|
version: Option[Int],
|
||||||
uid: String,
|
uid: Option[String],
|
||||||
user: Option[User]): IO[SocketPromise] =
|
ctx: Context): IO[SocketPromise] =
|
||||||
getPlayerPov(fullId) map { join(_, true, version, uid.some, user) }
|
getPlayerPov(fullId) map { join(_, true, version, uid, ctx) }
|
||||||
|
|
||||||
private def parseMove(event: JsValue) = for {
|
private def parseMove(event: JsValue) = for {
|
||||||
d ← event obj "d"
|
d ← event obj "d"
|
||||||
|
@ -135,25 +136,27 @@ final class Socket(
|
||||||
owner: Boolean,
|
owner: Boolean,
|
||||||
versionOption: Option[Int],
|
versionOption: Option[Int],
|
||||||
uidOption: Option[String],
|
uidOption: Option[String],
|
||||||
user: Option[User]): SocketPromise =
|
ctx: Context): SocketPromise =
|
||||||
((povOption |@| uidOption |@| versionOption) apply {
|
((povOption |@| uidOption |@| versionOption) apply {
|
||||||
(pov: Pov, uid: String, version: Int) ⇒
|
(pov: Pov, uid: String, version: Int) ⇒
|
||||||
(for {
|
(for {
|
||||||
hub ← hubMaster ? GetHub(pov.gameId) mapTo manifest[ActorRef]
|
hub ← hubMaster ? GetHub(pov.gameId) mapTo manifest[ActorRef]
|
||||||
socket ← hub ? Join(
|
socket ← hub ? Join(
|
||||||
uid = uid,
|
uid = uid,
|
||||||
user = user,
|
user = ctx.me,
|
||||||
version = version,
|
version = version,
|
||||||
color = pov.color,
|
color = pov.color,
|
||||||
owner = owner
|
owner = owner
|
||||||
) map {
|
) map {
|
||||||
case Connected(enumerator, member) ⇒ (
|
case Connected(enumerator, member) ⇒ {
|
||||||
Iteratee.foreach[JsValue](
|
if (owner && !member.owner) println("Websocket hijacking detected! " + ctx.toString)
|
||||||
|
(Iteratee.foreach[JsValue](
|
||||||
controller(hub, uid, member, PovRef(pov.gameId, member.color))
|
controller(hub, uid, member, PovRef(pov.gameId, member.color))
|
||||||
) mapDone { _ ⇒
|
) mapDone { _ ⇒
|
||||||
hub ! Quit(uid)
|
hub ! Quit(uid)
|
||||||
},
|
},
|
||||||
enumerator)
|
enumerator)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} yield socket).asPromise: SocketPromise
|
} yield socket).asPromise: SocketPromise
|
||||||
}) | connectionFail
|
}) | connectionFail
|
||||||
|
|
2
todo
2
todo
|
@ -49,5 +49,7 @@ lsof show the open websockets on prod. The recurrent bug could come from the ope
|
||||||
lobby game filters http://en.lichess.org/forum/lichess-feedback/feature-request-game-filter#2
|
lobby game filters http://en.lichess.org/forum/lichess-feedback/feature-request-game-filter#2
|
||||||
not possible to copy the link URL invite when using a iOS device. Can this be easily fixed by adding an automatic "copy" button next to the link?
|
not possible to copy the link URL invite when using a iOS device. Can this be easily fixed by adding an automatic "copy" button next to the link?
|
||||||
search bug http://en.lichess.org/games/search?players.a=&players.b=&players.winner=&eloMin=&eloMax=&hasAi=&aiLevelMin=&aiLevelMax=&variant=&mode=1&opening=&turnsMin=&turnsMax=&durationMin=&durationMax=&status=35&dateMin=&dateMax=&sort.field=tu&sort.order=asc
|
search bug http://en.lichess.org/games/search?players.a=&players.b=&players.winner=&eloMin=&eloMax=&hasAi=&aiLevelMin=&aiLevelMax=&variant=&mode=1&opening=&turnsMin=&turnsMax=&durationMin=&durationMax=&status=35&dateMin=&dateMax=&sort.field=tu&sort.order=asc
|
||||||
|
takeback substract time for person granting
|
||||||
|
computer analysis reproducible failure http://en.lichess.org/analyse/3xr4jf80/black
|
||||||
|
|
||||||
detect added script and push it to server logs
|
detect added script and push it to server logs
|
||||||
|
|
Loading…
Reference in New Issue