Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Improves password required interface and disables the padlock for participants.
Yana Stamcheva9c0e924b1330
diff --git a/app.js b/app.jsindex b63ad3c289..60213a54eb 100644--- a/app.js+++ b/app.js@@ -188,6 +188,9 @@ $(document).bind('entered.muc', function (event, jid, info) {focus.addNewParticipant(jid);}}+ else if (sharedKey) {+ updateLockButton();+ }});$(document).bind('left.muc', function (event, jid) {@@ -208,6 +211,33 @@ $(document).bind('left.muc', function (event, jid) {}});+$(document).bind('passwordrequired.muc', function (event, jid) {+ console.log('on password required', jid);++ $.prompt('<h2>Password required</h2>' ++ '<input id="lockKey" type="text" placeholder="shared key" autofocus>',+ {+ persistent: true,+ buttons: { "Ok": true , "Cancel": false},+ defaultButton: 1,+ loaded: function(event) {+ document.getElementById('lockKey').focus();+ },+ submit: function(e,v,m,f){+ if(v)+ {+ var lockKey = document.getElementById('lockKey');++ if (lockKey.value != null)+ {+ setSharedKey(lockKey);+ connection.emuc.doJoin(jid, lockKey.value);+ }+ }+ }+ });+});+function toggleVideo() {if (!(connection && connection.jingle.localStream)) return;for (var idx = 0; idx < connection.jingle.localStream.getVideoTracks().length; idx++) {@@ -357,44 +387,62 @@ function buttonClick(id, classname) {* Opens the lock room dialog.*/function openLockDialog() {- if (sharedKey)- $.prompt("Are you sure you would like to remove your secret key?",- {- title: "Remove secrect key",- persistent: false,- buttons: { "Remove": true, "Cancel": false},- defaultButton: 1,- submit: function(e,v,m,f){- if(v)- {- sharedKey = '';- lockRoom();- }- }- });- else- $.prompt('<h2>Set a secrect key to lock your room</h2>' +- '<input id="lockKey" type="text" placeholder="your shared key" autofocus>',- {- persistent: false,- buttons: { "Save": true , "Cancel": false},- defaultButton: 1,- loaded: function(event) {- document.getElementById('lockKey').focus();- },- submit: function(e,v,m,f){- if(v)- {- var lockKey = document.getElementById('lockKey');-- if (lockKey.value != null)- {- sharedKey = lockKey.value;+ // Only the focus is able to set a shared key.+ if (focus == null) {+ if (sharedKey)+ $.prompt("This conversation is currently protected by a shared secret key.",+ {+ title: "Secrect key",+ persistent: false+ });+ else+ $.prompt("This conversation isn't currently protected by a secret key. Only the owner of the conference could set a shared key.",+ {+ title: "Secrect key",+ persistent: false+ });+ }+ else {+ if (sharedKey)+ $.prompt("Are you sure you would like to remove your secret key?",+ {+ title: "Remove secrect key",+ persistent: false,+ buttons: { "Remove": true, "Cancel": false},+ defaultButton: 1,+ submit: function(e,v,m,f){+ if(v)+ {+ setSharedKey('');+ lockRoom();+ }+ }+ });+ else+ $.prompt('<h2>Set a secrect key to lock your room</h2>' ++ '<input id="lockKey" type="text" placeholder="your shared key" autofocus>',+ {+ persistent: false,+ buttons: { "Save": true , "Cancel": false},+ defaultButton: 1,+ loaded: function(event) {+ document.getElementById('lockKey').focus();+ },+ submit: function(e,v,m,f){+ if(v)+ {+ var lockKey = document.getElementById('lockKey');++ if (lockKey.value)+ {+ console.log("LOCK KEY", lockKey.value);+ setSharedKey(lockKey.value);lockRoom(true);- }+ }}}});+ }}/*@@ -418,6 +466,20 @@ function openLinkDialog() {function lockRoom(lock) {connection.emuc.lockRoom(sharedKey);+ updateLockButton();+}++/*+ * Sets the shared key.+ */+function setSharedKey(sKey) {+ sharedKey = sKey;+}++/*+ * Updates the lock button state.+ */+function updateLockButton() {buttonClick("#lockIcon", "fa fa-unlock fa-lg fa fa-lock fa-lg");}diff --git a/muc.js b/muc.jsindex ccb55dfffc..86048f6703 100644--- a/muc.js+++ b/muc.js@@ -75,18 +75,6 @@ Strophe.addConnectionPlugin('emuc', {var from = pres.getAttribute('from');if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {$(document).trigger('passwordrequired.muc', [from]);-- // FIXME: remove once moved to passwordrequired which should reuse dojoin- var ob = this;- window.setTimeout(function () {- var given = window.prompt('Password required');- if (given != null) {- // FIXME: reuse doJoin?- ob.connection.send($pres({to: ob.myroomjid }).c('x', {xmlns: 'http://jabber.org/protocol/muc'}).c('password').t(given));- } else {- // user aborted- }- }, 50);} else {console.warn('onPresError ', pres);}