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
ref(ConferenceUrl): converts to class and binds instance to global APP
paweldomas8f8b1385fa23
diff --git a/app.js b/app.jsindex cdf8abb572..2b6e219823 100644--- a/app.js+++ b/app.js@@ -19,12 +19,12 @@ import 'aui-experimental-css';window.toastr = require("toastr");import URLProcessor from "./modules/config/URLProcessor";-import ConferenceUrl from './modules/URL/ConferenceUrl';import RoomnameGenerator from './modules/util/RoomnameGenerator';import UI from "./modules/UI/UI";import settings from "./modules/settings/Settings";import conference from './conference';+import ConferenceUrl from './modules/URL/ConferenceUrl';import API from './modules/API/API';import UIEvents from './service/UI/UIEvents';@@ -95,6 +95,12 @@ const APP = {UI,settings,conference,+ /**+ * After the APP has been initialized provides utility methods for dealing+ * with the conference room URL(address).+ * @type ConferenceUrl+ */+ ConferenceUrl : null,connection: null,API,init () {@@ -121,9 +127,9 @@ function setTokenData() {function init() {setTokenData();// Initialize the conference URL handler- ConferenceUrl.init(window.location);+ APP.ConferenceUrl = new ConferenceUrl(window.location);// Clean up the URL displayed by the browser- replaceHistoryState(ConferenceUrl.getInviteUrl());+ replaceHistoryState(APP.ConferenceUrl.getInviteUrl());var isUIReady = APP.UI.start();if (isUIReady) {APP.conference.init({roomName: buildRoomName()}).then(function () {diff --git a/modules/UI/invite/Invite.js b/modules/UI/invite/Invite.jsindex 2247d86914..df57740887 100644--- a/modules/UI/invite/Invite.js+++ b/modules/UI/invite/Invite.js@@ -3,7 +3,6 @@import InviteDialogView from './InviteDialogView';import createRoomLocker from './RoomLocker';import UIEvents from '../../../service/UI/UIEvents';-import ConferenceUrl from '../../URL/ConferenceUrl';const ConferenceEvents = JitsiMeetJS.events.conference;@@ -15,7 +14,7 @@ const ConferenceEvents = JitsiMeetJS.events.conference;class Invite {constructor(conference) {this.conference = conference;- this.inviteUrl = ConferenceUrl.getInviteUrl();+ this.inviteUrl = APP.ConferenceUrl.getInviteUrl();this.createRoomLocker(conference);this.registerListeners();}diff --git a/modules/UI/reload_overlay/PageReloadOverlay.js b/modules/UI/reload_overlay/PageReloadOverlay.jsindex bb16216702..1806ce209d 100644--- a/modules/UI/reload_overlay/PageReloadOverlay.js+++ b/modules/UI/reload_overlay/PageReloadOverlay.js@@ -1,7 +1,5 @@/* global $, APP, AJS */-import ConferenceUrl from '../../URL/ConferenceUrl';-let $overlay;/**@@ -79,7 +77,7 @@ function start(timeoutSeconds) {if (timeLeft === 0) {window.clearInterval(intervalId);- ConferenceUrl.reload();+ APP.ConferenceUrl.reload();}}, 1000);}diff --git a/modules/URL/ConferenceUrl.js b/modules/URL/ConferenceUrl.jsindex dab1abbef3..6546f7cd6e 100644--- a/modules/URL/ConferenceUrl.js+++ b/modules/URL/ConferenceUrl.js@@ -1,24 +1,12 @@+/* global console */import { redirect } from '../util/helpers';-/**- * Stores the original conference room URL with all parameters.- * @type {string}- */-let originalURL;--/**- * A simplified version of the conference URL stripped out of the parameters- * which should be used for sending invites.- * @type {string}- */-let inviteURL;-/*** The modules stores information about the URL used to start the conference and* provides utility methods for dealing with conference URL and reloads.*/-export default {+export default class ConferenceUrl {/*** Initializes the module.*@@ -40,34 +28,46 @@ export default {* @param location.protocol the protocol part of the URL, would be 'https:'* from the sample URL.*/- init(location) {- originalURL = location.href;- // "https:" + "//" + "example.com:8888" + "/SomeConference1245"- inviteURL+ constructor(location) {+ /**+ * Stores the original conference room URL with all parameters.+ * Example:+ * https://example.com:8888/SomeConference1245?jwt=a5sbc2#blablahash+ * @type {string}+ */+ this.originalURL = location.href;+ /**+ * A simplified version of the conference URL stripped out of+ * the parameters which should be used for sending invites.+ * Example:+ * https://example.com:8888/SomeConference1245+ * @type {string}+ */+ this.inviteURL= location.protocol + "//" + location.host + location.pathname;- console.info("Stored original conference URL: " + originalURL);- console.info("Conference URL for invites: " + inviteURL);- },+ console.info("Stored original conference URL: " + this.originalURL);+ console.info("Conference URL for invites: " + this.inviteURL);+ }/*** Obtains the conference invite URL.* @return {string} the URL pointing o the conference which is mean to be* used to invite new participants.*/getInviteUrl() {- return inviteURL;- },+ return this.inviteURL;+ }/*** Obtains full conference URL with all original parameters.* @return {string} the original URL used to open the current conference.*/getOriginalUrl() {- return originalURL;- },+ return this.originalURL;+ }/*** Reloads the conference using original URL with all of the parameters.*/reload() {- console.info("Reloading the conference using URL: " + originalURL);- redirect(originalURL);+ console.info("Reloading the conference using URL: " + this.originalURL);+ redirect(this.originalURL);}-};+}