|
@@ -2,49 +2,84 @@
|
2
|
2
|
/* application specific logic */
|
3
|
3
|
|
4
|
4
|
import "babel-polyfill";
|
5
|
|
-require("jquery");
|
6
|
|
-require("jquery-ui");
|
7
|
|
-require("strophe");
|
8
|
|
-require("strophe-disco");
|
9
|
|
-require("strophe-caps");
|
10
|
|
-require("tooltip");
|
11
|
|
-require("popover");
|
|
5
|
+import "jquery";
|
|
6
|
+import "jquery-ui";
|
|
7
|
+import "strophe";
|
|
8
|
+import "strophe-disco";
|
|
9
|
+import "strophe-caps";
|
|
10
|
+import "tooltip";
|
|
11
|
+import "popover";
|
|
12
|
+import "jQuery-Impromptu";
|
|
13
|
+import "autosize";
|
12
|
14
|
window.toastr = require("toastr");
|
13
|
|
-require("jQuery-Impromptu");
|
14
|
|
-require("autosize");
|
15
|
15
|
|
16
|
|
-var CQEvents = require('./service/connectionquality/CQEvents');
|
17
|
|
-var UIEvents = require('./service/UI/UIEvents');
|
|
16
|
+import RoomnameGenerator from './modules/util/RoomnameGenerator';
|
|
17
|
+import CQEvents from './service/connectionquality/CQEvents';
|
|
18
|
+import UIEvents from './service/UI/UIEvents';
|
18
|
19
|
|
19
|
|
-var Commands = {
|
|
20
|
+const Commands = {
|
20
|
21
|
CONNECTION_QUALITY: "connectionQuality",
|
21
|
22
|
EMAIL: "email"
|
22
|
23
|
};
|
23
|
24
|
|
24
|
|
-var APP = {
|
25
|
|
- init: function () {
|
|
25
|
+function buildRoomName () {
|
|
26
|
+ let path = window.location.pathname;
|
|
27
|
+ let roomName;
|
|
28
|
+
|
|
29
|
+ // determinde the room node from the url
|
|
30
|
+ // TODO: just the roomnode or the whole bare jid?
|
|
31
|
+ if (config.getroomnode && typeof config.getroomnode === 'function') {
|
|
32
|
+ // custom function might be responsible for doing the pushstate
|
|
33
|
+ roomName = config.getroomnode(path);
|
|
34
|
+ } else {
|
|
35
|
+ /* fall back to default strategy
|
|
36
|
+ * this is making assumptions about how the URL->room mapping happens.
|
|
37
|
+ * It currently assumes deployment at root, with a rewrite like the
|
|
38
|
+ * following one (for nginx):
|
|
39
|
+ location ~ ^/([a-zA-Z0-9]+)$ {
|
|
40
|
+ rewrite ^/(.*)$ / break;
|
|
41
|
+ }
|
|
42
|
+ */
|
|
43
|
+ if (path.length > 1) {
|
|
44
|
+ roomName = path.substr(1).toLowerCase();
|
|
45
|
+ } else {
|
|
46
|
+ let word = RoomnameGenerator.generateRoomWithoutSeparator();
|
|
47
|
+ roomName = word.toLowerCase();
|
|
48
|
+ window.history.pushState(
|
|
49
|
+ 'VideoChat', 'Room: ' + word, window.location.pathname + word
|
|
50
|
+ );
|
|
51
|
+ }
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ return roomName;
|
|
55
|
+}
|
|
56
|
+
|
|
57
|
+const APP = {
|
|
58
|
+ init () {
|
26
|
59
|
JitsiMeetJS.init();
|
27
|
60
|
JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.TRACE);
|
28
|
61
|
|
|
62
|
+ let roomName = buildRoomName();
|
29
|
63
|
this.conference = {
|
|
64
|
+ roomName,
|
30
|
65
|
localId: undefined,
|
31
|
66
|
isModerator: false,
|
32
|
67
|
membersCount: 0,
|
33
|
68
|
audioMuted: false,
|
34
|
69
|
videoMuted: false,
|
35
|
|
- isLocalId: function (id) {
|
|
70
|
+ isLocalId (id) {
|
36
|
71
|
return this.localId === id;
|
37
|
72
|
},
|
38
|
|
- muteAudio: function (mute) {
|
|
73
|
+ muteAudio (mute) {
|
39
|
74
|
APP.UI.eventEmitter.emit(UIEvents.AUDIO_MUTED, mute);
|
40
|
75
|
},
|
41
|
|
- toggleAudioMuted: function () {
|
|
76
|
+ toggleAudioMuted () {
|
42
|
77
|
this.muteAudio(!this.audioMuted);
|
43
|
78
|
},
|
44
|
|
- muteVideo: function (mute) {
|
|
79
|
+ muteVideo (mute) {
|
45
|
80
|
APP.UI.eventEmitter.emit(UIEvents.VIDEO_MUTED, mute);
|
46
|
81
|
},
|
47
|
|
- toggleVideoMuted: function () {
|
|
82
|
+ toggleVideoMuted () {
|
48
|
83
|
this.muteVideo(!this.videoMuted);
|
49
|
84
|
}
|
50
|
85
|
};
|
|
@@ -315,7 +350,7 @@ function initConference(connection, roomName) {
|
315
|
350
|
|
316
|
351
|
function init() {
|
317
|
352
|
connect().then(function (connection) {
|
318
|
|
- return initConference(connection, APP.UI.generateRoomName());
|
|
353
|
+ return initConference(connection, APP.conference.roomName);
|
319
|
354
|
}).then(function () {
|
320
|
355
|
APP.UI.start();
|
321
|
356
|
|
|
@@ -342,7 +377,7 @@ function init() {
|
342
|
377
|
* will be displayed to the user.
|
343
|
378
|
*/
|
344
|
379
|
function obtainConfigAndInit() {
|
345
|
|
- var roomName = APP.UI.getRoomNode();
|
|
380
|
+ let roomName = APP.conference.roomName;
|
346
|
381
|
|
347
|
382
|
if (config.configLocation) {
|
348
|
383
|
APP.configFetch.obtainConfig(
|