migration WIP
parent
2bfabf1deb
commit
f4fbcf19b6
|
@ -43,8 +43,8 @@ final class Env(
|
|||
)
|
||||
|
||||
lila.common.Bus.subscribeFun(
|
||||
'finishGame, 'forumPost, 'finishPuzzle, 'finishPractice, 'team,
|
||||
'startSimul, 'moveEventCorres, 'plan, 'relation, 'startStudy, 'streamStart
|
||||
"finishGame", "forumPost", "finishPuzzle", "finishPractice", "team",
|
||||
'startSimul, "moveEventCorres", "plan", "relation", "startStudy", "streamStart"
|
||||
) {
|
||||
case lila.game.actorApi.FinishGame(game, _, _) if !game.aborted => write game game
|
||||
case lila.forum.actorApi.CreatePost(post, topic) => write.forumPost(post, topic)
|
||||
|
|
|
@ -24,8 +24,8 @@ final class Analyser(
|
|||
GameRepo.setAnalysed(game.id)
|
||||
AnalysisRepo.save(analysis) >>
|
||||
sendAnalysisProgress(analysis, complete = true) >>- {
|
||||
Bus.publish(actorApi.AnalysisReady(game, analysis), 'analysisReady)
|
||||
Bus.publish(InsertGame(game), 'gameSearchInsert)
|
||||
Bus.publish(actorApi.AnalysisReady(game, analysis), "analysisReady")
|
||||
Bus.publish(InsertGame(game), "gameSearchInsert")
|
||||
requesterApi save analysis
|
||||
}
|
||||
}
|
||||
|
@ -49,12 +49,12 @@ final class Analyser(
|
|||
variant = game.variant,
|
||||
initialFen = initialFen | FEN(game.variant.initialFen)
|
||||
)),
|
||||
'roundSocket
|
||||
"roundSocket"
|
||||
)
|
||||
}
|
||||
}
|
||||
case Some(studyId) => fuccess {
|
||||
Bus.publish(actorApi.StudyAnalysisProgress(analysis, complete), 'studyAnalysisProgress)
|
||||
Bus.publish(actorApi.StudyAnalysisProgress(analysis, complete), "studyAnalysisProgress")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,16 +28,16 @@ private[api] final class Cli extends lila.common.Cli {
|
|||
case None => "No such user."
|
||||
case Some(user) if user.enabled => "That user account is not closed. Can't erase."
|
||||
case Some(user) =>
|
||||
Bus.publish(lila.user.User.GDPRErase(user), 'gdprErase)
|
||||
Bus.publish(lila.user.User.GDPRErase(user), "gdprErase")
|
||||
s"Erasing all data about ${user.username} now"
|
||||
}
|
||||
case "announce" :: "cancel" :: Nil =>
|
||||
AnnounceStore set none
|
||||
Bus.publish(AnnounceStore.cancel, 'announce)
|
||||
Bus.publish(AnnounceStore.cancel, "announce")
|
||||
fuccess("Removed announce")
|
||||
case "announce" :: msgWords => AnnounceStore.set(msgWords mkString " ") match {
|
||||
case Some(announce) =>
|
||||
Bus.publish(announce, 'announce)
|
||||
Bus.publish(announce, "announce")
|
||||
fuccess(announce.json.toString)
|
||||
case None =>
|
||||
fuccess("Invalid announce. Format: `announce <length> <unit> <words...>` or just `announce cancel` to cancel it")
|
||||
|
@ -45,7 +45,7 @@ private[api] final class Cli extends lila.common.Cli {
|
|||
}
|
||||
|
||||
private def remindDeploy(event: Deploy): Fu[String] = {
|
||||
Bus.publish(event, 'deploy)
|
||||
Bus.publish(event, "deploy")
|
||||
fuccess("Deploy in progress")
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ final class Env(
|
|||
)), name = "influx-event")
|
||||
|
||||
system.registerOnTermination {
|
||||
lila.common.Bus.publish(lila.hub.actorApi.Shutdown, 'shutdown)
|
||||
lila.common.Bus.publish(lila.hub.actorApi.Shutdown, "shutdown")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ final class EventStream(
|
|||
var stream: Option[ActorRef] = None
|
||||
|
||||
val classifiers = List(
|
||||
Symbol(s"userStartGame:${me.id}"),
|
||||
Symbol(s"rematchFor:${me.id}"),
|
||||
'challenge
|
||||
s"userStartGame:${me.id}",
|
||||
s"rematchFor:${me.id}",
|
||||
"challenge"
|
||||
)
|
||||
|
||||
val enumerator = Concurrent.unicast[Option[JsObject]](
|
||||
|
|
|
@ -12,7 +12,7 @@ private final class InfluxEvent(endpoint: String, env: String) extends Actor {
|
|||
private val seed = ornicar.scalalib.Random.nextString(6)
|
||||
|
||||
override def preStart(): Unit = {
|
||||
Bus.subscribe(self, 'deploy)
|
||||
Bus.subscribe(self, "deploy")
|
||||
event("lila_start", s"Lila starts: $seed".pp)
|
||||
}
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ final class BlogApi(
|
|||
|
||||
private val cache = BuiltInCache(200)
|
||||
private val prismicLogger = (level: Symbol, message: String) => level match {
|
||||
case 'DEBUG => logger debug message
|
||||
case 'ERROR => logger error message
|
||||
case Symbol("DEBUG") => logger debug message
|
||||
case Symbol("ERROR") => logger error message
|
||||
case _ => logger info message
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ final class BotPlayer(
|
|||
else if (!pov.player.isOfferingDraw && (offeringDraw contains true)) offerDraw(pov)
|
||||
Bus.publish(
|
||||
Tell(pov.gameId, BotPlay(pov.playerId, uci, promise.some)),
|
||||
'roundMapTell
|
||||
"roundMapTell"
|
||||
)
|
||||
promise.future
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ final class BotPlayer(
|
|||
fuccess {
|
||||
Bus.publish(
|
||||
Tell(pov.gameId, (if (accept) RematchYes else RematchNo)(pov.playerId)),
|
||||
'roundMapTell
|
||||
"roundMapTell"
|
||||
)
|
||||
}
|
||||
}(system)
|
||||
|
@ -73,7 +73,7 @@ final class BotPlayer(
|
|||
else fuccess {
|
||||
Bus.publish(
|
||||
Tell(pov.gameId, Abort(pov.playerId)),
|
||||
'roundMapTell
|
||||
"roundMapTell"
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ final class BotPlayer(
|
|||
else if (pov.game.resignable) fuccess {
|
||||
Bus.publish(
|
||||
Tell(pov.gameId, Resign(pov.playerId)),
|
||||
'roundMapTell
|
||||
"roundMapTell"
|
||||
)
|
||||
}
|
||||
else fufail("This game cannot be resigned")
|
||||
|
@ -91,13 +91,13 @@ final class BotPlayer(
|
|||
if (pov.game.drawable && pov.opponent.isOfferingDraw)
|
||||
Bus.publish(
|
||||
Tell(pov.gameId, DrawNo(PlayerId(pov.playerId))),
|
||||
'roundMapTell
|
||||
"roundMapTell"
|
||||
)
|
||||
|
||||
def offerDraw(pov: Pov): Unit =
|
||||
if (pov.game.drawable && pov.game.playerCanOfferDraw(pov.color) && pov.isMyTurn)
|
||||
Bus.publish(
|
||||
Tell(pov.gameId, DrawYes(PlayerId(pov.playerId))),
|
||||
'roundMapTell
|
||||
"roundMapTell"
|
||||
)
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ final class GameStateStream(
|
|||
var gameOver = false
|
||||
|
||||
private val classifiers = List(
|
||||
MoveGameEvent makeSymbol id,
|
||||
'finishGame, 'abortGame,
|
||||
MoveGameEvent makeChan id,
|
||||
"finishGame", "abortGame",
|
||||
Chat classify Chat.Id(id),
|
||||
Chat classify Chat.Id(s"$id/w")
|
||||
)
|
||||
|
@ -89,7 +89,7 @@ final class GameStateStream(
|
|||
}
|
||||
def setConnected(v: Boolean) = Bus.publish(
|
||||
Tell(init.game.id, BotConnected(as, v)),
|
||||
'roundSocket
|
||||
"roundSocket"
|
||||
)
|
||||
}))
|
||||
stream = actor.some
|
||||
|
|
|
@ -12,7 +12,7 @@ private final class OnlineBots(
|
|||
|
||||
val cache = new ExpireCallbackMemo(
|
||||
10.seconds,
|
||||
userId => Bus.publish(BotIsOnline(userId, false), 'botIsOnline)
|
||||
userId => Bus.publish(BotIsOnline(userId, false), "botIsOnline")
|
||||
)
|
||||
|
||||
def setOnline(userId: lila.user.User.ID): Unit = {
|
||||
|
@ -20,7 +20,7 @@ private final class OnlineBots(
|
|||
// delays the removal listener, therefore when a bot reconnects,
|
||||
// the offline event is sent after the online event.
|
||||
if (!cache.get(userId)) scheduler.scheduleOnce(1 second) {
|
||||
Bus.publish(BotIsOnline(userId, true), 'botIsOnline)
|
||||
Bus.publish(BotIsOnline(userId, true), "botIsOnline")
|
||||
}
|
||||
cache.put(userId)
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ final class ChallengeApi(
|
|||
repo like c flatMap { _ ?? repo.cancel }
|
||||
} >> (repo insert c) >>- {
|
||||
uncacheAndNotify(c)
|
||||
Bus.publish(Event.Create(c), 'challenge)
|
||||
Bus.publish(Event.Create(c), "challenge")
|
||||
} inject true
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ final class ChallengeApi(
|
|||
case None => fuccess(None)
|
||||
case Some(pov) => (repo accept c) >>- {
|
||||
uncacheAndNotify(c)
|
||||
Bus.publish(Event.Accept(c, user.map(_.id)), 'challenge)
|
||||
Bus.publish(Event.Accept(c, user.map(_.id)), "challenge")
|
||||
} inject pov.some
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ final class ChallengeApi(
|
|||
val challenge = c setDestUser u
|
||||
repo.update(challenge) >>- {
|
||||
uncacheAndNotify(challenge)
|
||||
Bus.publish(Event.Create(challenge), 'challenge)
|
||||
Bus.publish(Event.Create(challenge), "challenge")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ final class ChallengeApi(
|
|||
}
|
||||
} yield Bus.publish(
|
||||
SendTo(userId, lila.socket.Socket.makeMessage("challenges", jsonView(all, lang))),
|
||||
'socketUsers
|
||||
"socketUsers"
|
||||
)
|
||||
|
||||
// work around circular dependency
|
||||
|
|
|
@ -104,7 +104,7 @@ object Chat {
|
|||
def makeUser(id: Chat.Id) = UserChat(id, Nil)
|
||||
def makeMixed(id: Chat.Id) = MixedChat(id, Nil)
|
||||
|
||||
def classify(id: Chat.Id): Symbol = Symbol(s"chat:$id")
|
||||
def chanOf(id: Chat.Id) = s"chat:$id"
|
||||
|
||||
object BSONFields {
|
||||
val id = "_id"
|
||||
|
|
|
@ -32,7 +32,7 @@ final class Env(
|
|||
|
||||
lazy val pager = new CoachPager(coachColl)
|
||||
|
||||
lila.common.Bus.subscribeFun('adjustCheater, 'finishGame, 'shadowban, 'setPermissions) {
|
||||
lila.common.Bus.subscribeFun("adjustCheater", "finishGame", "shadowban", "setPermissions") {
|
||||
case lila.hub.actorApi.mod.Shadowban(userId, true) =>
|
||||
api.toggleApproved(userId, false)
|
||||
api.reviews deleteAllBy userId
|
||||
|
|
|
@ -7,55 +7,55 @@ import akka.actor.{ ActorRef, ActorSystem }
|
|||
|
||||
object Bus {
|
||||
|
||||
case class Event(payload: Any, channel: Symbol)
|
||||
type Classifier = Symbol
|
||||
case class Event(payload: Any, channel: String)
|
||||
type Channel = String
|
||||
type Subscriber = Tellable
|
||||
|
||||
def publish(payload: Any, channel: Classifier): Unit = {
|
||||
def publish(payload: Any, channel: Channel): Unit = {
|
||||
publish(Bus.Event(payload, channel))
|
||||
}
|
||||
|
||||
def subscribe = bus.subscribe _
|
||||
|
||||
def subscribe(ref: ActorRef, to: Classifier) = bus.subscribe(Tellable(ref), to)
|
||||
def subscribe(ref: ActorRef, to: Channel) = bus.subscribe(Tellable(ref), to)
|
||||
|
||||
def subscribe(subscriber: Tellable, to: Classifier*) = to foreach { bus.subscribe(subscriber, _) }
|
||||
def subscribe(ref: ActorRef, to: Classifier*) = to foreach { bus.subscribe(Tellable(ref), _) }
|
||||
def subscribe(ref: ActorRef, to: Iterable[Classifier]) = to foreach { bus.subscribe(Tellable(ref), _) }
|
||||
def subscribe(subscriber: Tellable, to: Channel*) = to foreach { bus.subscribe(subscriber, _) }
|
||||
def subscribe(ref: ActorRef, to: Channel*) = to foreach { bus.subscribe(Tellable(ref), _) }
|
||||
def subscribe(ref: ActorRef, to: Iterable[Channel]) = to foreach { bus.subscribe(Tellable(ref), _) }
|
||||
|
||||
def subscribeFun(to: Classifier*)(f: PartialFunction[Any, Unit]): Tellable = {
|
||||
def subscribeFun(to: Channel*)(f: PartialFunction[Any, Unit]): Tellable = {
|
||||
val t = lila.common.Tellable(f)
|
||||
subscribe(t, to: _*)
|
||||
t
|
||||
}
|
||||
|
||||
def subscribeFuns(subscriptions: (Classifier, PartialFunction[Any, Unit])*): Unit =
|
||||
def subscribeFuns(subscriptions: (Channel, PartialFunction[Any, Unit])*): Unit =
|
||||
subscriptions foreach {
|
||||
case (classifier, subscriber) => subscribeFun(classifier)(subscriber)
|
||||
case (channel, subscriber) => subscribeFun(channel)(subscriber)
|
||||
}
|
||||
|
||||
def unsubscribe = bus.unsubscribe _
|
||||
def unsubscribe(ref: ActorRef, from: Classifier) = bus.unsubscribe(Tellable(ref), from)
|
||||
def unsubscribe(ref: ActorRef, from: Channel) = bus.unsubscribe(Tellable(ref), from)
|
||||
|
||||
def unsubscribe(subscriber: Tellable, from: Iterable[Classifier]) = from foreach { bus.unsubscribe(subscriber, _) }
|
||||
def unsubscribe(ref: ActorRef, from: Iterable[Classifier]) = from foreach { bus.unsubscribe(Tellable(ref), _) }
|
||||
def unsubscribe(subscriber: Tellable, from: Iterable[Channel]) = from foreach { bus.unsubscribe(subscriber, _) }
|
||||
def unsubscribe(ref: ActorRef, from: Iterable[Channel]) = from foreach { bus.unsubscribe(Tellable(ref), _) }
|
||||
|
||||
def publish(event: Event): Unit = bus.publish(event.payload, event.channel)
|
||||
|
||||
def ask[A](classifier: Classifier, timeout: FiniteDuration = 1.second)(makeMsg: Promise[A] => Any)(
|
||||
def ask[A](channel: Channel, timeout: FiniteDuration = 1.second)(makeMsg: Promise[A] => Any)(
|
||||
implicit
|
||||
system: ActorSystem
|
||||
): Fu[A] = {
|
||||
val promise = Promise[A]
|
||||
val msg = makeMsg(promise)
|
||||
publish(msg, classifier)
|
||||
publish(msg, channel)
|
||||
promise.future.withTimeout(
|
||||
timeout,
|
||||
Bus.AskTimeout(s"Bus.ask timeout: $classifier $msg")
|
||||
Bus.AskTimeout(s"Bus.ask timeout: $channel $msg")
|
||||
)
|
||||
}
|
||||
|
||||
private val bus = new EventBus[Any, Classifier, Tellable](
|
||||
private val bus = new EventBus[Any, Channel, Tellable](
|
||||
initialCapacity = 65535,
|
||||
publish = (tellable, event) => tellable ! event
|
||||
)
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package lila
|
||||
|
||||
/**
|
||||
* Tag instances with arbitrary types. The tags are usually empty `trait`s. Tags have no runtime overhead and are only
|
||||
* used at compile-time for additional type safety.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* {{{
|
||||
* class Berry()
|
||||
*
|
||||
* trait Black
|
||||
* trait Blue
|
||||
*
|
||||
* val berry = new Berry()
|
||||
* val blackBerry: Berry @@ Black = berry.taggedWith[Black]
|
||||
* val blueBerry: Berry @@ Blue = berry.taggedWith[Blue]
|
||||
*
|
||||
* // compile error: val anotherBlackBerry: Berry @@ Black = blueBerry
|
||||
* }}}
|
||||
*
|
||||
* Original idea by Miles Sabin, see: https://gist.github.com/milessabin/89c9b47a91017973a35f
|
||||
*/
|
||||
package object tagging {
|
||||
trait Tag[+U] extends Any { type Tag <: U }
|
||||
type @@[+T, +U] = T with Tag[U]
|
||||
type Tagged[+T, +U] = T with Tag[U]
|
||||
implicit class Tagger[T](val t: T) extends AnyVal {
|
||||
def taggedWith[U]: T @@ U = t.asInstanceOf[T @@ U]
|
||||
}
|
||||
implicit class AndTagger[T, U](val t: T @@ U) extends AnyVal {
|
||||
def andTaggedWith[V]: T @@ (U with V) = t.asInstanceOf[T @@ (U with V)]
|
||||
}
|
||||
}
|
|
@ -35,13 +35,13 @@ final class Env(
|
|||
)
|
||||
|
||||
// remote socket support
|
||||
Bus.subscribeFun(Symbol("remoteSocketIn:evalGet")) {
|
||||
Bus.subscribeFun("remoteSocketIn:evalGet") {
|
||||
case TellSriIn(sri, _, msg) => msg obj "d" foreach { d =>
|
||||
// TODO send once, let lila-ws distribute
|
||||
socketHandler.evalGet(Sri(sri), d, res => Bus.publish(TellSriOut(sri, res), 'remoteSocketOut))
|
||||
socketHandler.evalGet(Sri(sri), d, res => Bus.publish(TellSriOut(sri, res), "remoteSocketOut"))
|
||||
}
|
||||
}
|
||||
Bus.subscribeFun(Symbol("remoteSocketIn:evalPut")) {
|
||||
Bus.subscribeFun("remoteSocketIn:evalPut") {
|
||||
case TellSriIn(sri, Some(userId), msg) => msg obj "d" foreach { d =>
|
||||
socketHandler.untrustedEvalPut(Sri(sri), userId, d)
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ final class Env(
|
|||
text = "Explorer: index new games as soon as they complete".some
|
||||
)
|
||||
|
||||
lila.common.Bus.subscribeFun('finishGame) {
|
||||
lila.common.Bus.subscribeFun("finishGame") {
|
||||
case lila.game.actorApi.FinishGame(game, _, _) if !game.aborted && indexFlowSetting.get() => indexer(game)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ final class Env(
|
|||
sequencer = sequencer,
|
||||
monitor = monitor,
|
||||
sink = sink,
|
||||
socketExists = id => Bus.ask[Boolean]('roundSocket)(lila.hub.actorApi.map.Exists(id, _))(system),
|
||||
socketExists = id => Bus.ask[Boolean]("roundSocket")(lila.hub.actorApi.map.Exists(id, _))(system),
|
||||
clientVersion = clientVersion,
|
||||
offlineMode = OfflineMode,
|
||||
analysisNodes = AnalysisNodes
|
||||
|
@ -114,7 +114,7 @@ final class Env(
|
|||
def process = {
|
||||
case "fishnet" :: "client" :: "create" :: userId :: skill :: Nil =>
|
||||
api.createClient(Client.UserId(userId.toLowerCase), skill) map { client =>
|
||||
Bus.publish(lila.hub.actorApi.fishnet.NewKey(userId, client.key.value), 'fishnet)
|
||||
Bus.publish(lila.hub.actorApi.fishnet.NewKey(userId, client.key.value), "fishnet")
|
||||
s"Created key: ${(client.key.value)} for: $userId"
|
||||
}
|
||||
case "fishnet" :: "client" :: "delete" :: key :: Nil =>
|
||||
|
|
|
@ -25,12 +25,12 @@ final class FishnetRedis(
|
|||
connIn.addListener(new RedisPubSubAdapter[String, String] {
|
||||
override def message(chan: String, msg: String): Unit = msg split ' ' match {
|
||||
|
||||
case Array("start") => Bus.publish(FishnetStart, 'roundMapTellAll)
|
||||
case Array("start") => Bus.publish(FishnetStart, "roundMapTellAll")
|
||||
|
||||
case Array(gameId, plyS, uci) => for {
|
||||
move <- Uci(uci)
|
||||
ply <- plyS.toIntOption
|
||||
} Bus.publish(Tell(gameId, FishnetPlay(move, ply)), 'roundMapTell)
|
||||
} Bus.publish(Tell(gameId, FishnetPlay(move, ply)), "roundMapTell")
|
||||
case _ =>
|
||||
}
|
||||
})
|
||||
|
|
|
@ -17,12 +17,12 @@ private final class MainWatcher(
|
|||
|
||||
private def alert(client: Client) = if (!isAlerted(client)) {
|
||||
alerted put client.key.value
|
||||
Bus.publish(Warning(s"Fishnet server ${client.userId} might be down!"), 'slack)
|
||||
Bus.publish(Warning(s"Fishnet server ${client.userId} might be down!"), "slack")
|
||||
}
|
||||
|
||||
private def unalert(client: Client) = if (isAlerted(client)) {
|
||||
alerted remove client.key.value
|
||||
Bus.publish(Victory(s"Fishnet server ${client.userId} is back!"), 'slack)
|
||||
Bus.publish(Victory(s"Fishnet server ${client.userId} is back!"), "slack")
|
||||
}
|
||||
|
||||
private def watch: Funit = repo.lichessClients map { clients =>
|
||||
|
|
|
@ -68,7 +68,7 @@ final class Env(
|
|||
lazy val forms = new DataForm(hub.captcher)
|
||||
lazy val recent = new Recent(postApi, RecentTtl, RecentNb, asyncCache, PublicCategIds)
|
||||
|
||||
lila.common.Bus.subscribeFun('team, 'gdprErase) {
|
||||
lila.common.Bus.subscribeFun("team", "gdprErase") {
|
||||
case CreateTeam(id, name, _) => categApi.makeTeam(id, name)
|
||||
case lila.user.User.GDPRErase(user) => postApi erase user
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ final class PostApi(
|
|||
}
|
||||
lila.mon.forum.post.create()
|
||||
mentionNotifier.notifyMentionedUsers(post, topic)
|
||||
Bus.publish(actorApi.CreatePost(post, topic), 'forumPost)
|
||||
Bus.publish(actorApi.CreatePost(post, topic), "forumPost")
|
||||
} inject post
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ private[forum] final class TopicApi(
|
|||
lila.mon.forum.post.create()
|
||||
} >>- {
|
||||
mentionNotifier.notifyMentionedUsers(post, topic)
|
||||
Bus.publish(actorApi.CreatePost(post, topic), 'forumPost)
|
||||
Bus.publish(actorApi.CreatePost(post, topic), "forumPost")
|
||||
} inject topic
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ private[forum] final class TopicApi(
|
|||
env.categColl.update($id(categ.id), categ withTopic post) >>-
|
||||
(indexer ! InsertPost(post)) >>-
|
||||
env.recent.invalidate >>-
|
||||
Bus.publish(actorApi.CreatePost(post, topic), 'forumPost) void
|
||||
Bus.publish(actorApi.CreatePost(post, topic), "forumPost") void
|
||||
}
|
||||
|
||||
def paginator(categ: Categ, page: Int, troll: Boolean): Fu[Paginator[TopicView]] = {
|
||||
|
|
|
@ -43,7 +43,7 @@ final class GamesByUsersStream {
|
|||
|
||||
private object GamesByUsersStream {
|
||||
|
||||
private val classifiers = List('startGame, 'finishGame)
|
||||
private val classifiers = List("startGame", "finishGame")
|
||||
|
||||
private implicit val fenWriter: Writes[FEN] = Writes[FEN] { f =>
|
||||
JsString(f.value)
|
||||
|
|
|
@ -28,6 +28,6 @@ case class MoveGameEvent(
|
|||
move: String
|
||||
)
|
||||
object MoveGameEvent {
|
||||
def makeSymbol(gameId: Game.ID) = Symbol(s"moveEvent:$gameId")
|
||||
def makeBusEvent(event: MoveGameEvent) = lila.common.Bus.Event(event, makeSymbol(event.game.id))
|
||||
def makeChan(gameId: Game.ID) = s"moveEvent:$gameId"
|
||||
def makeBusEvent(event: MoveGameEvent) = lila.common.Bus.Event(event, makeChan(event.game.id))
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ final class Env(
|
|||
paginator = paginator
|
||||
)
|
||||
|
||||
lila.common.Bus.subscribeFun('finishGame, 'gameSearchInsert) {
|
||||
lila.common.Bus.subscribeFun("finishGame", "gameSearchInsert") {
|
||||
case FinishGame(game, _, _) if !game.aborted => api store game
|
||||
case InsertGame(game) => api store game
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ final class Env(
|
|||
indexer = indexer
|
||||
)
|
||||
|
||||
lila.common.Bus.subscribeFun('analysisReady) {
|
||||
lila.common.Bus.subscribeFun("analysisReady") {
|
||||
case lila.analyse.actorApi.AnalysisReady(game, _) => api updateGame game
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ final class IrwinApi(
|
|||
suspect = suspect,
|
||||
origin = origin(Origin),
|
||||
games = all
|
||||
), 'irwin)
|
||||
), "irwin")
|
||||
|
||||
private[irwin] def fromTournamentLeaders(leaders: Map[Tournament, TournamentTop]): Funit =
|
||||
lila.common.Future.applySequentially(leaders.toList) {
|
||||
|
|
|
@ -15,7 +15,7 @@ final class IrwinStream(system: ActorSystem) {
|
|||
Json.stringify(js) + "\n"
|
||||
}
|
||||
|
||||
private val classifier = 'irwin
|
||||
private val classifier = "irwin"
|
||||
|
||||
def enumerator: Enumerator[String] = {
|
||||
var subscriber: Option[lila.common.Tellable] = None
|
||||
|
|
|
@ -66,7 +66,7 @@ final class Env(
|
|||
|
||||
private val abortListener = new AbortListener(seekApi, lobbyTrouper)
|
||||
|
||||
lila.common.Bus.subscribeFun('abortGame) {
|
||||
lila.common.Bus.subscribeFun("abortGame") {
|
||||
case lila.game.actorApi.AbortedBy(pov) => abortListener(pov)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ final class LobbySocket(
|
|||
hookSubscriberSris += member.sri.value
|
||||
}
|
||||
|
||||
lila.common.Bus.subscribe(this, 'changeFeaturedGame, 'streams, 'poolPairings, 'lobbySocket)
|
||||
lila.common.Bus.subscribe(this, "changeFeaturedGame", "streams", "poolPairings", "lobbySocket")
|
||||
system.scheduler.scheduleOnce(7 seconds)(this ! SendHookRemovals)
|
||||
system.scheduler.schedule(1 minute, 1 minute)(this ! Cleanup)
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ private object LobbyTrouper {
|
|||
resyncIdsPeriod: FiniteDuration
|
||||
)(makeTrouper: () => LobbyTrouper)(implicit system: akka.actor.ActorSystem) = {
|
||||
val trouper = makeTrouper()
|
||||
lila.common.Bus.subscribe(trouper, 'lobbyTrouper)
|
||||
lila.common.Bus.subscribe(trouper, "lobbyTrouper")
|
||||
system.scheduler.schedule(15 seconds, resyncIdsPeriod)(trouper ! actorApi.Resync)
|
||||
lila.common.ResilientScheduler(
|
||||
every = Every(broomPeriod),
|
||||
|
|
|
@ -60,7 +60,8 @@ final class ConfigStore[A](coll: Coll, id: String, logger: lila.log.Logger)(impl
|
|||
|
||||
object ConfigStore {
|
||||
|
||||
final class Builder(coll: Coll) {
|
||||
final class Builder(db: lila.db.Env, config: MemoConfig) {
|
||||
val coll = db(config.configColl)
|
||||
def apply[A: ConfigLoader](id: String, logger: lila.log.Logger) =
|
||||
new ConfigStore[A](coll, id, logger branch "config_store")
|
||||
}
|
||||
|
|
|
@ -3,27 +3,22 @@ package lila.memo
|
|||
import com.softwaremill.macwire._
|
||||
import io.methvin.play.autoconfig._
|
||||
import play.api.Configuration
|
||||
import lila.db.dsl.Coll
|
||||
|
||||
case class MemoConfig(
|
||||
@ConfigName("collection.cache") cacheColl: String,
|
||||
@ConfigName("collection.config") configColl: String
|
||||
)
|
||||
|
||||
final class Env(
|
||||
appConfig: Configuration,
|
||||
db: lila.db.Env,
|
||||
system: akka.actor.ActorSystem
|
||||
) {
|
||||
final class Env(appConfig: Configuration, db: lila.db.Env)(implicit system: akka.actor.ActorSystem) {
|
||||
|
||||
private val config = appConfig.get[MemoConfig]("memo")(AutoConfig.loader)
|
||||
|
||||
private val configColl = db(config.configColl)
|
||||
lazy val mongoCache = wire[MongoCache.Builder]
|
||||
|
||||
lazy val mongoCache: MongoCache.Builder = new MongoCache.Builder(db(config.cacheColl))
|
||||
lazy val configStore = wire[ConfigStore.Builder]
|
||||
|
||||
lazy val configStore: ConfigStore.Builder = new ConfigStore.Builder(configColl)
|
||||
lazy val settingStore = wire[SettingStore.Builder]
|
||||
|
||||
lazy val settingStore: SettingStore.Builder = new SettingStore.Builder(configColl)
|
||||
|
||||
lazy val asyncCache: AsyncCache.Builder = new AsyncCache.Builder()(system)
|
||||
lazy val asyncCache = wire[AsyncCache.Builder]
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import scala.concurrent.duration._
|
|||
|
||||
import lila.db.BSON.BSONJodaDateTimeHandler
|
||||
import lila.db.dsl._
|
||||
import lila.tagging._
|
||||
|
||||
final class MongoCache[K, V: BSONHandler] private (
|
||||
prefix: String,
|
||||
|
@ -59,7 +60,9 @@ object MongoCache {
|
|||
() => DateTime.now plusSeconds seconds
|
||||
}
|
||||
|
||||
final class Builder(coll: Coll) {
|
||||
final class Builder(db: lila.db.Env, config: MemoConfig) {
|
||||
|
||||
val coll = db(config.cacheColl)
|
||||
|
||||
def apply[K, V: BSONHandler](
|
||||
prefix: String,
|
||||
|
|
|
@ -47,7 +47,8 @@ object SettingStore {
|
|||
|
||||
type Init[A] = (ConfigValue[A], DbValue[A]) => A
|
||||
|
||||
final class Builder(coll: Coll) {
|
||||
final class Builder(db: lila.db.Env, config: MemoConfig) {
|
||||
val coll = db(config.configColl)
|
||||
def apply[A: BSONHandler: StringReader: Formable](
|
||||
id: String,
|
||||
default: A,
|
||||
|
|
|
@ -47,7 +47,7 @@ final class Env(
|
|||
spam = spam
|
||||
)
|
||||
|
||||
lila.common.Bus.subscribeFun('gdprErase) {
|
||||
lila.common.Bus.subscribeFun("gdprErase") {
|
||||
case lila.user.User.GDPRErase(user) => api erase user
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ final class MessageApi(
|
|||
(thread isVisibleBy thread.receiverOf(post)) ?? {
|
||||
import lila.notify.{ Notification, PrivateMessage }
|
||||
import lila.common.String.shorten
|
||||
lila.common.Bus.publish(Event.NewMessage(thread, post), 'newMessage)
|
||||
lila.common.Bus.publish(Event.NewMessage(thread, post), "newMessage")
|
||||
notifyApi addNotification Notification.make(
|
||||
Notification.Notifies(thread receiverOf post),
|
||||
PrivateMessage(
|
||||
|
|
|
@ -130,7 +130,7 @@ final class Env(
|
|||
case lila.hub.actorApi.mod.AutoWarning(userId, subject) =>
|
||||
logApi.modMessage(User.lichessId, userId, subject)
|
||||
}
|
||||
}), name = ActorName), 'finishGame, 'analysisReady, 'garbageCollect, 'playban, 'autoWarning)
|
||||
}), name = ActorName), "finishGame", "analysisReady", "garbageCollect", "playban", "autoWarning")
|
||||
}
|
||||
|
||||
object Env {
|
||||
|
|
|
@ -15,14 +15,14 @@ final class ImpersonateApi {
|
|||
modToUser = modToUser + (mod.id -> user.id)
|
||||
userToMod = userToMod + (user.id -> mod.id)
|
||||
logger.info(s"${mod.username} starts impersonating ${user.username}")
|
||||
Bus.publish(Impersonate(user.id, mod.id.some), 'impersonate)
|
||||
Bus.publish(Impersonate(user.id, mod.id.some), "impersonate")
|
||||
}
|
||||
|
||||
def stop(user: User): Unit = userToMod.get(user.id) ?? { modId =>
|
||||
modToUser = modToUser - modId
|
||||
userToMod = userToMod - user.id
|
||||
logger.info(s"${modId} stops impersonating ${user.username}")
|
||||
Bus.publish(Impersonate(user.id, none), 'impersonate)
|
||||
Bus.publish(Impersonate(user.id, none), "impersonate")
|
||||
}
|
||||
|
||||
def impersonating(mod: User): Fu[Option[User]] = modToUser.get(mod.id) ?? UserRepo.byId
|
||||
|
|
|
@ -24,7 +24,7 @@ final class ModApi(
|
|||
_ <- reportApi.process(mod, sus, Set(Room.Cheat, Room.Print))
|
||||
_ <- logApi.engine(mod, sus, v)
|
||||
} yield {
|
||||
Bus.publish(lila.hub.actorApi.mod.MarkCheater(sus.user.id, v), 'adjustCheater)
|
||||
Bus.publish(lila.hub.actorApi.mod.MarkCheater(sus.user.id, v), "adjustCheater")
|
||||
if (v) {
|
||||
notifier.reporters(mod, sus)
|
||||
refunder schedule sus
|
||||
|
@ -54,7 +54,7 @@ final class ModApi(
|
|||
_ <- logApi.booster(mod, sus, v)
|
||||
} yield {
|
||||
if (v) {
|
||||
Bus.publish(lila.hub.actorApi.mod.MarkBooster(sus.user.id), 'adjustBooster)
|
||||
Bus.publish(lila.hub.actorApi.mod.MarkBooster(sus.user.id), "adjustBooster")
|
||||
notifier.reporters(mod, sus)
|
||||
}
|
||||
sus
|
||||
|
@ -72,7 +72,7 @@ final class ModApi(
|
|||
changed ?? {
|
||||
UserRepo.updateTroll(sus.user).void >>- {
|
||||
logApi.troll(mod, sus)
|
||||
Bus.publish(lila.hub.actorApi.mod.Shadowban(sus.user.id, value), 'shadowban)
|
||||
Bus.publish(lila.hub.actorApi.mod.Shadowban(sus.user.id, value), "shadowban")
|
||||
}
|
||||
} >>
|
||||
reportApi.process(mod, sus, Set(Room.Comm)) >>- {
|
||||
|
@ -134,7 +134,7 @@ final class ModApi(
|
|||
// only add permissions the mod can actually grant
|
||||
permissions.filter(Granter.canGrant(mod.user, _))
|
||||
UserRepo.setRoles(user.id, finalPermissions.map(_.name).toList) >> {
|
||||
Bus.publish(lila.hub.actorApi.mod.SetPermissions(user.id, finalPermissions.map(_.name).toList), 'setPermissions)
|
||||
Bus.publish(lila.hub.actorApi.mod.SetPermissions(user.id, finalPermissions.map(_.name).toList), "setPermissions")
|
||||
logApi.setPermissions(mod, user.id, permissions.toList)
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ final class ModApi(
|
|||
}
|
||||
|
||||
def setRankban(mod: Mod, sus: Suspect, v: Boolean): Funit = (sus.user.rankban != v) ?? {
|
||||
if (v) Bus.publish(lila.hub.actorApi.mod.KickFromRankings(sus.user.id), 'kickFromRankings)
|
||||
if (v) Bus.publish(lila.hub.actorApi.mod.KickFromRankings(sus.user.id), "kickFromRankings")
|
||||
UserRepo.setRankban(sus.user.id, v) >>- logApi.rankban(mod, sus, v)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ final class ModStream(system: ActorSystem) {
|
|||
Json.stringify(js) + "\n"
|
||||
}
|
||||
|
||||
private val classifier = 'userSignup
|
||||
private val classifier = "userSignup"
|
||||
|
||||
def enumerator: Enumerator[String] = {
|
||||
var subscriber: Option[lila.common.Tellable] = None
|
||||
|
|
|
@ -45,7 +45,7 @@ final class Env(
|
|||
}
|
||||
}
|
||||
}), name = ActorName),
|
||||
'corresAlarm
|
||||
"corresAlarm"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,6 @@ final class NotifyApi(
|
|||
private def notifyUser(notifies: Notification.Notifies): Funit =
|
||||
getNotificationsAndCount(notifies, 1) map { msg =>
|
||||
import play.api.libs.json.Json
|
||||
Bus.publish(SendTo(notifies.value, "notifications", Json toJson msg), 'socketUsers)
|
||||
Bus.publish(SendTo(notifies.value, "notifications", Json toJson msg), "socketUsers")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ final class Env(
|
|||
indexer.userPerf(user, perfType) >> storage.find(user.id, perfType)
|
||||
} map (_ | PerfStat.init(user.id, perfType))
|
||||
|
||||
lila.common.Bus.subscribeFun('finishGame) {
|
||||
lila.common.Bus.subscribeFun("finishGame") {
|
||||
case lila.game.actorApi.FinishGame(game, _, _) if !game.aborted =>
|
||||
indexer addGame game addFailureEffect { e =>
|
||||
lila.log("perfStat").error(s"index game ${game.id}", e)
|
||||
|
|
|
@ -147,7 +147,7 @@ final class PlanApi(
|
|||
val plan =
|
||||
if (patron.canLevelUp) user.plan.incMonths
|
||||
else user.plan.enable
|
||||
Bus.publish(lila.hub.actorApi.plan.MonthInc(user.id, plan.months), 'plan)
|
||||
Bus.publish(lila.hub.actorApi.plan.MonthInc(user.id, plan.months), "plan")
|
||||
setDbUserPlan(user, plan)
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ final class PlanApi(
|
|||
amount = charge.cents.value,
|
||||
percent = m.percent,
|
||||
DateTime.now
|
||||
), 'plan)
|
||||
), "plan")
|
||||
lila.mon.plan.goal(m.goal.value)
|
||||
lila.mon.plan.current(m.current.value)
|
||||
lila.mon.plan.percent(m.percent)
|
||||
|
|
|
@ -14,19 +14,19 @@ private final class StripeClient(config: StripeClient.Config) {
|
|||
def createCustomer(user: User, data: Checkout, plan: StripePlan): Fu[StripeCustomer] =
|
||||
postOne[StripeCustomer](
|
||||
"customers",
|
||||
'plan -> plan.id,
|
||||
'source -> data.source.value,
|
||||
'email -> data.email,
|
||||
'description -> user.username
|
||||
"plan" -> plan.id,
|
||||
"source" -> data.source.value,
|
||||
"email" -> data.email,
|
||||
"description" -> user.username
|
||||
)
|
||||
|
||||
def createAnonCustomer(plan: StripePlan, data: Checkout): Fu[StripeCustomer] =
|
||||
postOne[StripeCustomer](
|
||||
"customers",
|
||||
'plan -> plan.id,
|
||||
'source -> data.source.value,
|
||||
'email -> data.email,
|
||||
'description -> "Anonymous"
|
||||
"plan" -> plan.id,
|
||||
"source" -> data.source.value,
|
||||
"email" -> data.email,
|
||||
"description" -> "Anonymous"
|
||||
)
|
||||
|
||||
def getCustomer(id: CustomerId): Fu[Option[StripeCustomer]] =
|
||||
|
@ -35,39 +35,39 @@ private final class StripeClient(config: StripeClient.Config) {
|
|||
def createSubscription(customer: StripeCustomer, plan: StripePlan, source: Source): Fu[StripeSubscription] =
|
||||
postOne[StripeSubscription](
|
||||
"subscriptions",
|
||||
'customer -> customer.id,
|
||||
'plan -> plan.id,
|
||||
'source -> source.value
|
||||
"customer" -> customer.id,
|
||||
"plan" -> plan.id,
|
||||
"source" -> source.value
|
||||
)
|
||||
|
||||
def updateSubscription(sub: StripeSubscription, plan: StripePlan, source: Option[Source]): Fu[StripeSubscription] =
|
||||
postOne[StripeSubscription](
|
||||
s"subscriptions/${sub.id}",
|
||||
'plan -> plan.id,
|
||||
'source -> source.map(_.value),
|
||||
'prorate -> false
|
||||
"plan" -> plan.id,
|
||||
"source" -> source.map(_.value),
|
||||
"prorate" -> false
|
||||
)
|
||||
|
||||
def cancelSubscription(sub: StripeSubscription): Fu[StripeSubscription] =
|
||||
deleteOne[StripeSubscription](
|
||||
s"subscriptions/${sub.id}",
|
||||
'at_period_end -> false
|
||||
"at_period_end" -> false
|
||||
)
|
||||
|
||||
def dontRenewSubscription(sub: StripeSubscription): Fu[StripeSubscription] =
|
||||
deleteOne[StripeSubscription](
|
||||
s"subscriptions/${sub.id}",
|
||||
'at_period_end -> true
|
||||
"at_period_end" -> true
|
||||
)
|
||||
|
||||
def getEvent(id: String): Fu[Option[JsObject]] =
|
||||
getOne[JsObject](s"events/$id")
|
||||
|
||||
def getNextInvoice(customerId: CustomerId): Fu[Option[StripeInvoice]] =
|
||||
getOne[StripeInvoice](s"invoices/upcoming", 'customer -> customerId.value)
|
||||
getOne[StripeInvoice](s"invoices/upcoming", "customer" -> customerId.value)
|
||||
|
||||
def getPastInvoices(customerId: CustomerId): Fu[List[StripeInvoice]] =
|
||||
getList[StripeInvoice]("invoices", 'customer -> customerId.value)
|
||||
getList[StripeInvoice]("invoices", "customer" -> customerId.value)
|
||||
|
||||
def getPlan(cents: Cents, freq: Freq): Fu[Option[StripePlan]] =
|
||||
getOne[StripePlan](s"plans/${StripePlan.make(cents, freq).id}")
|
||||
|
@ -75,34 +75,34 @@ private final class StripeClient(config: StripeClient.Config) {
|
|||
def makePlan(cents: Cents, freq: Freq): Fu[StripePlan] =
|
||||
postOne[StripePlan](
|
||||
"plans",
|
||||
'id -> StripePlan.make(cents, freq).id,
|
||||
'amount -> cents.value,
|
||||
'currency -> "usd",
|
||||
'interval -> "month",
|
||||
'name -> StripePlan.make(cents, freq).name
|
||||
"id" -> StripePlan.make(cents, freq).id,
|
||||
"amount" -> cents.value,
|
||||
"currency" -> "usd",
|
||||
"interval" -> "month",
|
||||
"name" -> StripePlan.make(cents, freq).name
|
||||
)
|
||||
|
||||
// def chargeAnonCard(data: Checkout): Funit =
|
||||
// postOne[StripePlan]("charges",
|
||||
// 'amount -> data.cents.value,
|
||||
// 'currency -> "usd",
|
||||
// 'source -> data.source.value,
|
||||
// 'description -> "Anon one-time",
|
||||
// 'metadata -> Map("email" -> data.email),
|
||||
// 'receipt_email -> data.email).void
|
||||
// "amount" -> data.cents.value,
|
||||
// "currency" -> "usd",
|
||||
// "source" -> data.source.value,
|
||||
// "description" -> "Anon one-time",
|
||||
// "metadata" -> Map("email" -> data.email),
|
||||
// "receipt_email" -> data.email).void
|
||||
|
||||
// charge without changing the customer plan
|
||||
def addOneTime(customer: StripeCustomer, amount: Cents): Funit =
|
||||
postOne[StripeCharge](
|
||||
"charges",
|
||||
'customer -> customer.id.value,
|
||||
'amount -> amount.value,
|
||||
'currency -> "usd",
|
||||
'description -> "Monthly customer adds a one-time",
|
||||
'receipt_email -> customer.email
|
||||
"customer" -> customer.id.value,
|
||||
"amount" -> amount.value,
|
||||
"currency" -> "usd",
|
||||
"description" -> "Monthly customer adds a one-time",
|
||||
"receipt_email" -> customer.email
|
||||
).void
|
||||
|
||||
private def getOne[A: Reads](url: String, queryString: (Symbol, Any)*): Fu[Option[A]] =
|
||||
private def getOne[A: Reads](url: String, queryString: (String, Any)*): Fu[Option[A]] =
|
||||
get[A](url, queryString) map Some.apply recover {
|
||||
case _: NotFoundException => None
|
||||
case e: DeletedException => {
|
||||
|
@ -111,24 +111,24 @@ private final class StripeClient(config: StripeClient.Config) {
|
|||
}
|
||||
}
|
||||
|
||||
private def getList[A: Reads](url: String, queryString: (Symbol, Any)*): Fu[List[A]] =
|
||||
private def getList[A: Reads](url: String, queryString: (String, Any)*): Fu[List[A]] =
|
||||
get[List[A]](url, queryString)(listReader[A])
|
||||
|
||||
private def postOne[A: Reads](url: String, data: (Symbol, Any)*): Fu[A] = post[A](url, data)
|
||||
private def postOne[A: Reads](url: String, data: (String, Any)*): Fu[A] = post[A](url, data)
|
||||
|
||||
private def deleteOne[A: Reads](url: String, queryString: (Symbol, Any)*): Fu[A] = delete[A](url, queryString)
|
||||
private def deleteOne[A: Reads](url: String, queryString: (String, Any)*): Fu[A] = delete[A](url, queryString)
|
||||
|
||||
private def get[A: Reads](url: String, queryString: Seq[(Symbol, Any)]): Fu[A] = {
|
||||
private def get[A: Reads](url: String, queryString: Seq[(String, Any)]): Fu[A] = {
|
||||
logger.info(s"GET $url ${debugInput(queryString)}")
|
||||
request(url).withQueryString(fixInput(queryString): _*).get() flatMap response[A]
|
||||
}
|
||||
|
||||
private def post[A: Reads](url: String, data: Seq[(Symbol, Any)]): Fu[A] = {
|
||||
private def post[A: Reads](url: String, data: Seq[(String, Any)]): Fu[A] = {
|
||||
logger.info(s"POST $url ${debugInput(data)}")
|
||||
request(url).post(fixInput(data).toMap mapValues { Seq(_) }) flatMap response[A]
|
||||
}
|
||||
|
||||
private def delete[A: Reads](url: String, data: Seq[(Symbol, Any)]): Fu[A] = {
|
||||
private def delete[A: Reads](url: String, data: Seq[(String, Any)]): Fu[A] = {
|
||||
logger.info(s"DELETE $url ${debugInput(data)}")
|
||||
request(url).withQueryString(fixInput(data): _*).delete() flatMap response[A]
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ private final class StripeClient(config: StripeClient.Config) {
|
|||
private def isDeleted(js: JsValue): Boolean =
|
||||
(js.asOpt[JsObject] flatMap { o => (o \ "deleted").asOpt[Boolean] }) == Some(true)
|
||||
|
||||
private def fixInput(in: Seq[(Symbol, Any)]): Seq[(String, String)] = (in map {
|
||||
private def fixInput(in: Seq[(String, Any)]): Seq[(String, String)] = (in map {
|
||||
case (sym, Some(x)) => Some(sym.name -> x.toString)
|
||||
case (sym, None) => None
|
||||
case (sym, x) => Some(sym.name -> x.toString)
|
||||
|
@ -163,7 +163,7 @@ private final class StripeClient(config: StripeClient.Config) {
|
|||
|
||||
private def listReader[A: Reads]: Reads[List[A]] = (__ \ "data").read[List[A]]
|
||||
|
||||
private def debugInput(data: Seq[(Symbol, Any)]) = fixInput(data) map { case (k, v) => s"$k=$v" } mkString " "
|
||||
private def debugInput(data: Seq[(String, Any)]) = fixInput(data) map { case (k, v) => s"$k=$v" } mkString " "
|
||||
}
|
||||
|
||||
object StripeClient {
|
||||
|
|
|
@ -116,7 +116,7 @@ final class PlaybanApi(
|
|||
|
||||
private def propagateSitting(game: Game, userId: User.ID): Funit =
|
||||
rageSitCache get userId map { rageSit =>
|
||||
if (rageSit.isBad) Bus.publish(SittingDetected(game, userId), 'playban)
|
||||
if (rageSit.isBad) Bus.publish(SittingDetected(game, userId), "playban")
|
||||
}
|
||||
|
||||
def other(game: Game, status: Status.type => Status, winner: Option[Color]): Funit =
|
||||
|
@ -211,7 +211,6 @@ final class PlaybanApi(
|
|||
(delta < 0) ?? {
|
||||
if (record.rageSit.isTerrible) {
|
||||
lila.log("ragesit").warn(s"Close https://lichess.org/@/${record.userId} ragesit=${record.rageSit}")
|
||||
// bus.publish(lila.hub.actorApi.playban.SitcounterClose(userId), 'playban)
|
||||
funit
|
||||
} else if (record.rageSit.isVeryBad) for {
|
||||
mod <- UserRepo.lichess
|
||||
|
@ -219,7 +218,7 @@ final class PlaybanApi(
|
|||
} yield (mod zip user).headOption foreach {
|
||||
case (m, u) =>
|
||||
lila.log("ragesit").info(s"https://lichess.org/@/${u.username} ${record.rageSit.counterView}")
|
||||
Bus.publish(lila.hub.actorApi.mod.AutoWarning(u.id, ModPreset.sittingAuto.subject), 'autoWarning)
|
||||
Bus.publish(lila.hub.actorApi.mod.AutoWarning(u.id, ModPreset.sittingAuto.subject), "autoWarning")
|
||||
messenger.sendPreset(m, u, ModPreset.sittingAuto).void
|
||||
}
|
||||
else funit
|
||||
|
@ -230,7 +229,7 @@ final class PlaybanApi(
|
|||
(!record.banInEffect) ?? {
|
||||
lila.mon.playban.ban.count()
|
||||
lila.mon.playban.ban.mins(ban.mins)
|
||||
Bus.publish(lila.hub.actorApi.playban.Playban(record.userId, ban.mins), 'playban)
|
||||
Bus.publish(lila.hub.actorApi.playban.Playban(record.userId, ban.mins), "playban")
|
||||
coll.update(
|
||||
$id(record.userId),
|
||||
$unset("o") ++
|
||||
|
|
|
@ -28,7 +28,7 @@ private final class SandbagWatch(messenger: MessageApi) {
|
|||
} yield (mod zip user).headOption.?? {
|
||||
case (m, u) =>
|
||||
lila.log("sandbag").info(s"https://lichess.org/@/${u.username}")
|
||||
lila.common.Bus.publish(lila.hub.actorApi.mod.AutoWarning(u.id, ModPreset.sandbagAuto.subject), 'autoWarning)
|
||||
lila.common.Bus.publish(lila.hub.actorApi.mod.AutoWarning(u.id, ModPreset.sandbagAuto.subject), "autoWarning")
|
||||
messenger.sendPreset(m, u, ModPreset.sandbagAuto).void
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ final class Env(
|
|||
)
|
||||
|
||||
private lazy val gameStarter = new GameStarter(
|
||||
onStart = gameId => Bus.publish(lila.game.Game.Id(gameId), 'gameStartId),
|
||||
onStart = gameId => Bus.publish(lila.game.Game.Id(gameId), "gameStartId"),
|
||||
sequencer = new FutureSequencer(
|
||||
system = system,
|
||||
executionTimeout = 5.seconds.some,
|
||||
|
|
|
@ -20,7 +20,7 @@ private final class GameStarter(
|
|||
val userIds = couples.flatMap(_.userIds)
|
||||
UserRepo.perfOf(userIds, pool.perfType) flatMap { perfs =>
|
||||
couples.map(one(pool, perfs)).sequenceFu.map { pairings =>
|
||||
lila.common.Bus.publish(Pairings(pairings.flatten.toList), 'poolPairings)
|
||||
lila.common.Bus.publish(Pairings(pairings.flatten.toList), "poolPairings")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ private final class HookThieve()(implicit system: akka.actor.ActorSystem) {
|
|||
import HookThieve._
|
||||
|
||||
def candidates(clock: chess.Clock.Config, monId: String): Fu[PoolHooks] =
|
||||
Bus.ask[PoolHooks]('lobbyTrouper)(GetCandidates(clock, _)) recover {
|
||||
Bus.ask[PoolHooks]("lobbyTrouper")(GetCandidates(clock, _)) recover {
|
||||
case _ =>
|
||||
lila.mon.lobby.pool.thieve.timeout(monId)()
|
||||
PoolHooks(Vector.empty)
|
||||
|
@ -17,7 +17,7 @@ private final class HookThieve()(implicit system: akka.actor.ActorSystem) {
|
|||
|
||||
def stolen(poolHooks: Vector[PoolHook], monId: String) = {
|
||||
lila.mon.lobby.pool.thieve.stolen(monId)(poolHooks.size)
|
||||
if (poolHooks.nonEmpty) Bus.publish(StolenHookIds(poolHooks.map(_.hookId)), 'lobbyTrouper)
|
||||
if (poolHooks.nonEmpty) Bus.publish(StolenHookIds(poolHooks.map(_.hookId)), "lobbyTrouper")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ final class Env(
|
|||
studyApi = studyApi
|
||||
)
|
||||
|
||||
lila.common.Bus.subscribeFun('study) {
|
||||
lila.common.Bus.subscribeFun("study") {
|
||||
case lila.study.actorApi.SaveStudy(study) => api.structure onSave study
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ final class PracticeApi(
|
|||
}
|
||||
} >>- studyApi.studyIdOf(chapterId).foreach {
|
||||
_ ?? { studyId =>
|
||||
Bus.publish(PracticeProgress.OnComplete(user.id, studyId, chapterId), 'finishPractice)
|
||||
Bus.publish(PracticeProgress.OnComplete(user.id, studyId, chapterId), "finishPractice")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ final class Env(
|
|||
system = system
|
||||
)
|
||||
|
||||
lila.common.Bus.subscribeFun('finishGame, 'moveEventCorres, 'newMessage, 'challenge, 'corresAlarm, 'offerEventCorres) {
|
||||
lila.common.Bus.subscribeFun("finishGame", "moveEventCorres", "newMessage", "challenge", "corresAlarm", "offerEventCorres") {
|
||||
case lila.game.actorApi.FinishGame(game, _, _) => pushApi finish game logFailure logger
|
||||
case lila.hub.actorApi.round.CorresMoveEvent(move, _, pushable, _, _) if pushable => pushApi move move logFailure logger
|
||||
case lila.hub.actorApi.round.CorresTakebackOfferEvent(gameId) => pushApi takebackOffer gameId logFailure logger
|
||||
|
|
|
@ -220,7 +220,7 @@ private final class PushApi(
|
|||
}
|
||||
|
||||
private def IfAway(pov: Pov)(f: => Funit): Funit =
|
||||
lila.common.Bus.ask[Boolean]('roundSocket) { p =>
|
||||
lila.common.Bus.ask[Boolean]("roundSocket") { p =>
|
||||
Tell(pov.gameId, IsOnGame(pov.color, p))
|
||||
}(system) flatMap {
|
||||
case true => funit
|
||||
|
|
|
@ -41,7 +41,7 @@ private[puzzle] final class Finisher(
|
|||
$set(Puzzle.BSONFields.perf -> PuzzlePerf.puzzlePerfBSONHandler.write(puzzlePerf))
|
||||
) zip UserRepo.setPerf(user.id, PerfType.Puzzle, userPerf)
|
||||
} inject {
|
||||
Bus.publish(Puzzle.UserResult(puzzle.id, user.id, result, formerUserRating -> userPerf.intRating), 'finishPuzzle)
|
||||
Bus.publish(Puzzle.UserResult(puzzle.id, user.id, result, formerUserRating -> userPerf.intRating), "finishPuzzle")
|
||||
round -> Mode.Rated
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ private[puzzle] final class Finisher(
|
|||
UserRepo.setPerf(user.id, PerfType.Puzzle, userPerf) >>-
|
||||
Bus.publish(
|
||||
Puzzle.UserResult(puzzle.id, user.id, result, formerUserRating -> userPerf.intRating),
|
||||
'finishPuzzle
|
||||
"finishPuzzle"
|
||||
) inject
|
||||
user.copy(perfs = user.perfs.copy(puzzle = userPerf))
|
||||
} recover lila.db.recoverDuplicateKey { _ =>
|
||||
|
|
|
@ -17,7 +17,7 @@ private[relation] final class RelationActor(
|
|||
|
||||
private var previousOnlineIds = Set.empty[ID]
|
||||
|
||||
private val subs = List('startGame, 'finishGame, 'study, 'reloadOnlineFriends)
|
||||
private val subs = List("startGame", "finishGame", "study", "reloadOnlineFriends")
|
||||
|
||||
override def preStart(): Unit = {
|
||||
Bus.subscribe(self, subs)
|
||||
|
@ -47,7 +47,7 @@ private[relation] final class RelationActor(
|
|||
case ReloadOnlineFriends(userId) => online friendsOf userId foreach { res =>
|
||||
// the mobile app requests this on every WS connection
|
||||
// we can skip it if empty
|
||||
if (!res.isEmpty) Bus.publish(SendTo(userId, JsonView writeOnlineFriends res), 'socketUsers)
|
||||
if (!res.isEmpty) Bus.publish(SendTo(userId, JsonView writeOnlineFriends res), "socketUsers")
|
||||
}
|
||||
|
||||
case lila.game.actorApi.FinishGame(game, _, _) if game.hasClock =>
|
||||
|
@ -118,7 +118,7 @@ private[relation] final class RelationActor(
|
|||
) =
|
||||
friendsEntering foreach { entering =>
|
||||
api fetchFollowersFromSecondary entering.user.id map onlineUserIds.intersect foreach { ids =>
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, JsonView.writeFriendEntering(entering)), 'socketUsers)
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, JsonView.writeFriendEntering(entering)), "socketUsers")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,19 +128,19 @@ private[relation] final class RelationActor(
|
|||
) =
|
||||
friendsLeaving foreach { leaving =>
|
||||
api fetchFollowersFromSecondary leaving.id map onlineUserIds.intersect foreach { ids =>
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, "following_leaves", leaving.titleName), 'socketUsers)
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, "following_leaves", leaving.titleName), "socketUsers")
|
||||
}
|
||||
}
|
||||
|
||||
private def notifyFollowersGameStateChanged(userIds: Traversable[ID], message: String) =
|
||||
userIds foreach { userId =>
|
||||
api.fetchFollowersFromSecondary(userId) map online.userIds().intersect foreach { ids =>
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, message, userId), 'socketUsers)
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, message, userId), "socketUsers")
|
||||
}
|
||||
}
|
||||
|
||||
private def notifyFollowersFriendInStudyStateChanged(userId: ID, studyId: String, message: String) =
|
||||
api.fetchFollowersFromSecondary(userId) map online.userIds().intersect foreach { ids =>
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, message, userId), 'socketUsers)
|
||||
if (ids.nonEmpty) Bus.publish(SendTos(ids.toSet, message, userId), "socketUsers")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ final class RelationApi(
|
|||
countFollowingCache.update(u1, prev => (prev + 1) atMost maxFollow)
|
||||
reloadOnlineFriends(u1, u2)
|
||||
timeline ! Propagate(FollowUser(u1, u2)).toFriendsOf(u1).toUsers(List(u2))
|
||||
Bus.publish(lila.hub.actorApi.relation.Follow(u1, u2), 'relation)
|
||||
Bus.publish(lila.hub.actorApi.relation.Follow(u1, u2), "relation")
|
||||
lila.mon.relation.follow()
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ final class RelationApi(
|
|||
case _ =>
|
||||
RelationRepo.block(u1, u2) >> limitBlock(u1) >> unfollow(u2, u1) >>- {
|
||||
reloadOnlineFriends(u1, u2)
|
||||
Bus.publish(lila.hub.actorApi.relation.Block(u1, u2), 'relation)
|
||||
Bus.publish(lila.hub.actorApi.relation.Block(u1, u2), "relation")
|
||||
lila.mon.relation.block()
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ final class RelationApi(
|
|||
fetchBlocks(u1, u2) flatMap {
|
||||
case true => RelationRepo.unblock(u1, u2) >>- {
|
||||
reloadOnlineFriends(u1, u2)
|
||||
Bus.publish(lila.hub.actorApi.relation.UnBlock(u1, u2), 'relation)
|
||||
Bus.publish(lila.hub.actorApi.relation.UnBlock(u1, u2), "relation")
|
||||
lila.mon.relation.unblock()
|
||||
}
|
||||
case _ => funit
|
||||
|
|
|
@ -61,7 +61,7 @@ final class Env(
|
|||
api.autoStart >> api.autoFinishNotSyncing
|
||||
}
|
||||
|
||||
lila.common.Bus.subscribeFun('studyLikes, 'study, 'relayToggle) {
|
||||
lila.common.Bus.subscribeFun("studyLikes", "study", "relayToggle") {
|
||||
case lila.study.actorApi.StudyLikes(id, likes) => api.setLikes(Relay.Id(id.value), likes)
|
||||
case lila.hub.actorApi.study.RemoveStudy(studyId, _) => api.onStudyRemove(studyId)
|
||||
case lila.study.actorApi.RelayToggle(id, v, who) =>
|
||||
|
|
|
@ -139,7 +139,7 @@ final class RelayApi(
|
|||
import JsonView.idWrites
|
||||
import lila.socket.Socket.makeMessage
|
||||
val payload = makeMessage(t, msg ++ Json.obj("id" -> id))
|
||||
lila.common.Bus.publish(SendTos(userIds, payload), 'socketUsers)
|
||||
lila.common.Bus.publish(SendTos(userIds, payload), "socketUsers")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ final class Env(
|
|||
}
|
||||
}), name = ActorName)
|
||||
|
||||
lila.common.Bus.subscribeFun('playban) {
|
||||
lila.common.Bus.subscribeFun("playban") {
|
||||
case lila.hub.actorApi.playban.Playban(userId, _) => api.maybeAutoPlaybanReport(userId)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ object RoomSocket {
|
|||
def msg = makeMessage(tpe, data)
|
||||
}
|
||||
|
||||
case class RoomChat(classifier: Symbol)
|
||||
case class RoomChat(classifier: String)
|
||||
|
||||
final class RoomState(roomId: RoomId, send: Send, chat: Option[RoomChat]) extends Trouper {
|
||||
|
||||
|
|
|
@ -31,12 +31,12 @@ private final class CorresAlarm(
|
|||
|
||||
system.scheduler.scheduleOnce(10 seconds)(scheduleNext)
|
||||
|
||||
Bus.subscribeFun('finishGame) {
|
||||
Bus.subscribeFun("finishGame") {
|
||||
case lila.game.actorApi.FinishGame(game, _, _) =>
|
||||
if (game.hasCorrespondenceClock && !game.hasAi) coll.remove($id(game.id))
|
||||
}
|
||||
|
||||
Bus.subscribeFun('moveEventCorres) {
|
||||
Bus.subscribeFun("moveEventCorres") {
|
||||
case lila.hub.actorApi.round.CorresMoveEvent(move, _, _, alarmable, _) if alarmable =>
|
||||
proxyGame(move.gameId) flatMap {
|
||||
_ ?? { game =>
|
||||
|
@ -71,7 +71,7 @@ private final class CorresAlarm(
|
|||
case true => // already looking at the game
|
||||
case false => Bus.publish(
|
||||
lila.game.actorApi.CorresAlarmEvent(pov),
|
||||
'corresAlarm
|
||||
"corresAlarm"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ private final class DeployPersistence(system: ActorSystem) {
|
|||
ongoing = none
|
||||
}
|
||||
|
||||
lila.common.Bus.subscribeFun('deploy) {
|
||||
lila.common.Bus.subscribeFun("deploy") {
|
||||
case _: Deploy => enable()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,6 @@ private[round] final class Drawer(
|
|||
private def publishDrawOffer(pov: Pov): Unit =
|
||||
if (pov.game.isCorrespondence && pov.game.nonAi) Bus.publish(
|
||||
lila.hub.actorApi.round.CorresDrawOfferEvent(pov.gameId),
|
||||
'offerEventCorres
|
||||
"offerEventCorres"
|
||||
)
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ final class Env(
|
|||
player = player,
|
||||
drawer = drawer,
|
||||
forecastApi = forecastApi,
|
||||
isSimulHost = userId => Bus.ask[Set[User.ID]]('simulGetHosts)(GetHostIds)(system).dmap(_ contains userId)
|
||||
isSimulHost = userId => Bus.ask[Set[User.ID]]("simulGetHosts")(GetHostIds)(system).dmap(_ contains userId)
|
||||
),
|
||||
deployPersistence = deployPersistence,
|
||||
scheduleExpiration = scheduleExpiration,
|
||||
|
@ -88,20 +88,20 @@ final class Env(
|
|||
)
|
||||
|
||||
Bus.subscribeFuns(
|
||||
'roundMapTell -> {
|
||||
"roundMapTell" -> {
|
||||
case Tell(id, msg) => tellRound(id, msg)
|
||||
},
|
||||
'roundMapTellAll -> {
|
||||
"roundMapTellAll" -> {
|
||||
case msg => roundSocket.rounds.tellAll(msg)
|
||||
},
|
||||
'accountClose -> {
|
||||
"accountClose" -> {
|
||||
case lila.hub.actorApi.security.CloseAccount(userId) => GameRepo.allPlaying(userId) map {
|
||||
_ foreach { pov =>
|
||||
tellRound(pov.gameId, Resign(pov.playerId))
|
||||
}
|
||||
}
|
||||
},
|
||||
'gameStartId -> {
|
||||
"gameStartId" -> {
|
||||
case Game.Id(gameId) => onStart(gameId)
|
||||
}
|
||||
)
|
||||
|
@ -237,9 +237,9 @@ final class Env(
|
|||
|
||||
def onStart(gameId: Game.ID): Unit = proxy game gameId foreach {
|
||||
_ foreach { game =>
|
||||
Bus.publish(lila.game.actorApi.StartGame(game), 'startGame)
|
||||
Bus.publish(lila.game.actorApi.StartGame(game), "startGame")
|
||||
game.userIds foreach { userId =>
|
||||
Bus.publish(lila.game.actorApi.UserStartGame(userId, game), Symbol(s"userStartGame:$userId"))
|
||||
Bus.publish(lila.game.actorApi.UserStartGame(userId, game), s"userStartGame:$userId")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ private[round] final class Finisher(
|
|||
getSocketStatus(pov.game) foreach { ss =>
|
||||
playban.abort(pov, ss.colorsOnGame)
|
||||
}
|
||||
Bus.publish(AbortedBy(pov), 'abortGame)
|
||||
Bus.publish(AbortedBy(pov), "abortGame")
|
||||
}
|
||||
|
||||
def rageQuit(game: Game, winner: Option[Color])(implicit proxy: GameProxy): Fu[Events] =
|
||||
|
@ -120,7 +120,7 @@ private[round] final class Finisher(
|
|||
message foreach { messenger.system(g, _) }
|
||||
GameRepo game g.id foreach { newGame =>
|
||||
newGame foreach proxy.setFinishedGame
|
||||
Bus.publish(finish.copy(game = newGame | g), 'finishGame)
|
||||
Bus.publish(finish.copy(game = newGame | g), "finishGame")
|
||||
}
|
||||
prog.events :+ lila.game.Event.EndData(g, ratingDiffs)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ private object MoveMonitor {
|
|||
Kamon.metrics.subscribe("trace", "round.move.trace", system.actorOf(Props(new Actor {
|
||||
var currentMicros: Int = 0
|
||||
context.system.scheduler.schedule(5 second, 2 second) {
|
||||
lila.common.Bus.publish(lila.hub.actorApi.round.Mlat(currentMicros), 'mlat)
|
||||
lila.common.Bus.publish(lila.hub.actorApi.round.Mlat(currentMicros), "mlat")
|
||||
}
|
||||
def receive = {
|
||||
case tick: TickMetricSnapshot => tick.metrics.collectFirst {
|
||||
|
|
|
@ -146,7 +146,7 @@ private[round] final class Player(
|
|||
alarmable = game.alarmable,
|
||||
unlimited = game.isUnlimited
|
||||
),
|
||||
'moveEventCorres
|
||||
"moveEventCorres"
|
||||
)
|
||||
|
||||
// publish simul moves
|
||||
|
@ -155,7 +155,7 @@ private[round] final class Player(
|
|||
opponentUserId <- game.player(!color).userId
|
||||
} Bus.publish(
|
||||
SimulMoveEvent(move = moveEvent, simulId = simulId, opponentUserId = opponentUserId),
|
||||
'moveEventSimul
|
||||
"moveEventSimul"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ private[round] final class Rematcher(
|
|||
private def rematchCreate(pov: Pov): Events = {
|
||||
messenger.system(pov.game, _.rematchOfferSent)
|
||||
pov.opponent.userId foreach { forId =>
|
||||
Bus.publish(lila.hub.actorApi.round.RematchOffer(pov.gameId), Symbol(s"rematchFor:$forId"))
|
||||
Bus.publish(lila.hub.actorApi.round.RematchOffer(pov.gameId), s"rematchFor:$forId")
|
||||
}
|
||||
offers.put(pov.gameId, Offers(white = pov.color.white, black = pov.color.black))
|
||||
List(Event.RematchOffer(by = pov.color.some))
|
||||
|
|
|
@ -388,25 +388,25 @@ private[round] final class RoundDuct(
|
|||
|
||||
private object buscriptions {
|
||||
|
||||
private var classifiers = collection.mutable.Set.empty[Symbol]
|
||||
private var chans = collection.mutable.Set.empty[String]
|
||||
|
||||
private def sub(classifier: Symbol) =
|
||||
if (!classifiers(classifier)) {
|
||||
Bus.subscribe(RoundDuct.this, classifier)
|
||||
classifiers += classifier
|
||||
private def sub(chan: String) =
|
||||
if (!chans(chan)) {
|
||||
Bus.subscribe(RoundDuct.this, chan)
|
||||
chans += chan
|
||||
}
|
||||
|
||||
def started = classifiers.nonEmpty
|
||||
def started = chans.nonEmpty
|
||||
|
||||
def unsubAll = {
|
||||
Bus.unsubscribe(RoundDuct.this, classifiers)
|
||||
classifiers.clear
|
||||
Bus.unsubscribe(RoundDuct.this, chans)
|
||||
chans.clear
|
||||
}
|
||||
|
||||
def tv(userId: User.ID): Unit = sub(Symbol(s"userStartGame:$userId"))
|
||||
def tv(userId: User.ID): Unit = sub(s"userStartGame:$userId")
|
||||
|
||||
def chat = chatIds.allIds foreach { chatId =>
|
||||
sub(lila.chat.Chat classify chatId)
|
||||
sub(lila.chat.Chat chanOf chatId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ final class RoundSocket(
|
|||
case Protocol.In.SelfReport(fullId, ip, userId, name) => selfReport(userId, ip, fullId, name)
|
||||
case userTv: Protocol.In.UserTv => tellRound(userTv.gameId, userTv)
|
||||
case P.In.TellSri(sri, userId, tpe, msg) => // eval cache
|
||||
Bus.publish(TellSriIn(sri.value, userId, msg), Symbol(s"remoteSocketIn:$tpe"))
|
||||
Bus.publish(TellSriIn(sri.value, userId, msg), s"remoteSocketIn:$tpe")
|
||||
case RP.In.SetVersions(versions) => versions foreach {
|
||||
case (roomId, version) => rounds.tell(roomId, SetVersion(version))
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ final class RoundSocket(
|
|||
roundHandler orElse remoteSocketApi.baseHandler
|
||||
) >>- send(P.Out.boot)
|
||||
|
||||
Bus.subscribeFun('tvSelect, 'roundSocket, 'tourStanding) {
|
||||
Bus.subscribeFun("tvSelect", "roundSocket", "tourStanding") {
|
||||
case TvSelect(gameId, speed, json) => send(Protocol.Out.tvSelect(gameId, speed, json))
|
||||
case Tell(gameId, BotConnected(color, v)) => send(Protocol.Out.botConnected(gameId, color, v))
|
||||
case Tell(gameId, msg) => rounds.tell(gameId, msg)
|
||||
|
|
|
@ -65,7 +65,7 @@ private final class Takebacker(
|
|||
if (pov.game.isCorrespondence && pov.game.nonAi) pov.player.userId foreach { userId =>
|
||||
Bus.publish(
|
||||
lila.hub.actorApi.round.CorresTakebackOfferEvent(pov.gameId),
|
||||
'offerEventCorres
|
||||
"offerEventCorres"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ private final class TvBroadcast extends Actor {
|
|||
|
||||
private var featuredId = none[String]
|
||||
|
||||
Bus.subscribe(self, 'changeFeaturedGame)
|
||||
Bus.subscribe(self, "changeFeaturedGame")
|
||||
|
||||
def receive = {
|
||||
|
||||
|
@ -23,9 +23,9 @@ private final class TvBroadcast extends Actor {
|
|||
|
||||
case ChangeFeatured(id, msg) =>
|
||||
featuredId foreach { previous =>
|
||||
Bus.unsubscribe(self, MoveGameEvent makeSymbol previous)
|
||||
Bus.unsubscribe(self, MoveGameEvent makeChan previous)
|
||||
}
|
||||
Bus.subscribe(self, MoveGameEvent makeSymbol id)
|
||||
Bus.subscribe(self, MoveGameEvent makeChan id)
|
||||
featuredId = id.some
|
||||
channel push msg
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ final class Env(
|
|||
|
||||
def cli = new Cli
|
||||
|
||||
Bus.subscribeFun('fishnet) {
|
||||
Bus.subscribeFun("fishnet") {
|
||||
case lila.hub.actorApi.fishnet.NewKey(userId, key) =>
|
||||
automaticEmail.onFishnetKey(userId, key)(lila.i18n.defaultLang)
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ final class GarbageCollector(
|
|||
logger.debug(s"apply ${data.user.username} print=${printOpt}")
|
||||
Bus.publish(
|
||||
lila.security.Signup(user, email, req, printOpt.map(_.value), ipSusp),
|
||||
'userSignup
|
||||
"userSignup"
|
||||
)
|
||||
printOpt.map(_.value) filter printBan.blocks match {
|
||||
case Some(print) => collect(user, email, ipBan = false, msg = s"Print ban: ${print.value}")
|
||||
|
@ -104,12 +104,12 @@ final class GarbageCollector(
|
|||
private def doInitialSb(user: User): Unit =
|
||||
Bus.publish(
|
||||
lila.hub.actorApi.security.GCImmediateSb(user.id),
|
||||
'garbageCollect
|
||||
"garbageCollect"
|
||||
)
|
||||
|
||||
private def doCollect(user: User, ipBan: Boolean): Unit =
|
||||
Bus.publish(
|
||||
lila.hub.actorApi.security.GarbageCollect(user.id, ipBan),
|
||||
'garbageCollect
|
||||
"garbageCollect"
|
||||
)
|
||||
}
|
||||
|
|
|
@ -37,13 +37,13 @@ private[setup] final class Processor(
|
|||
saveConfig(_ withHook config) >> {
|
||||
config.hook(sri, ctx.me, sid, blocking) match {
|
||||
case Left(hook) => fuccess {
|
||||
Bus.publish(AddHook(hook), 'lobbyTrouper)
|
||||
Bus.publish(AddHook(hook), "lobbyTrouper")
|
||||
Created(hook.id)
|
||||
}
|
||||
case Right(Some(seek)) => ctx.userId.??(gameCache.nbPlaying) map { nbPlaying =>
|
||||
if (nbPlaying >= maxPlaying) Refused
|
||||
else {
|
||||
Bus.publish(AddSeek(seek), 'lobbyTrouper)
|
||||
Bus.publish(AddSeek(seek), "lobbyTrouper")
|
||||
Created(seek.id)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,23 +54,23 @@ final class Env(
|
|||
)
|
||||
|
||||
Bus.subscribeFuns(
|
||||
'finishGame -> {
|
||||
"finishGame" -> {
|
||||
case lila.game.actorApi.FinishGame(game, _, _) => api finishGame game
|
||||
},
|
||||
'adjustCheater -> {
|
||||
"adjustCheater" -> {
|
||||
case lila.hub.actorApi.mod.MarkCheater(userId, true) => api ejectCheater userId
|
||||
},
|
||||
'simulGetHosts -> {
|
||||
"simulGetHosts" -> {
|
||||
case lila.hub.actorApi.simul.GetHostIds(promise) => promise completeWith api.currentHostIds
|
||||
},
|
||||
'moveEventSimul -> {
|
||||
"moveEventSimul" -> {
|
||||
case lila.hub.actorApi.round.SimulMoveEvent(move, simulId, opponentUserId) =>
|
||||
Bus.publish(
|
||||
lila.hub.actorApi.socket.SendTo(
|
||||
opponentUserId,
|
||||
lila.socket.Socket.makeMessage("simulPlayerMove", move.gameId)
|
||||
),
|
||||
'socketUsers
|
||||
"socketUsers"
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
|
@ -106,7 +106,7 @@ final class SimulApi(
|
|||
}
|
||||
}
|
||||
} flatMap { s =>
|
||||
Bus.publish(Simul.OnStart(s), 'startSimul)
|
||||
Bus.publish(Simul.OnStart(s), "startSimul")
|
||||
update(s) >>- currentHostIdsCache.refresh
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ final class SimulApi(
|
|||
"name" -> simul.name
|
||||
))
|
||||
),
|
||||
'socketUsers
|
||||
"socketUsers"
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -239,10 +239,10 @@ final class SimulApi(
|
|||
private val siteMessage = SendToFlag("simul", Json.obj("t" -> "reload"))
|
||||
private val debouncer = system.actorOf(Props(new Debouncer(5 seconds, {
|
||||
(_: Debouncer.Nothing) =>
|
||||
Bus.publish(siteMessage, 'sendToFlag)
|
||||
Bus.publish(siteMessage, "sendToFlag")
|
||||
repo.allCreated foreach { simuls =>
|
||||
renderer ? actorApi.SimulTable(simuls) map {
|
||||
case view: String => Bus.publish(ReloadSimuls(view), 'lobbySocket)
|
||||
case view: String => Bus.publish(ReloadSimuls(view), "lobbySocket")
|
||||
}
|
||||
}
|
||||
})))
|
||||
|
|
|
@ -27,7 +27,7 @@ final class Env(
|
|||
defaultChannel = IncomingDefaultChannel
|
||||
)
|
||||
|
||||
lila.common.Bus.subscribeFun('deploy, 'slack, 'plan, 'userNote) {
|
||||
lila.common.Bus.subscribeFun("deploy", "slack", "plan", "userNote") {
|
||||
case d: ChargeEvent => api charge d
|
||||
case DeployPre => api.deployPre
|
||||
case DeployPost => api.deployPost
|
||||
|
|
|
@ -40,10 +40,10 @@ case class AnaDrop(
|
|||
}
|
||||
}
|
||||
|
||||
def json(b: Branch): JsObject = Json.obj(
|
||||
"node" -> b,
|
||||
"path" -> path
|
||||
).add("ch" -> chapterId)
|
||||
// def json(b: Branch): JsObject = Json.obj(
|
||||
// "node" -> b,
|
||||
// "path" -> path
|
||||
// ).add("ch" -> chapterId)
|
||||
}
|
||||
|
||||
object AnaDrop {
|
||||
|
|
|
@ -8,10 +8,11 @@ import scalaz.Validation.FlatMap._
|
|||
|
||||
import lila.tree.Branch
|
||||
|
||||
// #TODO remove?
|
||||
trait AnaAny {
|
||||
|
||||
def branch: Valid[Branch]
|
||||
def json(b: Branch): JsObject
|
||||
// def json(b: Branch): JsObject
|
||||
def chapterId: Option[String]
|
||||
def path: String
|
||||
}
|
||||
|
@ -48,10 +49,10 @@ case class AnaMove(
|
|||
}
|
||||
}
|
||||
|
||||
def json(b: Branch): JsObject = Json.obj(
|
||||
"node" -> b,
|
||||
"path" -> path
|
||||
).add("ch" -> chapterId)
|
||||
// def json(b: Branch): JsObject = Json.obj(
|
||||
// "node" -> b,
|
||||
// "path" -> path
|
||||
// ).add("ch" -> chapterId)
|
||||
}
|
||||
|
||||
object AnaMove {
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
package lila.socket
|
||||
|
||||
import akka.actor._
|
||||
import com.typesafe.config.Config
|
||||
import play.api.Configuration
|
||||
import io.lettuce.core._
|
||||
import scala.concurrent.duration._
|
||||
|
||||
final class Env(
|
||||
config: Config,
|
||||
appConfig: Configuration,
|
||||
lifecycle: play.api.inject.ApplicationLifecycle,
|
||||
hub: lila.hub.Env
|
||||
) {
|
||||
|
||||
private val RedisUri = config getString "redis.uri"
|
||||
private val RedisUri = appConfig.get[String]("socket.redis.uri")
|
||||
|
||||
val remoteSocket = new RemoteSocket(
|
||||
redisClient = RedisClient create RedisURI.create(RedisUri),
|
||||
|
@ -24,12 +22,3 @@ final class Env(
|
|||
|
||||
val isOnline: String => Boolean = userId => onlineUserIds() contains userId
|
||||
}
|
||||
|
||||
object Env {
|
||||
|
||||
lazy val current = "socket" boot new Env(
|
||||
config = lila.common.PlayApp loadConfig "socket",
|
||||
lifecycle = lila.common.PlayApp.lifecycle,
|
||||
hub = lila.hub.Env.current
|
||||
)
|
||||
}
|
||||
|
|
|
@ -49,14 +49,14 @@ final class RemoteSocket(
|
|||
onlineUserIds.getAndUpdate((x: UserIds) => x -- userIds)
|
||||
case In.NotifiedBatch(userIds) => notificationActor ! lila.hub.actorApi.notify.NotifiedBatch(userIds)
|
||||
case In.FriendsBatch(userIds) => userIds foreach { userId =>
|
||||
Bus.publish(ReloadOnlineFriends(userId), 'reloadOnlineFriends)
|
||||
Bus.publish(ReloadOnlineFriends(userId), "reloadOnlineFriends")
|
||||
}
|
||||
case In.Lags(lags) =>
|
||||
lags foreach (UserLagCache.put _).tupled
|
||||
// this shouldn't be necessary... ensure that users are known to be online
|
||||
onlineUserIds.getAndUpdate((x: UserIds) => x ++ lags.keys)
|
||||
case In.TellSri(sri, userId, typ, msg) =>
|
||||
Bus.publish(TellSriIn(sri.value, userId, msg), Symbol(s"remoteSocketIn:$typ"))
|
||||
Bus.publish(TellSriIn(sri.value, userId, msg), s"remoteSocketIn:$typ")
|
||||
case In.WsBoot =>
|
||||
logger.warn("Remote socket boot")
|
||||
onlineUserIds set Set("lichess")
|
||||
|
@ -67,7 +67,7 @@ final class RemoteSocket(
|
|||
})
|
||||
}
|
||||
|
||||
Bus.subscribeFun('socketUsers, 'deploy, 'announce, 'mlat, 'sendToFlag, 'remoteSocketOut, 'accountClose, 'shadowban, 'impersonate, 'botIsOnline) {
|
||||
Bus.subscribeFun("socketUsers", "deploy", "announce", "mlat", "sendToFlag", "remoteSocketOut", "accountClose", "shadowban", "impersonate", "botIsOnline") {
|
||||
case SendTos(userIds, payload) =>
|
||||
val connectedUsers = userIds intersect onlineUserIds.get
|
||||
if (connectedUsers.nonEmpty) send(Out.tellUsers(connectedUsers, payload))
|
||||
|
|
|
@ -66,7 +66,7 @@ final class Env(
|
|||
|
||||
lazy val liveStreamApi = new LiveStreamApi(asyncCache, streamingActor)
|
||||
|
||||
lila.common.Bus.subscribeFun('adjustCheater) {
|
||||
lila.common.Bus.subscribeFun("adjustCheater") {
|
||||
case lila.hub.actorApi.mod.MarkCheater(userId, true) => api demote userId
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ private final class Streaming(
|
|||
if (newStreams != liveStreams) {
|
||||
renderer ? newStreams.autoFeatured.withTitles(lightUserApi) foreach {
|
||||
case html: String =>
|
||||
Bus.publish(lila.hub.actorApi.streamer.StreamsOnAir(html), 'streams)
|
||||
Bus.publish(lila.hub.actorApi.streamer.StreamsOnAir(html), "streams")
|
||||
}
|
||||
newStreams.streams filterNot { s =>
|
||||
liveStreams has s.streamer
|
||||
|
@ -75,7 +75,7 @@ private final class Streaming(
|
|||
}
|
||||
Bus.publish(
|
||||
lila.hub.actorApi.streamer.StreamStart(s.streamer.userId),
|
||||
'streamStart
|
||||
"streamStart"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ final class Env(
|
|||
}
|
||||
}
|
||||
|
||||
lila.common.Bus.subscribeFun('gdprErase, 'studyAnalysisProgress) {
|
||||
lila.common.Bus.subscribeFun("gdprErase", "studyAnalysisProgress") {
|
||||
case lila.user.User.GDPRErase(user) => api erase user
|
||||
case lila.analyse.actorApi.StudyAnalysisProgress(analysis, complete) => serverEvalMerger(analysis, complete)
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ final class StudyApi(
|
|||
} orElse importGame(data.copy(form = data.form.copy(asStr = none)), user)
|
||||
}) addEffect {
|
||||
_ ?? { sc =>
|
||||
Bus.publish(actorApi.StartStudy(sc.study.id), 'startStudy)
|
||||
Bus.publish(actorApi.StartStudy(sc.study.id), "startStudy")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,9 +305,9 @@ final class StudyApi(
|
|||
val role = StudyMember.Role.byId.getOrElse(roleStr, StudyMember.Role.Read)
|
||||
study.members.get(userId) ifTrue study.isPublic foreach { member =>
|
||||
if (!member.role.canWrite && role.canWrite)
|
||||
Bus.publish(lila.hub.actorApi.study.StudyMemberGotWriteAccess(userId, studyId.value), 'study)
|
||||
Bus.publish(lila.hub.actorApi.study.StudyMemberGotWriteAccess(userId, studyId.value), "study")
|
||||
else if (member.role.canWrite && !role.canWrite)
|
||||
Bus.publish(lila.hub.actorApi.study.StudyMemberLostWriteAccess(userId, studyId.value), 'study)
|
||||
Bus.publish(lila.hub.actorApi.study.StudyMemberLostWriteAccess(userId, studyId.value), "study")
|
||||
}
|
||||
studyRepo.setRole(study, userId, role) >>-
|
||||
onMembersChange(study)
|
||||
|
@ -324,7 +324,7 @@ final class StudyApi(
|
|||
def kick(studyId: Study.Id, userId: User.ID)(who: Who) = sequenceStudy(studyId) { study =>
|
||||
(study.isMember(userId) && (study.isOwner(who.u) ^ (who.u == userId))) ?? {
|
||||
if (study.isPublic && study.canContribute(userId))
|
||||
Bus.publish(lila.hub.actorApi.study.StudyMemberLostWriteAccess(userId, studyId.value), 'study)
|
||||
Bus.publish(lila.hub.actorApi.study.StudyMemberLostWriteAccess(userId, studyId.value), "study")
|
||||
studyRepo.removeMember(study, userId)
|
||||
} >>- onMembersChange(study)
|
||||
}
|
||||
|
@ -659,9 +659,9 @@ final class StudyApi(
|
|||
}
|
||||
)
|
||||
if (!study.isPublic && newStudy.isPublic) {
|
||||
Bus.publish(lila.hub.actorApi.study.StudyBecamePublic(studyId.value, study.members.contributorIds), 'study)
|
||||
Bus.publish(lila.hub.actorApi.study.StudyBecamePublic(studyId.value, study.members.contributorIds), "study")
|
||||
} else if (study.isPublic && !newStudy.isPublic) {
|
||||
Bus.publish(lila.hub.actorApi.study.StudyBecamePrivate(studyId.value, study.members.contributorIds), 'study)
|
||||
Bus.publish(lila.hub.actorApi.study.StudyBecamePrivate(studyId.value, study.members.contributorIds), "study")
|
||||
}
|
||||
(newStudy != study) ?? {
|
||||
studyRepo.updateSomeFields(newStudy) >>-
|
||||
|
@ -675,14 +675,14 @@ final class StudyApi(
|
|||
def delete(study: Study) = sequenceStudy(study.id) { study =>
|
||||
studyRepo.delete(study) >>
|
||||
chapterRepo.deleteByStudy(study) >>-
|
||||
Bus.publish(lila.hub.actorApi.study.RemoveStudy(study.id.value, study.members.contributorIds), 'study) >>-
|
||||
Bus.publish(lila.hub.actorApi.study.RemoveStudy(study.id.value, study.members.contributorIds), "study") >>-
|
||||
lightStudyCache.put(study.id, none)
|
||||
}
|
||||
|
||||
def like(studyId: Study.Id, v: Boolean)(who: Who): Funit =
|
||||
studyRepo.like(studyId, who.u, v) map { likes =>
|
||||
sendTo(studyId)(_.setLiking(Study.Liking(likes, v), who))
|
||||
Bus.publish(actorApi.StudyLikes(studyId, likes), 'studyLikes)
|
||||
Bus.publish(actorApi.StudyLikes(studyId, likes), "studyLikes")
|
||||
if (v) studyRepo byId studyId foreach {
|
||||
_ foreach { study =>
|
||||
if (who.u != study.ownerId && study.isPublic)
|
||||
|
@ -732,11 +732,11 @@ final class StudyApi(
|
|||
public = study.isPublic,
|
||||
enters = true
|
||||
),
|
||||
'study
|
||||
"study"
|
||||
)
|
||||
|
||||
private def indexStudy(study: Study) =
|
||||
Bus.publish(actorApi.SaveStudy(study), 'study)
|
||||
Bus.publish(actorApi.SaveStudy(study), "study")
|
||||
|
||||
private def reloadSriBecauseOf(study: Study, sri: Sri, chapterId: Chapter.Id) =
|
||||
sendTo(study.id)(_.reloadSriBecauseOf(sri, chapterId))
|
||||
|
|
|
@ -164,7 +164,7 @@ private final class StudySocket(
|
|||
onError = err => send(P.Out.tellSri(w.sri, makeMessage("error", err))))
|
||||
}
|
||||
case "relaySync" => who foreach { w =>
|
||||
Bus.publish(actorApi.RelayToggle(studyId, ~(o \ "d").asOpt[Boolean], w), 'relayToggle)
|
||||
Bus.publish(actorApi.RelayToggle(studyId, ~(o \ "d").asOpt[Boolean], w), "relayToggle")
|
||||
}
|
||||
case t => logger.warn(s"Unhandled study socket message: $t")
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ private final class StudySocket(
|
|||
contributor = study contributors userId,
|
||||
public = study.isPublic,
|
||||
enters = through.isRight
|
||||
), 'study)
|
||||
), "study")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ final class Env(
|
|||
}
|
||||
}
|
||||
|
||||
Bus.subscribeFun('study) {
|
||||
Bus.subscribeFun("study") {
|
||||
case lila.study.actorApi.SaveStudy(study) => api store study
|
||||
case RemoveStudy(id, _) => client deleteById Id(id)
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ final class Env(
|
|||
|
||||
private lazy val notifier = new Notifier(notifyApi = notifyApi)
|
||||
|
||||
lila.common.Bus.subscribeFun('shadowban) {
|
||||
lila.common.Bus.subscribeFun("shadowban") {
|
||||
case lila.hub.actorApi.mod.Shadowban(userId, true) => api deleteRequestsByUserId userId
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ final class TeamApi(
|
|||
timeline ! Propagate(
|
||||
TeamCreate(me.id, team.id)
|
||||
).toFollowersOf(me.id)
|
||||
Bus.publish(CreateTeam(id = team.id, name = team.name, userId = me.id), 'team)
|
||||
Bus.publish(CreateTeam(id = team.id, name = team.name, userId = me.id), "team")
|
||||
} inject team
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ final class TeamApi(
|
|||
TeamRepo.incMembers(team.id, +1) >>- {
|
||||
cached invalidateTeamIds user.id
|
||||
timeline ! Propagate(TeamJoin(user.id, team.id)).toFollowersOf(user.id)
|
||||
Bus.publish(JoinTeam(id = team.id, userId = user.id), 'team)
|
||||
Bus.publish(JoinTeam(id = team.id, userId = user.id), "team")
|
||||
}
|
||||
} recover lila.db.recoverDuplicateKey(_ => ())
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ final class Env(
|
|||
}
|
||||
}
|
||||
|
||||
lila.common.Bus.subscribeFun('shadowban) {
|
||||
lila.common.Bus.subscribeFun("shadowban") {
|
||||
case lila.hub.actorApi.mod.Shadowban(userId, true) => entryApi removeRecentFollowsBy userId
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ private[timeline] final class Push(
|
|||
unsubApi.filterUnsub(data.channel, users)
|
||||
} foreach { users =>
|
||||
if (users.nonEmpty) makeEntry(users, data) >>-
|
||||
lila.common.Bus.publish(ReloadTimelines(users), 'lobbySocket)
|
||||
lila.common.Bus.publish(ReloadTimelines(users), "lobbySocket")
|
||||
lila.mon.timeline.notification(users.size)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ final class Env(
|
|||
|
||||
lila.common.Bus.subscribe(
|
||||
system.actorOf(Props(new ApiActor(api, leaderboardApi)), name = ApiActorName),
|
||||
'finishGame, 'adjustCheater, 'adjustBooster, 'playban
|
||||
"finishGame", "adjustCheater", "adjustBooster", "playban"
|
||||
)
|
||||
|
||||
system.actorOf(Props(new CreatedOrganizer(
|
||||
|
|
|
@ -69,7 +69,7 @@ final class TournamentApi(
|
|||
}
|
||||
}
|
||||
if (tour.name != me.titleUsername && lila.common.LameName.anyNameButLichessIsOk(tour.name))
|
||||
Bus.publish(lila.hub.actorApi.slack.TournamentName(me.username, tour.id, tour.name), 'slack)
|
||||
Bus.publish(lila.hub.actorApi.slack.TournamentName(me.username, tour.id, tour.name), "slack")
|
||||
logger.info(s"Create $tour")
|
||||
TournamentRepo.insert(tour) >>- join(tour.id, me, tour.password, setup.teamBattleByTeam, getUserTeamIds, none) inject tour
|
||||
}
|
||||
|
@ -533,12 +533,12 @@ final class TournamentApi(
|
|||
fetchVisibleTournaments flatMap apiJsonView.apply foreach { json =>
|
||||
Bus.publish(
|
||||
SendToFlag("tournament", Json.obj("t" -> "reload", "d" -> json)),
|
||||
'sendToFlag
|
||||
"sendToFlag"
|
||||
)
|
||||
}
|
||||
TournamentRepo.promotable foreach { tours =>
|
||||
renderer ? Tournament.TournamentTable(tours) map {
|
||||
case view: String => Bus.publish(ReloadTournaments(view), 'lobbySocket)
|
||||
case view: String => Bus.publish(ReloadTournaments(view), "lobbySocket")
|
||||
}
|
||||
}
|
||||
})))
|
||||
|
@ -560,7 +560,7 @@ final class TournamentApi(
|
|||
if (lastHash != top.hashCode) {
|
||||
Bus.publish(
|
||||
lila.hub.actorApi.round.TourStanding(tourId, JsonView.top(top, lightUserApi.sync)),
|
||||
'tourStanding
|
||||
"tourStanding"
|
||||
)
|
||||
lastPublished.put(tourId, top.hashCode)
|
||||
}
|
||||
|
|
|
@ -20,6 +20,6 @@ private final class TournamentReminder {
|
|||
"id" -> tour.id,
|
||||
"name" -> tour.fullName
|
||||
)
|
||||
)), 'socketUsers)
|
||||
)), "socketUsers")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ private[tv] final class TvTrouper(
|
|||
|
||||
import TvTrouper._
|
||||
|
||||
Bus.subscribe(this, 'startGame)
|
||||
Bus.subscribe(this, "startGame")
|
||||
|
||||
private val channelTroupers: Map[Tv.Channel, ChannelTrouper] = Tv.Channel.all.map { c =>
|
||||
c -> new ChannelTrouper(c, lightUser, onSelect = this.!, proxyGame, rematchOf)
|
||||
|
@ -74,7 +74,7 @@ private[tv] final class TvTrouper(
|
|||
)
|
||||
}
|
||||
)
|
||||
Bus.publish(lila.hub.actorApi.tv.TvSelect(game.id, game.speed, data), 'tvSelect)
|
||||
Bus.publish(lila.hub.actorApi.tv.TvSelect(game.id, game.speed, data), "tvSelect")
|
||||
if (channel == Tv.Channel.Best) {
|
||||
implicit def timeout = makeTimeout(100 millis)
|
||||
actorAsk(rendererActor, actorApi.RenderFeaturedJs(game)) onSuccess {
|
||||
|
@ -87,7 +87,7 @@ private[tv] final class TvTrouper(
|
|||
"id" -> game.id
|
||||
))
|
||||
)
|
||||
Bus.publish(event, 'changeFeaturedGame)
|
||||
Bus.publish(event, "changeFeaturedGame")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,18 +52,18 @@ final class Env(
|
|||
}
|
||||
|
||||
lila.common.Bus.subscribeFuns(
|
||||
'adjustCheater -> {
|
||||
"adjustCheater" -> {
|
||||
case lila.hub.actorApi.mod.MarkCheater(userId, true) =>
|
||||
rankingApi remove userId
|
||||
UserRepo.setRoles(userId, Nil)
|
||||
},
|
||||
'adjustBooster -> {
|
||||
"adjustBooster" -> {
|
||||
case lila.hub.actorApi.mod.MarkBooster(userId) => rankingApi remove userId
|
||||
},
|
||||
'kickFromRankings -> {
|
||||
"kickFromRankings" -> {
|
||||
case lila.hub.actorApi.mod.KickFromRankings(userId) => rankingApi remove userId
|
||||
},
|
||||
'gdprErase -> {
|
||||
"gdprErase" -> {
|
||||
case User.GDPRErase(user) =>
|
||||
UserRepo erase user
|
||||
noteApi erase user
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue