diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 8cb195d..b0f05b2 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -1463,13 +1463,6 @@ const app = Vue.createApp({ this.ChatClient("Couldn't open video by username: not found."); }, openVideo(user, force) { - // Debounce so we don't spam too much for the same user. - if (this.WebRTC.debounceOpens[user.username]) return; - this.WebRTC.debounceOpens[user.username] = true; - setTimeout(() => { - delete(this.WebRTC.debounceOpens[user.username]); - }, 5000); - if (user.username === this.username) { this.ChatClient("You can already see your own webcam."); return; @@ -1493,6 +1486,13 @@ const app = Vue.createApp({ localStorage["skip-nsfw-modal"] = "true"; } + // Debounce so we don't spam too much for the same user. + if (this.WebRTC.debounceOpens[user.username]) return; + this.WebRTC.debounceOpens[user.username] = true; + setTimeout(() => { + delete(this.WebRTC.debounceOpens[user.username]); + }, 5000); + // Camera is already open? Then disconnect the connection. if (this.WebRTC.pc[user.username] != undefined && this.WebRTC.pc[user.username].offerer != undefined) { this.closeVideo(user.username, "offerer");