|
@@ -1,32 +1,17 @@
|
1
|
1
|
var JitsiConference = require("./JitsiConference");
|
2
|
2
|
var XMPP = require("./modules/xmpp/xmpp");
|
3
|
|
-var RandomUtil = require("./modules/util/RandomUtil");
|
4
|
|
-
|
5
|
|
-/**
|
6
|
|
- * Utility method that generates user name based on random hex values.
|
7
|
|
- * Eg. 12345678-1234-1234-12345678
|
8
|
|
- * @returns {string}
|
9
|
|
- */
|
10
|
|
-function generateUserName() {
|
11
|
|
- return RandomUtil.random8digitsHex() + "-" + RandomUtil.random4digitsHex() + "-" +
|
12
|
|
- RandomUtil.random4digitsHex() + "-" + RandomUtil.random8digitsHex();
|
13
|
|
-}
|
14
|
3
|
|
15
|
4
|
/**
|
16
|
5
|
* Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the
|
17
|
6
|
* JitsiConference interface.
|
18
|
7
|
* @param appID identification for the provider of Jitsi Meet video conferencing services.
|
19
|
|
- * @param tokenPassword secret generated by the provider of Jitsi Meet video conferencing services.
|
20
|
|
- * The token will be send to the provider from the Jitsi Meet server deployment for authorization of the current client.
|
21
|
|
- * The format is:
|
22
|
|
- * passwordToken = token + "_" + roomName + "_" + ts
|
23
|
|
- * See doc/tokens.md for more info on how tokens are generated.
|
|
8
|
+ * @param token the JWT token used to authenticate with the server(optional)
|
24
|
9
|
* @param options Object with properties / settings related to connection with the server.
|
25
|
10
|
* @constructor
|
26
|
11
|
*/
|
27
|
|
-function JitsiConnection(appID, tokenPassword, options) {
|
|
12
|
+function JitsiConnection(appID, token, options) {
|
28
|
13
|
this.appID = appID;
|
29
|
|
- this.tokenPassword = tokenPassword;
|
|
14
|
+ this.token = token;
|
30
|
15
|
this.options = options;
|
31
|
16
|
this.xmpp = new XMPP(options);
|
32
|
17
|
this.conferences = {};
|
|
@@ -40,14 +25,6 @@ JitsiConnection.prototype.connect = function (options) {
|
40
|
25
|
if(!options)
|
41
|
26
|
options = {};
|
42
|
27
|
|
43
|
|
- // If we have token provided use it as a password and generate random username
|
44
|
|
- if (this.tokenPassword) {
|
45
|
|
- options.password = this.tokenPassword;
|
46
|
|
- if (!options.id) {
|
47
|
|
- options.id = generateUserName() + "@" + this.options.hosts.domain;
|
48
|
|
- }
|
49
|
|
- }
|
50
|
|
-
|
51
|
28
|
this.xmpp.connect(options.id, options.password);
|
52
|
29
|
}
|
53
|
30
|
|