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
Makes "authentication required" dialog persistent. Joins the room if someone else authenticates first and creates the conference for us.
paweldomascd0c9393d84a
diff --git a/app.js b/app.jsindex fd3d154f4f..27aa28cb24 100644--- a/app.js+++ b/app.js@@ -2,7 +2,12 @@/* application specific logic */var connection = null;var authenticatedUser = false;+/* Popup window that show login page */var authenticationWindow = null;+/* Initial "authentication required" dialog */+var authDialog = null;+/* Loop retry ID that wits for other user to create the room */+var authRetryId = null;var activecall = null;var nickname = null;var sharedKey = '';@@ -187,6 +192,17 @@ function doJoin() {function doJoinAfterFocus() {+ // Close authentication dialog if opened+ if (authDialog) {+ messageHandler.closeDialog();+ authDialog = null;+ }+ // Clear retry interval, so that we don't call 'doJoinAfterFocus' twice+ if (authRetryId) {+ window.clearTimeout(authRetryId);+ authRetryId = null;+ }+var roomjid;roomjid = roomName;@@ -879,38 +895,62 @@ $(document).bind('passwordrequired.main', function (event) {});$(document).bind('auth_required.moderator', function () {++ // This is the loop that will wait for the room to be created by+ // someone else. 'auth_required.moderator' will bring us back here.+ authRetryId = window.setTimeout(+ function () {+ Moderator.allocateConferenceFocus(roomName, doJoinAfterFocus);+ }, 5000);+ // Show prompt only if it's not open+ if (authDialog !== null) {+ return;+ }// extract room name from '[email protected]'var room = roomName.substr(0, roomName.indexOf('@'));- messageHandler.openDialog(+ authDialog = messageHandler.openDialog('Stop',- 'Authentication is required to create room:<br/>' + room,+ 'Authentication is required to create room:<br/><b>' + room ++ '</b></br> You can either authenticate to create the room or ' ++ 'just wait for someone else to do so.',true,{- Authenticate: 'authNow',- Close: 'close'+ Authenticate: 'authNow'},function (onSubmitEvent, submitValue) {- console.info('On submit: ' + submitValue, submitValue);++ // Do not close the dialog yet+ onSubmitEvent.preventDefault();++ // Open login popupif (submitValue === 'authNow') {authenticateClicked();- } else {- Toolbar.showAuthenticateButton(true);}});});function authenticateClicked() {+ // If auth window exists just bring it to the front+ if (authenticationWindow) {+ authenticationWindow.focus();+ return;+ }// Get authentication URLModerator.getAuthUrl(function (url) {// Open popup with authentication URLauthenticationWindow = messageHandler.openCenteredPopup(url, 910, 660,+ // On closedfunction () {+ // Close authentication dialog if opened+ if (authDialog) {+ messageHandler.closeDialog();+ authDialog = null;+ }// On popup closed - retry room allocation- Moderator.allocateConferenceFocus(- roomName, doJoinAfterFocus);+ Moderator.allocateConferenceFocus(roomName, doJoinAfterFocus);authenticationWindow = null;});if (!authenticationWindow) {@@ -1587,21 +1627,15 @@ function hangup() {}- $.prompt("Session Terminated",+ messageHandler.openDialog(+ "Session Terminated",+ "You hung up the call",+ true,+ { "Join again": true },+ function(event, value, message, formVals){- title: "You hung up the call",- persistent: true,- buttons: {- "Join again": true- },- closeText: '',- submit: function(event, value, message, formVals)- {- window.location.reload();- return false;- }-+ window.location.reload();+ return false;});-}diff --git a/message_handler.js b/message_handler.jsindex 39c8987486..ee2e3848ba 100644--- a/message_handler.js+++ b/message_handler.js@@ -1,3 +1,4 @@+/* global $, jQuery */var messageHandler = (function(my) {/**@@ -53,15 +54,27 @@ var messageHandler = (function(my) {* @param submitFunction function to be called on submit* @param loadedFunction function to be called after the prompt is fully loaded*/- my.openDialog = function(titleString, msgString, persistent, buttons, submitFunction, loadedFunction) {- $.prompt(msgString, {+ my.openDialog = function (titleString, msgString, persistent, buttons,+ submitFunction, loadedFunction) {+ var args = {title: titleString,- persistent: false,+ persistent: persistent,buttons: buttons,defaultButton: 1,loaded: loadedFunction,submit: submitFunction- });+ };+ if (persistent) {+ args.closeText = '';+ }+ return $.prompt(msgString, args);+ };++ /**+ * Closes currently opened dialog.+ */+ my.closeDialog = function () {+ $.prompt.close();};/**