diff --git a/pkg/handlers.go b/pkg/handlers.go index 0b37bca..0fa73c2 100644 --- a/pkg/handlers.go +++ b/pkg/handlers.go @@ -551,15 +551,6 @@ func (s *Server) OnOpen(sub *Subscriber, msg messages.Message) { secret := util.RandomString(16) log.Info("WebRTC: %s opens %s with secret %s", sub.Username, other.Username, secret) - // If the current user is an admin and was booted or muted, inform them. - if sub.IsAdmin() { - if other.Boots(sub.Username) { - sub.ChatServer("Note: %s had booted you off their camera before, and won't be notified of your watch.", other.Username) - } else if other.Mutes(sub.Username) { - sub.ChatServer("Note: %s had muted you before, and won't be notified of your watch.", other.Username) - } - } - // Ring the target of this request and give them the secret. other.SendJSON(messages.Message{ Action: messages.ActionRing, diff --git a/src/App.vue b/src/App.vue index fe1da70..38e7f18 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1735,13 +1735,6 @@ export default { }, pushHistory({ channel, username, message, action = "message", isChatServer, isChatClient, messageID, timestamp = null, unshift = false }) { - // Ignore possibly-confusing ChatServer messages sent to admins. - // TODO: add a 'super-admin' tier separately to operator that still sees these. - if (isChatServer && (message.match(/ has booted you off of their camera!$/) || message.match(/ had booted you off their camera before, and won't be notified of your watch.$/))) { - // Redirect it to the debug log channel. - channel = DebugChannelID; - } - // Default channel = your current channel. if (!channel) { channel = this.channel; diff --git a/src/lib/WebRTC.js b/src/lib/WebRTC.js index ba8e784..a20803d 100644 --- a/src/lib/WebRTC.js +++ b/src/lib/WebRTC.js @@ -657,9 +657,6 @@ class WebRTCController { }).catch(this.DebugChannel); }, onWatch(msg) { - // The user has our video feed open now. - if (this.isBootedAdmin(msg.username)) return; - // Notify in chat if this was the first watch (viewer may send multiple per each track they received) if (this.prefs.watchNotif && this.webcam.watching[msg.username] != true) { this.ChatServer( @@ -1471,19 +1468,38 @@ class WebRTCController { // Check if they are currently rate limited from pre-emptive boots of folks // who are not even watching their camera yet. if (this.rateLimitPreemptiveBoots(username, false)) return; + + // Get the target user. + const user = this.getUser(username); + + // The dialog message, which varies if the booted user is an admin. + let message = `Kick ${username} off your camera? `; + if (user.op) { + message += "Note: chat operators will be able to reopen your webcam." + } else { + message += `This will also prevent them from seeing that your camera `+ + ` is active for the remainder of your chat session.` + } // Boot them off our webcam. this.modalConfirm({ title: "Boot user", icon: "fa fa-user-xmark", - message: `Kick ${username} off your camera? This will also prevent them ` + - `from seeing that your camera is active for the remainder of your ` + - `chat session.` + message: message, }).then(() => { // Ping their rate limiter. if (this.rateLimitPreemptiveBoots(username, true)) return; this.doBootUser(username); + + if (user.op) { + this.ChatClient( + `You have booted ${username} ` + + `off your camera. Note: Chat operators ` + + `will be able to reopen your webcam.`, + ); + return; + } this.ChatClient( `You have booted ${username} off your camera. They will no longer be able ` + @@ -1509,6 +1525,12 @@ class WebRTCController { delete (this.webcam.watching[username]); }, isBooted(username) { + + // Admins never count as booted. + if (this.isBootedAdmin(username)) { + return false; + } + return this.WebRTC.booted[username] === true; }, isBootedAdmin(username) {