diff --git a/modules/round/src/main/SocketHandler.scala b/modules/round/src/main/SocketHandler.scala index 752c6edac7..86b508c296 100644 --- a/modules/round/src/main/SocketHandler.scala +++ b/modules/round/src/main/SocketHandler.scala @@ -44,7 +44,7 @@ private[round] final class SocketHandler( member.playerIdOption.fold[Handler.Controller]({ case ("p", o) ⇒ o int "v" foreach { v ⇒ socket ! PingVersion(uid, v) } case ("talk", o) ⇒ watcherTalk(ref.gameId, o) - case ("talk-tv", o) ⇒ watcherTalk("tv", o) + case ("talk-tv", o) ⇒ if (member.isAuth) watcherTalk("tv", o) }) { playerId ⇒ { case ("p", o) ⇒ o int "v" foreach { v ⇒ socket ! PingVersion(uid, v) } diff --git a/modules/socket/src/main/SocketMember.scala b/modules/socket/src/main/SocketMember.scala index b44caa7d75..c7f2c02a59 100644 --- a/modules/socket/src/main/SocketMember.scala +++ b/modules/socket/src/main/SocketMember.scala @@ -10,6 +10,8 @@ trait SocketMember { def liveGames: Set[String] = privateLiveGames.toSet def addLiveGames(ids: List[String]) { ids foreach privateLiveGames.+= } + + def isAuth = userId.isDefined } object SocketMember { diff --git a/public/javascripts/big.js b/public/javascripts/big.js index 2328e0e448..dd73f0a119 100644 --- a/public/javascripts/big.js +++ b/public/javascripts/big.js @@ -799,8 +799,10 @@ var storage = { self.initSquaresAndPieces(); self.initTable(); self.initClocks(); - if (self.$chat) self.$chat.chat({ + if (self.$chat) { + self.$chat.chat({ talkMessageType: self.options.tv ? 'talk-tv' : 'talk', + secure: self.options.tv, resize: true, render: function(u, t) { if (self.options.player.spectator) { @@ -813,6 +815,7 @@ var storage = { lichess.socket.send("toggle-chat", enabled); }, 5000) }); + } self.$watchers.watchers(); if (self.isMyTurn() && self.options.game.turns == 0) { self.element.one('lichess.audio_ready', function() { @@ -1499,6 +1502,7 @@ var storage = { // render: function(u, t) {}, onToggle: function(enabled) {}, talkMessageType: 'talk', + secure: false, resize: false }, this.options); var self = this; @@ -1520,6 +1524,10 @@ var storage = { alert('Max length: 140 chars. ' + text.length + ' chars used.'); return false; } + if (self.options.secure && !$('#user_tag').length) { + if (confirm($.trans('You need an account to do that'))) location.href = '/signup'; + return false; + } $input.val(''); lichess.socket.send(self.options.talkMessageType, text); return false; diff --git a/todo b/todo index 41eb8dbf7b..12b7ab7ad6 100644 --- a/todo +++ b/todo @@ -57,6 +57,7 @@ realtime computer analysis of TV game show user win stats on TV page embeddable tv iframe http://en.lichess.org/forum/lichess-feedback/new-feature-lichess-tv?page=3 many tv ideas (answer) http://en.lichess.org/forum/lichess-feedback/new-feature-lichess-tv?page=3 +disable tv chat for anon DB --