Преглед изворни кода

ESLint

Our JSHint configuration is not extensive and we have excluded multiple
files from linting. Additionally, we have seen JSHint to be unable to
parse newer ECMAScript features such as the object spread operator
(proposal).

On the other hand, we have seen ESLint to beautifully work on React and
React Native source code in addition to ES2015 and later. Introduce
ESLint alongside JSHint as an intermediate step to eventually switching
from JSHint to ESLint.

As our source code does not fully follow even the JSHint rules we have,
it is very difficult to introduce ESLint with many rules. At the
beginning, introduce it with as little rules as possible. Morever,
ESLint is able to automatically fix certain rule offenders so once we
have ESLint merged we can incrementally add new rules while keeping our
commits' modification on as little subjects as possible.
master
Lyubomir Marinov пре 8 година
родитељ
комит
90ee7e8a54
38 измењених фајлова са 270 додато и 214 уклоњено
  1. 15
    0
      .eslintignore
  2. 34
    0
      .eslintrc.js
  3. 23
    23
      JitsiConference.js
  4. 1
    1
      JitsiConferenceEventManager.js
  5. 7
    8
      JitsiConnection.js
  6. 1
    1
      JitsiMediaDevices.js
  7. 9
    9
      JitsiMeetJS.js
  8. 4
    2
      connection_optimization/external_connect.js
  9. 14
    13
      doc/example/example.js
  10. 5
    9
      modules/RTC/DataChannels.js
  11. 7
    7
      modules/RTC/JitsiLocalTrack.js
  12. 2
    2
      modules/RTC/JitsiRemoteTrack.js
  13. 3
    3
      modules/RTC/JitsiTrack.js
  14. 6
    7
      modules/RTC/RTC.js
  15. 3
    3
      modules/RTC/RTCUIHelper.js
  16. 20
    14
      modules/RTC/RTCUtils.js
  17. 5
    5
      modules/RTC/ScreenObtainer.js
  18. 4
    4
      modules/statistics/AnalyticsAdapter.js
  19. 1
    1
      modules/statistics/CallStats.js
  20. 0
    1
      modules/statistics/LocalStatsCollector.js
  21. 4
    5
      modules/statistics/RTPStatsCollector.js
  22. 4
    3
      modules/transcription/audioRecorder.js
  23. 4
    1
      modules/transcription/transcriptionServices/AbstractTranscriptionService.js
  24. 2
    2
      modules/transcription/transcriptionServices/SphinxTranscriptionService.js
  25. 3
    3
      modules/transcription/word.js
  26. 0
    2
      modules/util/EventEmitterForwarder.js
  27. 19
    22
      modules/xmpp/ChatRoom.js
  28. 5
    0
      modules/xmpp/JingleSession.js
  29. 14
    16
      modules/xmpp/JingleSessionPC.js
  30. 5
    9
      modules/xmpp/SDP.js
  31. 14
    10
      modules/xmpp/TraceablePeerConnection.js
  32. 4
    4
      modules/xmpp/recording.js
  33. 3
    2
      modules/xmpp/strophe.emuc.js
  34. 10
    7
      modules/xmpp/strophe.jingle.js
  35. 4
    4
      modules/xmpp/strophe.ping.js
  36. 4
    3
      modules/xmpp/strophe.rayo.js
  37. 5
    7
      modules/xmpp/xmpp.js
  38. 2
    1
      package.json

+ 15
- 0
.eslintignore Прегледај датотеку

1
+# The build artifacts of the lib-jiti-meet project.
2
+lib-jitsi-meet.js
3
+lib-jitsi-meet.js.map
4
+lib-jitsi-meet.min.js
5
+lib-jitsi-meet.min.map
6
+
7
+# Third-party source code which we (1) do not want to modify or (2) try to
8
+# modify as little as possible.
9
+libs/*
10
+modules/RTC/adapter.screenshare.js
11
+
12
+# ESLint will by default ignore its own configuration file. However, there does
13
+# not seem to be a reason why we will want to risk being inconsistent with our
14
+# remaining JavaScript source code.
15
+!.eslintrc.js

+ 34
- 0
.eslintrc.js Прегледај датотеку

1
+module.exports = {
2
+    'env': {
3
+        'browser': true,
4
+        'commonjs': true,
5
+        'es6': true
6
+    },
7
+    'extends': 'eslint:recommended',
8
+    'globals': {
9
+        // The globals that (1) are accessed but not defined within many of our
10
+        // files, (2) are certainly defined, and (3) we would like to use
11
+        // without explicitly specifying them (using a comment) inside of our
12
+        // files.
13
+        '__filename': false
14
+    },
15
+    'parserOptions': {
16
+        'sourceType': 'module'
17
+    },
18
+    'rules': {
19
+        'new-cap': [
20
+            'error',
21
+            {
22
+                'capIsNew': false // Behave like JSHint's newcap.
23
+            }
24
+        ],
25
+        // While it is considered a best practice to avoid using methods on
26
+        // console in JavaScript that is designed to be executed in the browser
27
+        // and ESLint includes the rule among its set of recommended rules, (1)
28
+        // the general practice is to strip such calls before pushing to
29
+        // production and (2) we prefer to utilize console in lib-jitsi-meet
30
+        // (and jitsi-meet).
31
+        'no-console': 'off',
32
+        'semi': 'error'
33
+    }
34
+};

+ 23
- 23
JitsiConference.js Прегледај датотеку

1
 /* global Strophe, $, Promise */
1
 /* global Strophe, $, Promise */
2
-/* jshint -W101 */
2
+
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
4
 var RTC = require("./modules/RTC/RTC");
4
 var RTC = require("./modules/RTC/RTC");
5
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
5
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
105
         this.statistics = new Statistics(this.xmpp, {
105
         this.statistics = new Statistics(this.xmpp, {
106
             callStatsID: this.options.config.callStatsID,
106
             callStatsID: this.options.config.callStatsID,
107
             callStatsSecret: this.options.config.callStatsSecret,
107
             callStatsSecret: this.options.config.callStatsSecret,
108
-            callStatsSecret: this.options.config.callStatsSecret,
109
             callStatsCustomScriptUrl:
108
             callStatsCustomScriptUrl:
110
                 this.options.config.callStatsCustomScriptUrl,
109
                 this.options.config.callStatsCustomScriptUrl,
111
             roomName: this.options.name
110
             roomName: this.options.name
123
             this.eventEmitter.emit(JitsiConferenceEvents.TALK_WHILE_MUTED);
122
             this.eventEmitter.emit(JitsiConferenceEvents.TALK_WHILE_MUTED);
124
         });
123
         });
125
     }
124
     }
126
-}
125
+};
127
 
126
 
128
 /**
127
 /**
129
  * Joins the conference.
128
  * Joins the conference.
156
     }
155
     }
157
 
156
 
158
     this.room = null;
157
     this.room = null;
159
-}
158
+};
159
+
160
 /**
160
 /**
161
  * Leaves the conference.
161
  * Leaves the conference.
162
  * @returns {Promise}
162
  * @returns {Promise}
534
         this.statistics.sendScreenSharingEvent(false);
534
         this.statistics.sendScreenSharingEvent(false);
535
 
535
 
536
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
536
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
537
-}
537
+};
538
 
538
 
539
 /**
539
 /**
540
  * Removes JitsiLocalTrack object to the conference.
540
  * Removes JitsiLocalTrack object to the conference.
831
         jingleSession.initialize(false /* initiator */,this.room);
831
         jingleSession.initialize(false /* initiator */,this.room);
832
     } catch (error) {
832
     } catch (error) {
833
         GlobalOnErrorHandler.callErrorHandler(error);
833
         GlobalOnErrorHandler.callErrorHandler(error);
834
-    };
834
+    }
835
 
835
 
836
     this.rtc.onIncommingCall(jingleSession);
836
     this.rtc.onIncommingCall(jingleSession);
837
     // Add local Tracks to the ChatRoom
837
     // Add local Tracks to the ChatRoom
999
  */
999
  */
1000
 JitsiConference.prototype.getRecordingState = function () {
1000
 JitsiConference.prototype.getRecordingState = function () {
1001
     return (this.room) ? this.room.getRecordingState() : undefined;
1001
     return (this.room) ? this.room.getRecordingState() : undefined;
1002
-}
1002
+};
1003
 
1003
 
1004
 /**
1004
 /**
1005
  * Returns the url of the recorded video.
1005
  * Returns the url of the recorded video.
1006
  */
1006
  */
1007
 JitsiConference.prototype.getRecordingURL = function () {
1007
 JitsiConference.prototype.getRecordingURL = function () {
1008
     return (this.room) ? this.room.getRecordingURL() : null;
1008
     return (this.room) ? this.room.getRecordingURL() : null;
1009
-}
1009
+};
1010
 
1010
 
1011
 /**
1011
 /**
1012
  * Starts/stops the recording
1012
  * Starts/stops the recording
1020
     this.eventEmitter.emit(
1020
     this.eventEmitter.emit(
1021
         JitsiConferenceEvents.RECORDER_STATE_CHANGED, "error",
1021
         JitsiConferenceEvents.RECORDER_STATE_CHANGED, "error",
1022
         new Error("The conference is not created yet!"));
1022
         new Error("The conference is not created yet!"));
1023
-}
1023
+};
1024
 
1024
 
1025
 /**
1025
 /**
1026
  * Returns true if the SIP calls are supported and false otherwise
1026
  * Returns true if the SIP calls are supported and false otherwise
1029
     if(this.room)
1029
     if(this.room)
1030
         return this.room.isSIPCallingSupported();
1030
         return this.room.isSIPCallingSupported();
1031
     return false;
1031
     return false;
1032
-}
1032
+};
1033
 
1033
 
1034
 /**
1034
 /**
1035
  * Dials a number.
1035
  * Dials a number.
1039
     if(this.room)
1039
     if(this.room)
1040
         return this.room.dial(number);
1040
         return this.room.dial(number);
1041
     return new Promise(function(resolve, reject){
1041
     return new Promise(function(resolve, reject){
1042
-        reject(new Error("The conference is not created yet!"))});
1043
-}
1042
+        reject(new Error("The conference is not created yet!"));});
1043
+};
1044
 
1044
 
1045
 /**
1045
 /**
1046
  * Hangup an existing call
1046
  * Hangup an existing call
1049
     if(this.room)
1049
     if(this.room)
1050
         return this.room.hangup();
1050
         return this.room.hangup();
1051
     return new Promise(function(resolve, reject){
1051
     return new Promise(function(resolve, reject){
1052
-        reject(new Error("The conference is not created yet!"))});
1053
-}
1052
+        reject(new Error("The conference is not created yet!"));});
1053
+};
1054
 
1054
 
1055
 /**
1055
 /**
1056
  * Returns the phone number for joining the conference.
1056
  * Returns the phone number for joining the conference.
1059
     if(this.room)
1059
     if(this.room)
1060
         return this.room.getPhoneNumber();
1060
         return this.room.getPhoneNumber();
1061
     return null;
1061
     return null;
1062
-}
1062
+};
1063
 
1063
 
1064
 /**
1064
 /**
1065
  * Returns the pin for joining the conference with phone.
1065
  * Returns the pin for joining the conference with phone.
1068
     if(this.room)
1068
     if(this.room)
1069
         return this.room.getPhonePin();
1069
         return this.room.getPhonePin();
1070
     return null;
1070
     return null;
1071
-}
1071
+};
1072
 
1072
 
1073
 /**
1073
 /**
1074
  * Returns the connection state for the current room. Its ice connection state
1074
  * Returns the connection state for the current room. Its ice connection state
1078
     if(this.room)
1078
     if(this.room)
1079
         return this.room.getConnectionState();
1079
         return this.room.getConnectionState();
1080
     return null;
1080
     return null;
1081
-}
1081
+};
1082
 
1082
 
1083
 /**
1083
 /**
1084
  * Make all new participants mute their audio/video on join.
1084
  * Make all new participants mute their audio/video on join.
1169
 JitsiConference.prototype.sendFeedback =
1169
 JitsiConference.prototype.sendFeedback =
1170
 function(overallFeedback, detailedFeedback){
1170
 function(overallFeedback, detailedFeedback){
1171
     this.statistics.sendFeedback(overallFeedback, detailedFeedback);
1171
     this.statistics.sendFeedback(overallFeedback, detailedFeedback);
1172
-}
1172
+};
1173
 
1173
 
1174
 /**
1174
 /**
1175
  * Returns true if the callstats integration is enabled, otherwise returns
1175
  * Returns true if the callstats integration is enabled, otherwise returns
1180
  */
1180
  */
1181
 JitsiConference.prototype.isCallstatsEnabled = function () {
1181
 JitsiConference.prototype.isCallstatsEnabled = function () {
1182
     return this.statistics.isCallstatsEnabled();
1182
     return this.statistics.isCallstatsEnabled();
1183
-}
1183
+};
1184
 
1184
 
1185
 
1185
 
1186
 /**
1186
 /**
1196
     }
1196
     }
1197
     this.statistics.associateStreamWithVideoTag(
1197
     this.statistics.associateStreamWithVideoTag(
1198
         ssrc, track.isLocal(), track.getUsageLabel(), container.id);
1198
         ssrc, track.isLocal(), track.getUsageLabel(), container.id);
1199
-}
1199
+};
1200
 
1200
 
1201
 /**
1201
 /**
1202
  * Reports detected audio problem with the media stream related to the passed
1202
  * Reports detected audio problem with the media stream related to the passed
1252
             id: mtrack.id,
1252
             id: mtrack.id,
1253
             label: mtrack.label,
1253
             label: mtrack.label,
1254
             muted: mtrack.muted
1254
             muted: mtrack.muted
1255
-        }
1255
+        };
1256
         logger.log("enabled: ", mtrack.enabled);
1256
         logger.log("enabled: ", mtrack.enabled);
1257
         logger.log("id: ", mtrack.id);
1257
         logger.log("id: ", mtrack.id);
1258
         logger.log("label: ", mtrack.label);
1258
         logger.log("label: ", mtrack.label);
1334
  */
1334
  */
1335
 JitsiConference.prototype.sendEndpointMessage = function (to, payload) {
1335
 JitsiConference.prototype.sendEndpointMessage = function (to, payload) {
1336
     this.rtc.sendDataChannelMessage(to, payload);
1336
     this.rtc.sendDataChannelMessage(to, payload);
1337
-}
1337
+};
1338
 
1338
 
1339
 /**
1339
 /**
1340
  * Sends broadcast message via the datachannels.
1340
  * Sends broadcast message via the datachannels.
1343
  */
1343
  */
1344
 JitsiConference.prototype.broadcastEndpointMessage = function (payload) {
1344
 JitsiConference.prototype.broadcastEndpointMessage = function (payload) {
1345
     this.sendEndpointMessage("", payload);
1345
     this.sendEndpointMessage("", payload);
1346
-}
1346
+};
1347
 
1347
 
1348
 module.exports = JitsiConference;
1348
 module.exports = JitsiConference;

+ 1
- 1
JitsiConferenceEventManager.js Прегледај датотеку

158
         });
158
         });
159
 
159
 
160
     chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
160
     chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
161
-        function (pc) {
161
+        function () {
162
             chatRoom.eventEmitter.emit(
162
             chatRoom.eventEmitter.emit(
163
                 XMPPEvents.CONFERENCE_SETUP_FAILED,
163
                 XMPPEvents.CONFERENCE_SETUP_FAILED,
164
                 new Error("ICE fail"));
164
                 new Error("ICE fail"));

+ 7
- 8
JitsiConnection.js Прегледај датотеку

1
 var JitsiConference = require("./JitsiConference");
1
 var JitsiConference = require("./JitsiConference");
2
-import * as JitsiConnectionErrors from "./JitsiConnectionErrors";
3
 import * as JitsiConnectionEvents from "./JitsiConnectionEvents";
2
 import * as JitsiConnectionEvents from "./JitsiConnectionEvents";
4
 import XMPP from "./modules/xmpp/xmpp";
3
 import XMPP from "./modules/xmpp/xmpp";
5
 var Statistics = require("./modules/statistics/statistics");
4
 var Statistics = require("./modules/statistics/statistics");
48
         options = {};
47
         options = {};
49
 
48
 
50
     this.xmpp.connect(options.id, options.password);
49
     this.xmpp.connect(options.id, options.password);
51
-}
50
+};
52
 
51
 
53
 /**
52
 /**
54
  * Attach to existing connection. Can be used for optimizations. For example:
53
  * Attach to existing connection. Can be used for optimizations. For example:
59
  */
58
  */
60
 JitsiConnection.prototype.attach = function (options) {
59
 JitsiConnection.prototype.attach = function (options) {
61
     this.xmpp.attach(options);
60
     this.xmpp.attach(options);
62
-}
61
+};
63
 
62
 
64
 /**
63
 /**
65
  * Disconnect the client from the server.
64
  * Disconnect the client from the server.
72
     var x = this.xmpp;
71
     var x = this.xmpp;
73
 
72
 
74
     x.disconnect.apply(x, arguments);
73
     x.disconnect.apply(x, arguments);
75
-}
74
+};
76
 
75
 
77
 /**
76
 /**
78
  * This method allows renewal of the tokens if they are expiring.
77
  * This method allows renewal of the tokens if they are expiring.
80
  */
79
  */
81
 JitsiConnection.prototype.setToken = function (token) {
80
 JitsiConnection.prototype.setToken = function (token) {
82
     this.token = token;
81
     this.token = token;
83
-}
82
+};
84
 
83
 
85
 /**
84
 /**
86
  * Creates and joins new conference.
85
  * Creates and joins new conference.
95
         = new JitsiConference({name: name, config: options, connection: this});
94
         = new JitsiConference({name: name, config: options, connection: this});
96
     this.conferences[name] = conference;
95
     this.conferences[name] = conference;
97
     return conference;
96
     return conference;
98
-}
97
+};
99
 
98
 
100
 /**
99
 /**
101
  * Subscribes the passed listener to the event.
100
  * Subscribes the passed listener to the event.
104
  */
103
  */
105
 JitsiConnection.prototype.addEventListener = function (event, listener) {
104
 JitsiConnection.prototype.addEventListener = function (event, listener) {
106
     this.xmpp.addListener(event, listener);
105
     this.xmpp.addListener(event, listener);
107
-}
106
+};
108
 
107
 
109
 /**
108
 /**
110
  * Unsubscribes the passed handler.
109
  * Unsubscribes the passed handler.
113
  */
112
  */
114
 JitsiConnection.prototype.removeEventListener = function (event, listener) {
113
 JitsiConnection.prototype.removeEventListener = function (event, listener) {
115
     this.xmpp.removeListener(event, listener);
114
     this.xmpp.removeListener(event, listener);
116
-}
115
+};
117
 
116
 
118
 /**
117
 /**
119
  * Returns measured connectionTimes.
118
  * Returns measured connectionTimes.

+ 1
- 1
JitsiMediaDevices.js Прегледај датотеку

130
      * Emits an event.
130
      * Emits an event.
131
      * @param {string} event - event name
131
      * @param {string} event - event name
132
      */
132
      */
133
-    emitEvent: function (event) {
133
+    emitEvent: function (event) { // eslint-disable-line no-unused-vars
134
         eventEmitter.emit.apply(eventEmitter, arguments);
134
         eventEmitter.emit.apply(eventEmitter, arguments);
135
     }
135
     }
136
 };
136
 };

+ 9
- 9
JitsiMeetJS.js Прегледај датотеку

31
     var order = Resolutions[resolution].order;
31
     var order = Resolutions[resolution].order;
32
     var res = null;
32
     var res = null;
33
     var resName = null;
33
     var resName = null;
34
-    for(var i in Resolutions) {
34
+    for(let i in Resolutions) {
35
         var tmp = Resolutions[i];
35
         var tmp = Resolutions[i];
36
         if (!res || (res.order < tmp.order && tmp.order < order)) {
36
         if (!res || (res.order < tmp.order && tmp.order < order)) {
37
             resName = i;
37
             resName = i;
91
     mediaDevices: JitsiMediaDevices,
91
     mediaDevices: JitsiMediaDevices,
92
     analytics: null,
92
     analytics: null,
93
     init: function (options) {
93
     init: function (options) {
94
-        var logObject, attr;
94
+        let logObject, attr;
95
         Statistics.init(options);
95
         Statistics.init(options);
96
         this.analytics = Statistics.analytics;
96
         this.analytics = Statistics.analytics;
97
 
97
 
119
                 id: "component_version",
119
                 id: "component_version",
120
                 component: "lib-jitsi-meet",
120
                 component: "lib-jitsi-meet",
121
                 version: this.version
121
                 version: this.version
122
-            }
122
+            };
123
             Statistics.sendLog(JSON.stringify(logObject));
123
             Statistics.sendLog(JSON.stringify(logObject));
124
         }
124
         }
125
 
125
 
203
                     "getUserMedia.success", options), options);
203
                     "getUserMedia.success", options), options);
204
 
204
 
205
                 if(!RTC.options.disableAudioLevels)
205
                 if(!RTC.options.disableAudioLevels)
206
-                    for(var i = 0; i < tracks.length; i++) {
207
-                        var track = tracks[i];
206
+                    for(let i = 0; i < tracks.length; i++) {
207
+                        const track = tracks[i];
208
                         var mStream = track.getOriginalStream();
208
                         var mStream = track.getOriginalStream();
209
                         if(track.getType() === MediaType.AUDIO){
209
                         if(track.getType() === MediaType.AUDIO){
210
                             Statistics.startLocalStats(mStream,
210
                             Statistics.startLocalStats(mStream,
221
                 var currentlyAvailableMediaDevices
221
                 var currentlyAvailableMediaDevices
222
                     = RTC.getCurrentlyAvailableMediaDevices();
222
                     = RTC.getCurrentlyAvailableMediaDevices();
223
                 if (currentlyAvailableMediaDevices) {
223
                 if (currentlyAvailableMediaDevices) {
224
-                    for(var i = 0; i < tracks.length; i++) {
225
-                        var track = tracks[i];
224
+                    for(let i = 0; i < tracks.length; i++) {
225
+                        const track = tracks[i];
226
                         track._setRealDeviceIdFromDeviceList(
226
                         track._setRealDeviceIdFromDeviceList(
227
                             currentlyAvailableMediaDevices);
227
                             currentlyAvailableMediaDevices);
228
                     }
228
                     }
254
                     // User cancelled action is not really an error, so only
254
                     // User cancelled action is not really an error, so only
255
                     // log it as an event to avoid having conference classified
255
                     // log it as an event to avoid having conference classified
256
                     // as partially failed
256
                     // as partially failed
257
-                    var logObject = {
257
+                    const logObject = {
258
                         id: "chrome_extension_user_canceled",
258
                         id: "chrome_extension_user_canceled",
259
                         message: error.message
259
                         message: error.message
260
                     };
260
                     };
263
                         "getUserMedia.userCancel.extensionInstall");
263
                         "getUserMedia.userCancel.extensionInstall");
264
                 } else if (JitsiTrackErrors.NOT_FOUND === error.name) {
264
                 } else if (JitsiTrackErrors.NOT_FOUND === error.name) {
265
                     // logs not found devices with just application log to cs
265
                     // logs not found devices with just application log to cs
266
-                    var logObject = {
266
+                    const logObject = {
267
                         id: "usermedia_missing_device",
267
                         id: "usermedia_missing_device",
268
                         status: error.gum.devices
268
                         status: error.gum.devices
269
                     };
269
                     };

+ 4
- 2
connection_optimization/external_connect.js Прегледај датотеку

20
  * callback is going to receive one parameter which is going to be JS error
20
  * callback is going to receive one parameter which is going to be JS error
21
  * object with a reason for failure in it.
21
  * object with a reason for failure in it.
22
  */
22
  */
23
-function createConnectionExternally(webserviceUrl, success_callback,
24
-    error_callback) {
23
+function createConnectionExternally( // eslint-disable-line no-unused-vars
24
+        webserviceUrl,
25
+        success_callback,
26
+        error_callback) {
25
     if (!window.XMLHttpRequest) {
27
     if (!window.XMLHttpRequest) {
26
         error_callback(new Error("XMLHttpRequest is not supported!"));
28
         error_callback(new Error("XMLHttpRequest is not supported!"));
27
         return;
29
         return;

+ 14
- 13
doc/example/example.js Прегледај датотеку

1
+/* global $, JitsiMeetJS */
2
+
1
 var options = {
3
 var options = {
2
     hosts: {
4
     hosts: {
3
         domain: 'jitsi-meet.example.com',
5
         domain: 'jitsi-meet.example.com',
5
     },
7
     },
6
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
8
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
7
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
9
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
8
-}
10
+};
9
 
11
 
10
 var confOptions = {
12
 var confOptions = {
11
     openSctp: true
13
     openSctp: true
12
-}
13
-
14
+};
14
 
15
 
15
 var isJoined = false;
16
 var isJoined = false;
16
 
17
 
103
         return;
104
         return;
104
     var tracks = remoteTracks[id];
105
     var tracks = remoteTracks[id];
105
     for(var i = 0; i< tracks.length; i++)
106
     for(var i = 0; i< tracks.length; i++)
106
-        tracks[i].detach($("#" + id + tracks[i].getType()))
107
+        tracks[i].detach($("#" + id + tracks[i].getType()));
107
 }
108
 }
108
 
109
 
109
 /**
110
 /**
139
             room.getPhonePin());
140
             room.getPhonePin());
140
     });
141
     });
141
     room.join();
142
     room.join();
142
-};
143
+}
143
 
144
 
144
 /**
145
 /**
145
  * This function is called when the connection fail.
146
  * This function is called when the connection fail.
146
  */
147
  */
147
-function onConnectionFailed(){console.error("Connection Failed!")};
148
+function onConnectionFailed() {
149
+    console.error("Connection Failed!");
150
+}
148
 
151
 
149
 /**
152
 /**
150
  * This function is called when the connection fail.
153
  * This function is called when the connection fail.
169
     room.leave();
172
     room.leave();
170
     connection.disconnect();
173
     connection.disconnect();
171
 }
174
 }
175
+
172
 var isVideo = true;
176
 var isVideo = true;
173
-function switchVideo() {
177
+function switchVideo() { // eslint-disable-line no-unused-vars
174
     isVideo = !isVideo;
178
     isVideo = !isVideo;
175
     if(localTracks[1]) {
179
     if(localTracks[1]) {
176
         localTracks[1].dispose();
180
         localTracks[1].dispose();
194
         });
198
         });
195
 }
199
 }
196
 
200
 
197
-function changeAudioOutput(selected) {
201
+function changeAudioOutput(selected) { // eslint-disable-line no-unused-vars
198
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(selected.value);
202
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(selected.value);
199
 }
203
 }
200
 
204
 
201
 $(window).bind('beforeunload', unload);
205
 $(window).bind('beforeunload', unload);
202
 $(window).bind('unload', unload);
206
 $(window).bind('unload', unload);
203
 
207
 
204
-
205
-
206
 // JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
208
 // JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
207
 var initOptions = {
209
 var initOptions = {
208
     disableAudioLevels: true,
210
     disableAudioLevels: true,
229
     desktopSharingFirefoxMaxVersionExtRequired: -1,
231
     desktopSharingFirefoxMaxVersionExtRequired: -1,
230
     // The URL to the Firefox extension for desktop sharing.
232
     // The URL to the Firefox extension for desktop sharing.
231
     desktopSharingFirefoxExtensionURL: null
233
     desktopSharingFirefoxExtensionURL: null
232
-}
234
+};
233
 JitsiMeetJS.init(initOptions).then(function(){
235
 JitsiMeetJS.init(initOptions).then(function(){
234
     connection = new JitsiMeetJS.JitsiConnection(null, null, options);
236
     connection = new JitsiMeetJS.JitsiConnection(null, null, options);
235
 
237
 
248
     console.log(error);
250
     console.log(error);
249
 });
251
 });
250
 
252
 
251
-
252
 if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
253
 if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
253
     JitsiMeetJS.mediaDevices.enumerateDevices(function(devices) {
254
     JitsiMeetJS.mediaDevices.enumerateDevices(function(devices) {
254
         var audioOutputDevices = devices.filter(function(d) { return d.kind === 'audiooutput'; });
255
         var audioOutputDevices = devices.filter(function(d) { return d.kind === 'audiooutput'; });
262
 
263
 
263
             $('#audioOutputSelectWrapper').show();
264
             $('#audioOutputSelectWrapper').show();
264
         }
265
         }
265
-    })
266
+    });
266
 }
267
 }
267
 
268
 
268
 var connection = null;
269
 var connection = null;

+ 5
- 9
modules/RTC/DataChannels.js Прегледај датотеку

1
-/* global config, APP, Strophe */
2
-
3
 // cache datachannels to avoid garbage collection
1
 // cache datachannels to avoid garbage collection
4
 // https://code.google.com/p/chromium/issues/detail?id=405545
2
 // https://code.google.com/p/chromium/issues/detail?id=405545
5
 
3
 
7
 var RTCEvents = require("../../service/RTC/RTCEvents");
5
 var RTCEvents = require("../../service/RTC/RTCEvents");
8
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
6
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
9
 
7
 
10
-
11
 /**
8
 /**
12
  * Binds "ondatachannel" event listener to given PeerConnection instance.
9
  * Binds "ondatachannel" event listener to given PeerConnection instance.
13
  * @param peerConnection WebRTC peer connection instance.
10
  * @param peerConnection WebRTC peer connection instance.
40
      var msgData = event.data;
37
      var msgData = event.data;
41
      logger.info("Got My Data Channel Message:", msgData, dataChannel);
38
      logger.info("Got My Data Channel Message:", msgData, dataChannel);
42
      };*/
39
      };*/
43
-};
44
-
40
+}
45
 
41
 
46
 /**
42
 /**
47
  * Callback triggered by PeerConnection when new data channel is opened
43
  * Callback triggered by PeerConnection when new data channel is opened
65
     };
61
     };
66
 
62
 
67
     dataChannel.onerror = function (error) {
63
     dataChannel.onerror = function (error) {
68
-        var e = new Error("Data Channel Error:" + error);
69
         // FIXME: this one seems to be generated a bit too often right now
64
         // FIXME: this one seems to be generated a bit too often right now
70
         // so we are temporarily commenting it before we have more clarity
65
         // so we are temporarily commenting it before we have more clarity
71
         // on which of the errors we absolutely need to report
66
         // on which of the errors we absolutely need to report
72
-        //GlobalOnErrorHandler.callErrorHandler(e);
67
+        //GlobalOnErrorHandler.callErrorHandler(
68
+        //        new Error("Data Channel Error:" + error));
73
         logger.error("Data Channel Error:", error, dataChannel);
69
         logger.error("Data Channel Error:", error, dataChannel);
74
     };
70
     };
75
 
71
 
267
     })) {
263
     })) {
268
         throw new Error("No opened data channels found!");
264
         throw new Error("No opened data channels found!");
269
     }
265
     }
270
-}
266
+};
271
 
267
 
272
 /**
268
 /**
273
  * Sends message via the datachannels.
269
  * Sends message via the datachannels.
284
         to: to,
280
         to: to,
285
         msgPayload: payload
281
         msgPayload: payload
286
     });
282
     });
287
-}
283
+};
288
 
284
 
289
 module.exports = DataChannels;
285
 module.exports = DataChannels;

+ 7
- 7
modules/RTC/JitsiLocalTrack.js Прегледај датотеку

164
         this._noDataFromSourceTimeout = null;
164
         this._noDataFromSourceTimeout = null;
165
     }
165
     }
166
     this._setHandler("track_unmute", undefined);
166
     this._setHandler("track_unmute", undefined);
167
-}
167
+};
168
 
168
 
169
 /**
169
 /**
170
  * Called when potential camera issue is detected. Clears the handlers and
170
  * Called when potential camera issue is detected. Clears the handlers and
175
     this._clearNoDataFromSourceMuteResources();
175
     this._clearNoDataFromSourceMuteResources();
176
     if(this._checkForCameraIssues())
176
     if(this._checkForCameraIssues())
177
         this._fireNoDataFromSourceEvent();
177
         this._fireNoDataFromSourceEvent();
178
-}
178
+};
179
 
179
 
180
 /**
180
 /**
181
  * Fires JitsiTrackEvents.NO_DATA_FROM_SOURCE and logs it to analytics and
181
  * Fires JitsiTrackEvents.NO_DATA_FROM_SOURCE and logs it to analytics and
184
 JitsiLocalTrack.prototype._fireNoDataFromSourceEvent = function () {
184
 JitsiLocalTrack.prototype._fireNoDataFromSourceEvent = function () {
185
     this.eventEmitter.emit(JitsiTrackEvents.NO_DATA_FROM_SOURCE);
185
     this.eventEmitter.emit(JitsiTrackEvents.NO_DATA_FROM_SOURCE);
186
     Statistics.sendEventToAll(this.getType() + ".no_data_from_source");
186
     Statistics.sendEventToAll(this.getType() + ".no_data_from_source");
187
-}
187
+};
188
 
188
 
189
 /**
189
 /**
190
  * Sets real device ID by comparing track information with device information.
190
  * Sets real device ID by comparing track information with device information.
545
         }.bind(this), 3000);
545
         }.bind(this), 3000);
546
         this._testByteSent = false;
546
         this._testByteSent = false;
547
     }
547
     }
548
-}
548
+};
549
 
549
 
550
 /**
550
 /**
551
  * Returns facing mode for video track from camera. For other cases (e.g. audio
551
  * Returns facing mode for video track from camera. For other cases (e.g. audio
595
     this.stopStreamInProgress = true;
595
     this.stopStreamInProgress = true;
596
     RTCUtils.stopMediaStream(this.stream);
596
     RTCUtils.stopMediaStream(this.stream);
597
     this.stopStreamInProgress = false;
597
     this.stopStreamInProgress = false;
598
-}
598
+};
599
 
599
 
600
 /**
600
 /**
601
  * Detects camera issues on ended and mute events from MediaStreamTrack.
601
  * Detects camera issues on ended and mute events from MediaStreamTrack.
607
         return false;
607
         return false;
608
 
608
 
609
     return !this._isReceivingData();
609
     return !this._isReceivingData();
610
-}
610
+};
611
 
611
 
612
 /**
612
 /**
613
  * Checks whether the attached MediaStream is reveiving data from source or
613
  * Checks whether the attached MediaStream is reveiving data from source or
631
     return this.stream.getTracks().some(track =>
631
     return this.stream.getTracks().some(track =>
632
         ((!("readyState" in track) || track.readyState === "live")
632
         ((!("readyState" in track) || track.readyState === "live")
633
             && (!("muted" in track) || track.muted === false)));
633
             && (!("muted" in track) || track.muted === false)));
634
-}
634
+};
635
 
635
 
636
 module.exports = JitsiLocalTrack;
636
 module.exports = JitsiLocalTrack;

+ 2
- 2
modules/RTC/JitsiRemoteTrack.js Прегледај датотеку

1
-/* global __filename, module */
2
-var logger = require("jitsi-meet-logger").getLogger(__filename);
1
+/* global Strophe */
3
 
2
 
4
 var JitsiTrack = require("./JitsiTrack");
3
 var JitsiTrack = require("./JitsiTrack");
5
 import * as JitsiTrackEvents from "../../JitsiTrackEvents";
4
 import * as JitsiTrackEvents from "../../JitsiTrackEvents";
5
+var logger = require("jitsi-meet-logger").getLogger(__filename);
6
 var RTCBrowserType = require("./RTCBrowserType");
6
 var RTCBrowserType = require("./RTCBrowserType");
7
 var RTCEvents = require("../../service/RTC/RTCEvents");
7
 var RTCEvents = require("../../service/RTC/RTCEvents");
8
 var Statistics = require("../statistics/statistics");
8
 var Statistics = require("../statistics/statistics");

+ 3
- 3
modules/RTC/JitsiTrack.js Прегледај датотеку

1
 /* global __filename, module */
1
 /* global __filename, module */
2
 var logger = require("jitsi-meet-logger").getLogger(__filename);
2
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var RTCBrowserType = require("./RTCBrowserType");
3
 var RTCBrowserType = require("./RTCBrowserType");
4
-var RTCEvents = require("../../service/RTC/RTCEvents");
5
 var RTCUtils = require("./RTCUtils");
4
 var RTCUtils = require("./RTCUtils");
6
 import * as JitsiTrackEvents from "../../JitsiTrackEvents";
5
 import * as JitsiTrackEvents from "../../JitsiTrackEvents";
7
 var EventEmitter = require("events");
6
 var EventEmitter = require("events");
113
             track[trackHandler2Prop[type]] = handler;
112
             track[trackHandler2Prop[type]] = handler;
114
         }, this);
113
         }, this);
115
     }
114
     }
116
-}
115
+};
117
 
116
 
118
 /**
117
 /**
119
  * Sets the stream property of JitsiTrack object and sets all stored handlers
118
  * Sets the stream property of JitsiTrack object and sets all stored handlers
126
         typeof(this.handlers[type]) === "function" &&
125
         typeof(this.handlers[type]) === "function" &&
127
             this._setHandler(type, this.handlers[type]);
126
             this._setHandler(type, this.handlers[type]);
128
     }, this);
127
     }, this);
129
-}
128
+};
130
 
129
 
131
 /**
130
 /**
132
  * Returns the type (audio or video) of this track.
131
  * Returns the type (audio or video) of this track.
275
  *        method has been called previously on video or audio HTML element.
274
  *        method has been called previously on video or audio HTML element.
276
  * @private
275
  * @private
277
  */
276
  */
277
+// eslint-disable-next-line no-unused-vars
278
 JitsiTrack.prototype._attachTTFMTracker = function (container) {
278
 JitsiTrack.prototype._attachTTFMTracker = function (container) {
279
 };
279
 };
280
 
280
 

+ 6
- 7
modules/RTC/RTC.js Прегледај датотеку

1
-/* global __filename, APP, module */
1
+/* global Strophe */
2
+
2
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var EventEmitter = require("events");
4
 var EventEmitter = require("events");
4
-var RTCBrowserType = require("./RTCBrowserType");
5
 var RTCEvents = require("../../service/RTC/RTCEvents.js");
5
 var RTCEvents = require("../../service/RTC/RTCEvents.js");
6
 var RTCUtils = require("./RTCUtils.js");
6
 var RTCUtils = require("./RTCUtils.js");
7
-var JitsiTrack = require("./JitsiTrack");
8
 var JitsiLocalTrack = require("./JitsiLocalTrack.js");
7
 var JitsiLocalTrack = require("./JitsiLocalTrack.js");
9
 import JitsiTrackError from "../../JitsiTrackError";
8
 import JitsiTrackError from "../../JitsiTrackError";
10
 import * as JitsiTrackErrors from "../../JitsiTrackErrors";
9
 import * as JitsiTrackErrors from "../../JitsiTrackErrors";
184
 };
183
 };
185
 
184
 
186
 RTC.removeListener = function (eventType, listener) {
185
 RTC.removeListener = function (eventType, listener) {
187
-    RTCUtils.removeListener(eventType, listener)
186
+    RTCUtils.removeListener(eventType, listener);
188
 };
187
 };
189
 
188
 
190
 RTC.isRTCReady = function () {
189
 RTC.isRTCReady = function () {
548
     if (track) {
547
     if (track) {
549
         track.setMute(isMuted);
548
         track.setMute(isMuted);
550
     }
549
     }
551
-}
550
+};
552
 
551
 
553
 /**
552
 /**
554
  * Handles remote track video type events
553
  * Handles remote track video type events
560
     if (videoTrack) {
559
     if (videoTrack) {
561
         videoTrack._setVideoType(value);
560
         videoTrack._setVideoType(value);
562
     }
561
     }
563
-}
562
+};
564
 
563
 
565
 /**
564
 /**
566
  * Sends message via the datachannels.
565
  * Sends message via the datachannels.
576
     } else {
575
     } else {
577
         throw new Error("Data channels support is disabled!");
576
         throw new Error("Data channels support is disabled!");
578
     }
577
     }
579
-}
578
+};
580
 
579
 
581
 module.exports = RTC;
580
 module.exports = RTC;

+ 3
- 3
modules/RTC/RTCUIHelper.js Прегледај датотеку

1
-/* global $, __filename */
1
+/* global $ */
2
+
2
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var RTCBrowserType = require("./RTCBrowserType");
4
 var RTCBrowserType = require("./RTCBrowserType");
4
-var RTC = require('./RTC');
5
 
5
 
6
 var RTCUIHelper = {
6
 var RTCUIHelper = {
7
 
7
 
58
      */
58
      */
59
     setAutoPlay: function (streamElement, autoPlay) {
59
     setAutoPlay: function (streamElement, autoPlay) {
60
         if (!RTCBrowserType.isIExplorer()) {
60
         if (!RTCBrowserType.isIExplorer()) {
61
-            streamElement.autoplay = true;
61
+            streamElement.autoplay = autoPlay;
62
         }
62
         }
63
     }
63
     }
64
 };
64
 };

+ 20
- 14
modules/RTC/RTCUtils.js Прегледај датотеку

1
-/* global config, require, attachMediaStream, getUserMedia,
2
-   RTCPeerConnection, RTCSessionDescription, RTCIceCandidate, MediaStreamTrack,
3
-   mozRTCPeerConnection, mozRTCSessionDescription, mozRTCIceCandidate,
4
-   webkitRTCPeerConnection, webkitMediaStream, webkitURL
1
+/* global $,
2
+          attachMediaStream,
3
+          MediaStreamTrack,
4
+          RTCIceCandidate,
5
+          RTCPeerConnection,
6
+          RTCSessionDescription,
7
+          mozRTCIceCandidate,
8
+          mozRTCPeerConnection,
9
+          mozRTCSessionDescription,
10
+          webkitMediaStream,
11
+          webkitRTCPeerConnection,
12
+          webkitURL
5
 */
13
 */
6
-/* jshint -W101 */
7
 
14
 
8
 var logger = require("jitsi-meet-logger").getLogger(__filename);
15
 var logger = require("jitsi-meet-logger").getLogger(__filename);
9
 var RTCBrowserType = require("./RTCBrowserType");
16
 var RTCBrowserType = require("./RTCBrowserType");
14
 var EventEmitter = require("events");
21
 var EventEmitter = require("events");
15
 var screenObtainer = require("./ScreenObtainer");
22
 var screenObtainer = require("./ScreenObtainer");
16
 import JitsiTrackError from "../../JitsiTrackError";
23
 import JitsiTrackError from "../../JitsiTrackError";
17
-import * as JitsiTrackErrors from "../../JitsiTrackErrors";
18
 var MediaType = require("../../service/RTC/MediaType");
24
 var MediaType = require("../../service/RTC/MediaType");
19
 var VideoType = require("../../service/RTC/VideoType");
25
 var VideoType = require("../../service/RTC/VideoType");
20
 var CameraFacingMode = require("../../service/RTC/CameraFacingMode");
26
 var CameraFacingMode = require("../../service/RTC/CameraFacingMode");
586
         if (audioVideo) {
592
         if (audioVideo) {
587
             var audioTracks = audioVideo.getAudioTracks();
593
             var audioTracks = audioVideo.getAudioTracks();
588
             if (audioTracks.length) {
594
             if (audioTracks.length) {
595
+                // eslint-disable-next-line new-cap
589
                 audioStream = new webkitMediaStream();
596
                 audioStream = new webkitMediaStream();
590
                 for (var i = 0; i < audioTracks.length; i++) {
597
                 for (var i = 0; i < audioTracks.length; i++) {
591
                     audioStream.addTrack(audioTracks[i]);
598
                     audioStream.addTrack(audioTracks[i]);
594
 
601
 
595
             var videoTracks = audioVideo.getVideoTracks();
602
             var videoTracks = audioVideo.getVideoTracks();
596
             if (videoTracks.length) {
603
             if (videoTracks.length) {
604
+                // eslint-disable-next-line new-cap
597
                 videoStream = new webkitMediaStream();
605
                 videoStream = new webkitMediaStream();
598
                 for (var j = 0; j < videoTracks.length; j++) {
606
                 for (var j = 0; j < videoTracks.length; j++) {
599
                     videoStream.addTrack(videoTracks[j]);
607
                     videoStream.addTrack(videoTracks[j]);
670
         }
678
         }
671
 
679
 
672
         return res;
680
         return res;
673
-    }
681
+    };
674
 }
682
 }
675
 
683
 
676
 /**
684
 /**
777
                     }
785
                     }
778
                     return SDPUtil.filter_special_chars(id);
786
                     return SDPUtil.filter_special_chars(id);
779
                 };
787
                 };
788
+                /* eslint-disable no-native-reassign */
780
                 RTCSessionDescription = mozRTCSessionDescription;
789
                 RTCSessionDescription = mozRTCSessionDescription;
781
                 RTCIceCandidate = mozRTCIceCandidate;
790
                 RTCIceCandidate = mozRTCIceCandidate;
791
+                /* eslint-enable no-native-reassign */
782
             } else if (RTCBrowserType.isChrome() ||
792
             } else if (RTCBrowserType.isChrome() ||
783
                     RTCBrowserType.isOpera() ||
793
                     RTCBrowserType.isOpera() ||
784
                     RTCBrowserType.isNWJS() ||
794
                     RTCBrowserType.isNWJS() ||
842
                 //AdapterJS.WebRTCPlugin.setLogLevel(
852
                 //AdapterJS.WebRTCPlugin.setLogLevel(
843
                 //    AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS.VERBOSE);
853
                 //    AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS.VERBOSE);
844
                 var self = this;
854
                 var self = this;
845
-                AdapterJS.webRTCReady(function (isPlugin) {
855
+                AdapterJS.webRTCReady(function () {
846
 
856
 
847
                     self.peerconnection = RTCPeerConnection;
857
                     self.peerconnection = RTCPeerConnection;
848
                     self.getUserMedia = window.getUserMedia;
858
                     self.getUserMedia = window.getUserMedia;
881
                 });
891
                 });
882
             } else {
892
             } else {
883
                 var errmsg = 'Browser does not appear to be WebRTC-capable';
893
                 var errmsg = 'Browser does not appear to be WebRTC-capable';
884
-                try {
885
-                    logger.error(errmsg);
886
-                } catch (e) {
887
-                }
894
+                logger.error(errmsg);
888
                 reject(new Error(errmsg));
895
                 reject(new Error(errmsg));
889
                 return;
896
                 return;
890
             }
897
             }
910
     **/
917
     **/
911
     getUserMediaWithConstraints: function ( um, success_callback, failure_callback, options) {
918
     getUserMediaWithConstraints: function ( um, success_callback, failure_callback, options) {
912
         options = options || {};
919
         options = options || {};
913
-        var resolution = options.resolution;
914
         var constraints = getConstraints(um, options);
920
         var constraints = getConstraints(um, options);
915
 
921
 
916
         logger.info("Get media constraints", constraints);
922
         logger.info("Get media constraints", constraints);
1051
                                 // set to not ask for permissions)
1057
                                 // set to not ask for permissions)
1052
                                 self.getUserMediaWithConstraints(
1058
                                 self.getUserMediaWithConstraints(
1053
                                     devices,
1059
                                     devices,
1054
-                                    function (stream) {
1060
+                                    function () {
1055
                                         // we already failed to obtain this
1061
                                         // we already failed to obtain this
1056
                                         // media, so we are not supposed in any
1062
                                         // media, so we are not supposed in any
1057
                                         // way to receive success for this call
1063
                                         // way to receive success for this call

+ 5
- 5
modules/RTC/ScreenObtainer.js Прегледај датотеку

1
 /* global chrome, $, alert */
1
 /* global chrome, $, alert */
2
-/* jshint -W003 */
2
+
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
4
 var RTCBrowserType = require("./RTCBrowserType");
4
 var RTCBrowserType = require("./RTCBrowserType");
5
 var AdapterJS = require("./adapter.screenshare");
5
 var AdapterJS = require("./adapter.screenshare");
40
  * The error returned by chrome when trying to start inline installation from
40
  * The error returned by chrome when trying to start inline installation from
41
  * popup.
41
  * popup.
42
  */
42
  */
43
-var CHROME_EXTENSION_POPUP_ERROR =
44
-    "Inline installs can not be initiated from pop-up windows.";
43
+const CHROME_EXTENSION_POPUP_ERROR
44
+    = "Inline installs can not be initiated from pop-up windows.";
45
 
45
 
46
 /**
46
 /**
47
  * The error message returned by chrome when the extension is installed.
47
  * The error message returned by chrome when the extension is installed.
48
  */
48
  */
49
-var CHROME_NO_EXTENSION_ERROR_MSG =
50
-    "Could not establish connection. Receiving end does not exist.";
49
+const CHROME_NO_EXTENSION_ERROR_MSG // eslint-disable-line no-unused-vars
50
+    = "Could not establish connection. Receiving end does not exist.";
51
 
51
 
52
 /**
52
 /**
53
  * Handles obtaining a stream from a screen capture on different browsers.
53
  * Handles obtaining a stream from a screen capture on different browsers.

+ 4
- 4
modules/statistics/AnalyticsAdapter.js Прегледај датотеку

34
         }
34
         }
35
     }
35
     }
36
     try {
36
     try {
37
-        this.analytics.sendEvent(
38
-            action, data, label, this.browserName);
39
-    } catch (ignored) {}
37
+        this.analytics.sendEvent(action, data, label, this.browserName);
38
+    } catch (ignored) { // eslint-disable-line no-empty
39
+    }
40
 };
40
 };
41
 
41
 
42
 /**
42
 /**
65
     }
65
     }
66
 };
66
 };
67
 
67
 
68
-module.exports = new AnalyticsAdapter();
68
+module.exports = new AnalyticsAdapter();

+ 1
- 1
modules/statistics/CallStats.js Прегледај датотеку

139
 var CallStats = _try_catch(function(jingleSession, Settings, options) {
139
 var CallStats = _try_catch(function(jingleSession, Settings, options) {
140
     try{
140
     try{
141
         CallStats.feedbackEnabled = false;
141
         CallStats.feedbackEnabled = false;
142
-        callStats = new callstats($, io, jsSHA);
142
+        callStats = new callstats($, io, jsSHA); // eslint-disable-line new-cap
143
 
143
 
144
         this.session = jingleSession;
144
         this.session = jingleSession;
145
         this.peerconnection = jingleSession.peerconnection.peerconnection;
145
         this.peerconnection = jingleSession.peerconnection.peerconnection;

+ 0
- 1
modules/statistics/LocalStatsCollector.js Прегледај датотеку

1
-/* global config */
2
 /**
1
 /**
3
  * Provides statistics for the local stream.
2
  * Provides statistics for the local stream.
4
  */
3
  */

+ 4
- 5
modules/statistics/RTPStatsCollector.js Прегледај датотеку

1
 /* global require */
1
 /* global require */
2
-/* jshint -W101 */
3
 
2
 
4
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
3
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
5
 var logger = require("jitsi-meet-logger").getLogger(__filename);
4
 var logger = require("jitsi-meet-logger").getLogger(__filename);
468
         // example, if item has a stat property of type function, then it's very
467
         // example, if item has a stat property of type function, then it's very
469
         // likely that whoever defined it wanted you to call it in order to
468
         // likely that whoever defined it wanted you to call it in order to
470
         // retrieve the value associated with a specific key.
469
         // retrieve the value associated with a specific key.
471
-        itemStatByKey = function (item, key) { return item.stat(key) };
470
+        itemStatByKey = function (item, key) { return item.stat(key); };
472
         break;
471
         break;
473
     case RTCBrowserType.RTC_BROWSER_REACT_NATIVE:
472
     case RTCBrowserType.RTC_BROWSER_REACT_NATIVE:
474
         // The implementation provided by react-native-webrtc follows the
473
         // The implementation provided by react-native-webrtc follows the
488
         };
487
         };
489
         break;
488
         break;
490
     default:
489
     default:
491
-        itemStatByKey = function (item, key) { return item[key] };
490
+        itemStatByKey = function (item, key) { return item[key]; };
492
     }
491
     }
493
 
492
 
494
     // Compose the 2 functions defined above to get a function which retrieves
493
     // Compose the 2 functions defined above to get a function which retrieves
495
     // the value from a specific report returned by RTCPeerConnection#getStats
494
     // the value from a specific report returned by RTCPeerConnection#getStats
496
     // associated with a specific LibJitsiMeet browser-agnostic name.
495
     // associated with a specific LibJitsiMeet browser-agnostic name.
497
     return function (item, name) {
496
     return function (item, name) {
498
-        return itemStatByKey(item, keyFromName(name))
497
+        return itemStatByKey(item, keyFromName(name));
499
     };
498
     };
500
 };
499
 };
501
 
500
 
540
             var conferenceStatsTransport = this.conferenceStats.transport;
539
             var conferenceStatsTransport = this.conferenceStats.transport;
541
             if(!conferenceStatsTransport.some(function (t) { return (
540
             if(!conferenceStatsTransport.some(function (t) { return (
542
                         t.ip == ip && t.type == type && t.localip == localip
541
                         t.ip == ip && t.type == type && t.localip == localip
543
-                    )})) {
542
+                    );})) {
544
                 conferenceStatsTransport.push(
543
                 conferenceStatsTransport.push(
545
                     {ip: ip, type: type, localip: localip});
544
                     {ip: ip, type: type, localip: localip});
546
             }
545
             }

+ 4
- 3
modules/transcription/audioRecorder.js Прегледај датотеку

1
-/* global APP, MediaRecorder, MediaStream, webkitMediaStream*/
1
+/* global MediaRecorder, MediaStream, webkitMediaStream */
2
+
2
 var RecordingResult = require("./recordingResult");
3
 var RecordingResult = require("./recordingResult");
3
 
4
 
4
 /**
5
 /**
297
         return new MediaStream();
298
         return new MediaStream();
298
     }
299
     }
299
     else if(typeof(webkitMediaStream) !== 'undefined') {
300
     else if(typeof(webkitMediaStream) !== 'undefined') {
300
-        return new webkitMediaStream();
301
+        return new webkitMediaStream(); // eslint-disable-line new-cap
301
     }
302
     }
302
     else {
303
     else {
303
         throw new Error("cannot create a clean mediaStream");
304
         throw new Error("cannot create a clean mediaStream");
307
 /**
308
 /**
308
  * export the main object audioRecorder
309
  * export the main object audioRecorder
309
  */
310
  */
310
-module.exports = audioRecorder;
311
+module.exports = audioRecorder;

+ 4
- 1
modules/transcription/transcriptionServices/AbstractTranscriptionService.js Прегледај датотеку

41
  * @param {function} callback function which will retrieve the answer
41
  * @param {function} callback function which will retrieve the answer
42
  *                            from the service
42
  *                            from the service
43
  */
43
  */
44
+// eslint-disable-next-line no-unused-vars
44
 TranscriptionService.prototype.sendRequest = function(audioBlob, callback) {
45
 TranscriptionService.prototype.sendRequest = function(audioBlob, callback) {
45
     throw new Error("TranscriptionService.sendRequest is abstract");
46
     throw new Error("TranscriptionService.sendRequest is abstract");
46
 };
47
 };
60
  *                 formatted
61
  *                 formatted
61
  * @return {Array<Word>} an array of Word objects
62
  * @return {Array<Word>} an array of Word objects
62
  */
63
  */
64
+// eslint-disable-next-line no-unused-vars
63
 TranscriptionService.prototype.formatResponse = function(response){
65
 TranscriptionService.prototype.formatResponse = function(response){
64
     throw new Error("TranscriptionService.format is abstract");
66
     throw new Error("TranscriptionService.format is abstract");
65
 };
67
 };
70
  * @param response the response from the server
72
  * @param response the response from the server
71
  * @return {boolean} true if response is valid, false otherwise
73
  * @return {boolean} true if response is valid, false otherwise
72
  */
74
  */
75
+// eslint-disable-next-line no-unused-vars
73
 TranscriptionService.prototype.verify = function(response){
76
 TranscriptionService.prototype.verify = function(response){
74
       throw new Error("TranscriptionService.verify is abstract");
77
       throw new Error("TranscriptionService.verify is abstract");
75
 };
78
 };
76
 
79
 
77
-module.exports = TranscriptionService;
80
+module.exports = TranscriptionService;

+ 2
- 2
modules/transcription/transcriptionServices/SphinxTranscriptionService.js Прегледај датотеку

1
-/* global config,  XMLHttpRequest, console, APP, JSON */
1
+/* global config */
2
 
2
 
3
 var TranscriptionService = require("./AbstractTranscriptionService");
3
 var TranscriptionService = require("./AbstractTranscriptionService");
4
 var Word = require( "../word");
4
 var Word = require( "../word");
127
     }
127
     }
128
 }
128
 }
129
 
129
 
130
-module.exports = SphinxService;
130
+module.exports = SphinxService;

+ 3
- 3
modules/transcription/word.js Прегледај датотеку

2
  * An object representing a transcribed word, with some additional information
2
  * An object representing a transcribed word, with some additional information
3
  * @param word the word 
3
  * @param word the word 
4
  * @param begin the time the word was started being uttered
4
  * @param begin the time the word was started being uttered
5
- * @param end the tome the word stopped being uttered
5
+ * @param end the time the word stopped being uttered
6
  */
6
  */
7
-var Word = function (word, begin, end, name) {
7
+var Word = function (word, begin, end) {
8
     this.word = word;
8
     this.word = word;
9
     this.begin = begin;
9
     this.begin = begin;
10
     this.end = end;
10
     this.end = end;
34
     return this.end;
34
     return this.end;
35
 };
35
 };
36
 
36
 
37
-module.exports = Word;
37
+module.exports = Word;

+ 0
- 2
modules/util/EventEmitterForwarder.js Прегледај датотеку

1
-var EventEmitter = require("events");
2
-
3
 /**
1
 /**
4
  * Implements utility to forward events from one eventEmitter to another.
2
  * Implements utility to forward events from one eventEmitter to another.
5
  * @param src {object} instance of EventEmitter or another class that implements
3
  * @param src {object} instance of EventEmitter or another class that implements

+ 19
- 22
modules/xmpp/ChatRoom.js Прегледај датотеку

1
 /* global Strophe, $, $pres, $iq, $msg */
1
 /* global Strophe, $, $pres, $iq, $msg */
2
-/* jshint -W101,-W069 */
2
+
3
 import {getLogger} from "jitsi-meet-logger";
3
 import {getLogger} from "jitsi-meet-logger";
4
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
9
 var Recorder = require("./recording");
9
 var Recorder = require("./recording");
10
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
10
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
11
 
11
 
12
-var JIBRI_XMLNS = 'http://jitsi.org/protocol/jibri';
13
-
14
 var parser = {
12
 var parser = {
15
     packet2JSON: function (packet, nodes) {
13
     packet2JSON: function (packet, nodes) {
16
         var self = this;
14
         var self = this;
17
-        $(packet).children().each(function (index) {
15
+        $(packet).children().each(function () {
18
             var tagName = $(this).prop("tagName");
16
             var tagName = $(this).prop("tagName");
19
-            var node = {
17
+            const node = {
20
                 tagName: tagName
18
                 tagName: tagName
21
             };
19
             };
22
             node.attributes = {};
20
             node.attributes = {};
33
         });
31
         });
34
     },
32
     },
35
     JSON2packet: function (nodes, packet) {
33
     JSON2packet: function (nodes, packet) {
36
-        for(var i = 0; i < nodes.length; i++) {
37
-            var node = nodes[i];
34
+        for(let i = 0; i < nodes.length; i++) {
35
+            const node = nodes[i];
38
             if(!node || node === null){
36
             if(!node || node === null){
39
                 continue;
37
                 continue;
40
             }
38
             }
56
  */
54
  */
57
 function filterNodeFromPresenceJSON(pres, nodeName){
55
 function filterNodeFromPresenceJSON(pres, nodeName){
58
     var res = [];
56
     var res = [];
59
-    for(var i = 0; i < pres.length; i++)
57
+    for(let i = 0; i < pres.length; i++)
60
         if(pres[i].tagName === nodeName)
58
         if(pres[i].tagName === nodeName)
61
             res.push(pres[i]);
59
             res.push(pres[i]);
62
 
60
 
83
         settings, {connection: this.xmpp.options, conference: this.options});
81
         settings, {connection: this.xmpp.options, conference: this.options});
84
     this.initPresenceMap();
82
     this.initPresenceMap();
85
     this.session = null;
83
     this.session = null;
86
-    var self = this;
87
     this.lastPresences = {};
84
     this.lastPresences = {};
88
     this.phoneNumber = null;
85
     this.phoneNumber = null;
89
     this.phonePin = null;
86
     this.phonePin = null;
276
     member.isHiddenDomain
273
     member.isHiddenDomain
277
         = jid && jid.indexOf("@") > 0
274
         = jid && jid.indexOf("@") > 0
278
             && this.options.hiddenDomain
275
             && this.options.hiddenDomain
279
-                === jid.substring(jid.indexOf("@") + 1, jid.indexOf("/"))
276
+                === jid.substring(jid.indexOf("@") + 1, jid.indexOf("/"));
280
 
277
 
281
     $(pres).find(">x").remove();
278
     $(pres).find(">x").remove();
282
     var nodes = [];
279
     var nodes = [];
283
     parser.packet2JSON(pres, nodes);
280
     parser.packet2JSON(pres, nodes);
284
     this.lastPresences[from] = nodes;
281
     this.lastPresences[from] = nodes;
285
-    var jibri = null;
282
+    let jibri = null;
286
     // process nodes to extract data needed for MUC_JOINED and MUC_MEMBER_JOINED
283
     // process nodes to extract data needed for MUC_JOINED and MUC_MEMBER_JOINED
287
     // events
284
     // events
288
-    for(var i = 0; i < nodes.length; i++)
285
+    for(let i = 0; i < nodes.length; i++)
289
     {
286
     {
290
-        var node = nodes[i];
287
+        const node = nodes[i];
291
         switch(node.tagName)
288
         switch(node.tagName)
292
         {
289
         {
293
             case "nick":
290
             case "nick":
353
 
350
 
354
     // after we had fired member or room joined events, lets fire events
351
     // after we had fired member or room joined events, lets fire events
355
     // for the rest info we got in presence
352
     // for the rest info we got in presence
356
-    for(var i = 0; i < nodes.length; i++)
353
+    for(let i = 0; i < nodes.length; i++)
357
     {
354
     {
358
-        var node = nodes[i];
355
+        const node = nodes[i];
359
         switch(node.tagName)
356
         switch(node.tagName)
360
         {
357
         {
361
             case "nick":
358
             case "nick":
376
                 }
373
                 }
377
                 break;
374
                 break;
378
             case "jibri-recording-status":
375
             case "jibri-recording-status":
379
-                var jibri = node;
376
+                jibri = node;
380
                 break;
377
                 break;
381
             case "call-control":
378
             case "call-control":
382
                 var att = node.attributes;
379
                 var att = node.attributes;
419
             this.recording.handleJibriPresence(this.lastJibri);
416
             this.recording.handleJibriPresence(this.lastJibri);
420
     }
417
     }
421
     logger.info("Ignore focus: " + from + ", real JID: " + mucJid);
418
     logger.info("Ignore focus: " + from + ", real JID: " + mucJid);
422
-}
419
+};
423
 
420
 
424
 /**
421
 /**
425
  * Sets the special listener to be used for "command"s whose name starts with
422
  * Sets the special listener to be used for "command"s whose name starts with
515
     // If the status code is 110 this means we're leaving and we would like
512
     // If the status code is 110 this means we're leaving and we would like
516
     // to remove everyone else from our view, so we trigger the event.
513
     // to remove everyone else from our view, so we trigger the event.
517
     else if (Object.keys(this.members).length > 0) {
514
     else if (Object.keys(this.members).length > 0) {
518
-        for (var i in this.members) {
519
-            var member = this.members[i];
515
+        for (const i in this.members) {
516
+            const member = this.members[i];
520
             delete this.members[i];
517
             delete this.members[i];
521
             this.onParticipantLeft(i, member.isFocus);
518
             this.onParticipantLeft(i, member.isFocus);
522
         }
519
         }
752
     return this.session.generateNewStreamSSRCInfo();
749
     return this.session.generateNewStreamSSRCInfo();
753
 };
750
 };
754
 
751
 
755
-ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
752
+ChatRoom.prototype.setVideoMute = function (mute, callback) {
756
     this.sendVideoInfoPresence(mute);
753
     this.sendVideoInfoPresence(mute);
757
     if(callback)
754
     if(callback)
758
         callback(mute);
755
         callback(mute);
848
  */
845
  */
849
 ChatRoom.prototype.getRecordingState = function () {
846
 ChatRoom.prototype.getRecordingState = function () {
850
     return (this.recording) ? this.recording.getState() : undefined;
847
     return (this.recording) ? this.recording.getState() : undefined;
851
-}
848
+};
852
 
849
 
853
 /**
850
 /**
854
  * Returns the url of the recorded video.
851
  * Returns the url of the recorded video.
855
  */
852
  */
856
 ChatRoom.prototype.getRecordingURL = function () {
853
 ChatRoom.prototype.getRecordingURL = function () {
857
     return (this.recording) ? this.recording.getURL() : null;
854
     return (this.recording) ? this.recording.getURL() : null;
858
-}
855
+};
859
 
856
 
860
 /**
857
 /**
861
  * Starts/stops the recording
858
  * Starts/stops the recording

+ 5
- 0
modules/xmpp/JingleSession.js Прегледај датотеку

92
  * Adds the ICE candidates found in the 'contents' array as remote candidates?
92
  * Adds the ICE candidates found in the 'contents' array as remote candidates?
93
  * Note: currently only used on transport-info
93
  * Note: currently only used on transport-info
94
  */
94
  */
95
+// eslint-disable-next-line no-unused-vars
95
 JingleSession.prototype.addIceCandidates = function(contents) {};
96
 JingleSession.prototype.addIceCandidates = function(contents) {};
96
 
97
 
97
 /**
98
 /**
109
  *
110
  *
110
  * @param contents an array of Jingle 'content' elements.
111
  * @param contents an array of Jingle 'content' elements.
111
  */
112
  */
113
+// eslint-disable-next-line no-unused-vars
112
 JingleSession.prototype.addSources = function(contents) {};
114
 JingleSession.prototype.addSources = function(contents) {};
113
 
115
 
114
 /**
116
 /**
116
  *
118
  *
117
  * @param contents an array of Jingle 'content' elements.
119
  * @param contents an array of Jingle 'content' elements.
118
  */
120
  */
121
+// eslint-disable-next-line no-unused-vars
119
 JingleSession.prototype.removeSources = function(contents) {};
122
 JingleSession.prototype.removeSources = function(contents) {};
120
 
123
 
121
 /**
124
 /**
123
  * @param reason XMPP Jingle error condition
126
  * @param reason XMPP Jingle error condition
124
  * @param text some meaningful error message
127
  * @param text some meaningful error message
125
  */
128
  */
129
+// eslint-disable-next-line no-unused-vars
126
 JingleSession.prototype.terminate = function(reason, text) {};
130
 JingleSession.prototype.terminate = function(reason, text) {};
127
 
131
 
128
 /**
132
 /**
133
  *        object with details(which is meant more to be printed to the logger
137
  *        object with details(which is meant more to be printed to the logger
134
  *        than analysed in the code, as the error is unrecoverable anyway)
138
  *        than analysed in the code, as the error is unrecoverable anyway)
135
  */
139
  */
140
+// eslint-disable-next-line no-unused-vars
136
 JingleSession.prototype.acceptOffer = function(jingle, success, failure) {};
141
 JingleSession.prototype.acceptOffer = function(jingle, success, failure) {};
137
 
142
 
138
 module.exports = JingleSession;
143
 module.exports = JingleSession;

+ 14
- 16
modules/xmpp/JingleSessionPC.js Прегледај датотеку

1
-/* jshint -W117 */
1
+/* global $, $iq */
2
+
2
 import {getLogger} from "jitsi-meet-logger";
3
 import {getLogger} from "jitsi-meet-logger";
3
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
4
 var JingleSession = require("./JingleSession");
5
 var JingleSession = require("./JingleSession");
5
 var TraceablePeerConnection = require("./TraceablePeerConnection");
6
 var TraceablePeerConnection = require("./TraceablePeerConnection");
6
-var MediaType = require("../../service/RTC/MediaType");
7
 var SDPDiffer = require("./SDPDiffer");
7
 var SDPDiffer = require("./SDPDiffer");
8
 var SDPUtil = require("./SDPUtil");
8
 var SDPUtil = require("./SDPUtil");
9
 var SDP = require("./SDP");
9
 var SDP = require("./SDP");
113
     this.peerconnection.onremovestream = function (event) {
113
     this.peerconnection.onremovestream = function (event) {
114
         self.remoteStreamRemoved(event.stream);
114
         self.remoteStreamRemoved(event.stream);
115
     };
115
     };
116
-    this.peerconnection.onsignalingstatechange = function (event) {
116
+    this.peerconnection.onsignalingstatechange = function () {
117
         if (!(self && self.peerconnection)) return;
117
         if (!(self && self.peerconnection)) return;
118
         if (self.peerconnection.signalingState === 'stable') {
118
         if (self.peerconnection.signalingState === 'stable') {
119
             self.wasstable = true;
119
             self.wasstable = true;
120
         }
120
         }
121
     };
121
     };
122
     /**
122
     /**
123
-     * The oniceconnectionstatechange event handler contains the code to execute when the iceconnectionstatechange event,
124
-     * of type Event, is received by this RTCPeerConnection. Such an event is sent when the value of
123
+     * The oniceconnectionstatechange event handler contains the code to execute
124
+     * when the iceconnectionstatechange event, of type Event, is received by
125
+     * this RTCPeerConnection. Such an event is sent when the value of
125
      * RTCPeerConnection.iceConnectionState changes.
126
      * RTCPeerConnection.iceConnectionState changes.
126
-     *
127
-     * @param event the event containing information about the change
128
      */
127
      */
129
-    this.peerconnection.oniceconnectionstatechange = function (event) {
128
+    this.peerconnection.oniceconnectionstatechange = function () {
130
         if (!(self && self.peerconnection)) return;
129
         if (!(self && self.peerconnection)) return;
131
         var now = window.performance.now();
130
         var now = window.performance.now();
132
         self.room.connectionTimes["ice.state." +
131
         self.room.connectionTimes["ice.state." +
158
                 break;
157
                 break;
159
         }
158
         }
160
     };
159
     };
161
-    this.peerconnection.onnegotiationneeded = function (event) {
160
+    this.peerconnection.onnegotiationneeded = function () {
162
         self.room.eventEmitter.emit(XMPPEvents.PEERCONNECTION_READY, self);
161
         self.room.eventEmitter.emit(XMPPEvents.PEERCONNECTION_READY, self);
163
     };
162
     };
164
 };
163
 };
244
 JingleSessionPC.prototype.readSsrcInfo = function (contents) {
243
 JingleSessionPC.prototype.readSsrcInfo = function (contents) {
245
     var self = this;
244
     var self = this;
246
     $(contents).each(function (idx, content) {
245
     $(contents).each(function (idx, content) {
247
-        var name = $(content).attr('name');
248
-        var mediaType = this.getAttribute('name');
249
         var ssrcs = $(content).find('description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
246
         var ssrcs = $(content).find('description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
250
         ssrcs.each(function () {
247
         ssrcs.each(function () {
251
             var ssrc = this.getAttribute('ssrc');
248
             var ssrc = this.getAttribute('ssrc');
578
     // FIXME: dirty waiting
575
     // FIXME: dirty waiting
579
     if (!this.peerconnection.localDescription)
576
     if (!this.peerconnection.localDescription)
580
     {
577
     {
581
-        logger.warn("addSource - localDescription not ready yet")
578
+        logger.warn("addSource - localDescription not ready yet");
582
         setTimeout(function()
579
         setTimeout(function()
583
             {
580
             {
584
                 self.addSource(elem);
581
                 self.addSource(elem);
787
     this.removessrc = [];
784
     this.removessrc = [];
788
 
785
 
789
     sdp.raw = sdp.session + sdp.media.join('');
786
     sdp.raw = sdp.session + sdp.media.join('');
787
+
790
     /**
788
     /**
791
      * Implements a failure callback which reports an error message and an
789
      * Implements a failure callback which reports an error message and an
792
      * optional error through (1) logger, (2) GlobalOnErrorHandler, and (3)
790
      * optional error through (1) logger, (2) GlobalOnErrorHandler, and (3)
805
         }
803
         }
806
         GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
804
         GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
807
         queueCallback(err);
805
         queueCallback(err);
808
-    };
806
+    }
809
 
807
 
810
     var ufrag = getUfrag(sdp.raw);
808
     var ufrag = getUfrag(sdp.raw);
811
     if (ufrag != self.remoteUfrag) {
809
     if (ufrag != self.remoteUfrag) {
915
             errorCallback(error);
913
             errorCallback(error);
916
         }
914
         }
917
     });
915
     });
918
-}
916
+};
919
 
917
 
920
 /**
918
 /**
921
  * Generate ssrc info object for a stream with the following properties:
919
  * Generate ssrc info object for a stream with the following properties:
1019
             errorCallback(error);
1017
             errorCallback(error);
1020
         }
1018
         }
1021
     });
1019
     });
1022
-}
1020
+};
1023
 
1021
 
1024
 /**
1022
 /**
1025
  * Figures out added/removed ssrcs and send update IQs.
1023
  * Figures out added/removed ssrcs and send update IQs.
1484
     var ufragLines = sdp.split('\n').filter(function(line) {
1482
     var ufragLines = sdp.split('\n').filter(function(line) {
1485
         return line.startsWith("a=ice-ufrag:");});
1483
         return line.startsWith("a=ice-ufrag:");});
1486
     if (ufragLines.length > 0) {
1484
     if (ufragLines.length > 0) {
1487
-        return ufragLines[0].substr("a=ice-ufrag:".length)
1485
+        return ufragLines[0].substr("a=ice-ufrag:".length);
1488
     }
1486
     }
1489
 }
1487
 }
1490
 
1488
 

+ 5
- 9
modules/xmpp/SDP.js Прегледај датотеку

1
-/* jshint -W117 */
2
-import {getLogger} from "jitsi-meet-logger";
3
-const logger = getLogger(__filename);
1
+/* global $, APP */
2
+
4
 var SDPUtil = require("./SDPUtil");
3
 var SDPUtil = require("./SDPUtil");
5
 
4
 
6
 // SDP STUFF
5
 // SDP STUFF
128
     });
127
     });
129
     this.raw = this.session + this.media.join('');
128
     this.raw = this.session + this.media.join('');
130
     return lines;
129
     return lines;
131
-}
130
+};
132
 // remove lines matching prefix from a media section specified by mediaindex
131
 // remove lines matching prefix from a media section specified by mediaindex
133
 // TODO: non-numeric mediaindex could match mid
132
 // TODO: non-numeric mediaindex could match mid
134
 SDP.prototype.removeMediaLines = function(mediaindex, prefix) {
133
 SDP.prototype.removeMediaLines = function(mediaindex, prefix) {
139
     });
138
     });
140
     this.raw = this.session + this.media.join('');
139
     this.raw = this.session + this.media.join('');
141
     return lines;
140
     return lines;
142
-}
141
+};
143
 
142
 
144
 // add content's to a jingle element
143
 // add content's to a jingle element
145
 SDP.prototype.toJingle = function (elem, thecreator) {
144
 SDP.prototype.toJingle = function (elem, thecreator) {
146
-//    logger.log("SSRC" + ssrcs["audio"] + " - " + ssrcs["video"]);
147
-    var self = this;
148
     var i, j, k, mline, ssrc, rtpmap, tmp, lines;
145
     var i, j, k, mline, ssrc, rtpmap, tmp, lines;
149
     // new bundle plan
146
     // new bundle plan
150
     lines = SDPUtil.find_lines(this.session, 'a=group:');
147
     lines = SDPUtil.find_lines(this.session, 'a=group:');
400
         }
397
         }
401
     }
398
     }
402
     elem.up(); // end of transport
399
     elem.up(); // end of transport
403
-}
400
+};
404
 
401
 
405
 SDP.prototype.rtcpFbToJingle = function (mediaindex, elem, payloadtype) { // XEP-0293
402
 SDP.prototype.rtcpFbToJingle = function (mediaindex, elem, payloadtype) { // XEP-0293
406
     var lines = SDPUtil.find_lines(this.media[mediaindex], 'a=rtcp-fb:' + payloadtype);
403
     var lines = SDPUtil.find_lines(this.media[mediaindex], 'a=rtcp-fb:' + payloadtype);
482
 SDP.prototype.jingle2media = function (content) {
479
 SDP.prototype.jingle2media = function (content) {
483
     var media = '',
480
     var media = '',
484
         desc = content.find('description'),
481
         desc = content.find('description'),
485
-        ssrc = desc.attr('ssrc'),
486
         self = this,
482
         self = this,
487
         tmp;
483
         tmp;
488
     var sctp = content.find(
484
     var sctp = content.find(

+ 14
- 10
modules/xmpp/TraceablePeerConnection.js Прегледај датотеку

1
-/* global $ */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global mozRTCPeerConnection, webkitRTCPeerConnection */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
4
 var RTC = require('../RTC/RTC');
5
 var RTC = require('../RTC/RTC');
5
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
6
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
187
             var ssrcOperation = SSRCs[0];
188
             var ssrcOperation = SSRCs[0];
188
             switch(ssrcOperation.type) {
189
             switch(ssrcOperation.type) {
189
                 case "mute":
190
                 case "mute":
190
-                case "addMuted":
191
+                case "addMuted": {
191
                 //FIXME: If we want to support multiple streams we have to add
192
                 //FIXME: If we want to support multiple streams we have to add
192
                 // recv-only ssrcs for the
193
                 // recv-only ssrcs for the
193
                 // muted streams on every change until the stream is unmuted
194
                 // muted streams on every change until the stream is unmuted
195
                 // in the SDP
196
                 // in the SDP
196
                     if(!bLine.ssrcs)
197
                     if(!bLine.ssrcs)
197
                         bLine.ssrcs = [];
198
                         bLine.ssrcs = [];
198
-                    var groups = ssrcOperation.ssrc.groups;
199
-                    var ssrc = null;
199
+                    const groups = ssrcOperation.ssrc.groups;
200
+                    let ssrc = null;
200
                     if(groups && groups.length) {
201
                     if(groups && groups.length) {
201
                         ssrc = groups[0].primarySSRC;
202
                         ssrc = groups[0].primarySSRC;
202
                     } else if(ssrcOperation.ssrc.ssrcs &&
203
                     } else if(ssrcOperation.ssrc.ssrcs &&
219
                     // only 1 video stream that is muted.
220
                     // only 1 video stream that is muted.
220
                     this.recvOnlySSRCs[bLine.type] = ssrc;
221
                     this.recvOnlySSRCs[bLine.type] = ssrc;
221
                     break;
222
                     break;
222
-                case "unmute":
223
+                }
224
+                case "unmute": {
223
                     if(!ssrcOperation.ssrc || !ssrcOperation.ssrc.ssrcs ||
225
                     if(!ssrcOperation.ssrc || !ssrcOperation.ssrc.ssrcs ||
224
                         !ssrcOperation.ssrc.ssrcs.length)
226
                         !ssrcOperation.ssrc.ssrcs.length)
225
                         break;
227
                         break;
226
                     var ssrcMap = {};
228
                     var ssrcMap = {};
227
                     var ssrcLastIdx = ssrcOperation.ssrc.ssrcs.length - 1;
229
                     var ssrcLastIdx = ssrcOperation.ssrc.ssrcs.length - 1;
228
                     for(var i = 0; i < bLine.ssrcs.length; i++) {
230
                     for(var i = 0; i < bLine.ssrcs.length; i++) {
229
-                        var ssrc = bLine.ssrcs[i];
231
+                        const ssrc = bLine.ssrcs[i];
230
                         if (ssrc.attribute !== 'msid' &&
232
                         if (ssrc.attribute !== 'msid' &&
231
                             ssrc.value !== ssrcOperation.msid) {
233
                             ssrc.value !== ssrcOperation.msid) {
232
                             continue;
234
                             continue;
237
                         if(ssrcLastIdx < 0)
239
                         if(ssrcLastIdx < 0)
238
                             break;
240
                             break;
239
                     }
241
                     }
240
-                    var groups = ssrcOperation.ssrc.groups;
242
+                    const groups = ssrcOperation.ssrc.groups;
241
                     if (typeof bLine.ssrcGroups !== 'undefined' &&
243
                     if (typeof bLine.ssrcGroups !== 'undefined' &&
242
                         Array.isArray(bLine.ssrcGroups) && groups &&
244
                         Array.isArray(bLine.ssrcGroups) && groups &&
243
                         groups.length) {
245
                         groups.length) {
278
                     // Storing the unmuted SSRCs.
280
                     // Storing the unmuted SSRCs.
279
                     permSSRCs.push(ssrcOperation);
281
                     permSSRCs.push(ssrcOperation);
280
                     break;
282
                     break;
283
+                }
281
                 default:
284
                 default:
282
-                break;
285
+                    break;
283
             }
286
             }
284
             SSRCs = this.replaceSSRCs[bLine.type].splice(0,1);
287
             SSRCs = this.replaceSSRCs[bLine.type].splice(0,1);
285
         }
288
         }
288
 
291
 
289
         if (!Array.isArray(bLine.ssrcs) || bLine.ssrcs.length === 0)
292
         if (!Array.isArray(bLine.ssrcs) || bLine.ssrcs.length === 0)
290
         {
293
         {
291
-            var ssrc = this.recvOnlySSRCs[bLine.type]
294
+            const ssrc = this.recvOnlySSRCs[bLine.type]
292
                 = this.recvOnlySSRCs[bLine.type] ||
295
                 = this.recvOnlySSRCs[bLine.type] ||
293
                     RandomUtil.randomInt(1, 0xffffffff);
296
                     RandomUtil.randomInt(1, 0xffffffff);
294
             bLine.ssrcs = [{
297
             bLine.ssrcs = [{
636
 };
639
 };
637
 
640
 
638
 TraceablePeerConnection.prototype.addIceCandidate
641
 TraceablePeerConnection.prototype.addIceCandidate
642
+        // eslint-disable-next-line no-unused-vars
639
         = function (candidate, successCallback, failureCallback) {
643
         = function (candidate, successCallback, failureCallback) {
640
     //var self = this;
644
     //var self = this;
641
     this.trace('addIceCandidate', JSON.stringify(candidate, null, ' '));
645
     this.trace('addIceCandidate', JSON.stringify(candidate, null, ' '));

+ 4
- 4
modules/xmpp/recording.js Прегледај датотеку

1
-/* global $, $iq, config, connection, focusMucJid, messageHandler,
2
-   Toolbar, Util, Promise */
3
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $iq */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
4
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
6
 var JitsiRecorderErrors = require("../../JitsiRecorderErrors");
6
 var JitsiRecorderErrors = require("../../JitsiRecorderErrors");
116
 };
116
 };
117
 
117
 
118
 Recording.prototype.setRecordingJirecon =
118
 Recording.prototype.setRecordingJirecon =
119
-    function (state, callback, errCallback, options) {
119
+    function (state, callback, errCallback) {
120
 
120
 
121
     if (state == this.state){
121
     if (state == this.state){
122
         errCallback(new Error("Invalid state!"));
122
         errCallback(new Error("Invalid state!"));

+ 3
- 2
modules/xmpp/strophe.emuc.js Прегледај датотеку

1
-/* jshint -W117 */
2
 /* a simple MUC connection plugin
1
 /* a simple MUC connection plugin
3
  * can only handle a single MUC room
2
  * can only handle a single MUC room
4
  */
3
  */
4
+
5
+/* global $, Strophe */
6
+
5
 import {getLogger} from "jitsi-meet-logger";
7
 import {getLogger} from "jitsi-meet-logger";
6
 const logger = getLogger(__filename);
8
 const logger = getLogger(__filename);
7
 import ChatRoom from "./ChatRoom";
9
 import ChatRoom from "./ChatRoom";
35
             const errmsg = "You are already in the room!";
37
             const errmsg = "You are already in the room!";
36
             logger.error(errmsg);
38
             logger.error(errmsg);
37
             throw new Error(errmsg);
39
             throw new Error(errmsg);
38
-            return;
39
         }
40
         }
40
         this.rooms[roomJid] = new ChatRoom(this.connection, jid,
41
         this.rooms[roomJid] = new ChatRoom(this.connection, jid,
41
             password, this.xmpp, options, settings);
42
             password, this.xmpp, options, settings);

+ 10
- 7
modules/xmpp/strophe.jingle.js Прегледај датотеку

1
-/* jshint -W117 */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $iq, Strophe */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
4
 import JingleSession from "./JingleSessionPC";
5
 import JingleSession from "./JingleSessionPC";
5
 import XMPPEvents from "../../service/xmpp/XMPPEvents";
6
 import XMPPEvents from "../../service/xmpp/XMPPEvents";
6
-import RTCBrowserType from "../RTC/RTCBrowserType";
7
 import GlobalOnErrorHandler from "../util/GlobalOnErrorHandler";
7
 import GlobalOnErrorHandler from "../util/GlobalOnErrorHandler";
8
 import Statistics from "../statistics/statistics";
8
 import Statistics from "../statistics/statistics";
9
 import ConnectionPlugin from "./ConnectionPlugin";
9
 import ConnectionPlugin from "./ConnectionPlugin";
76
         const now = window.performance.now();
76
         const now = window.performance.now();
77
         // see http://xmpp.org/extensions/xep-0166.html#concepts-session
77
         // see http://xmpp.org/extensions/xep-0166.html#concepts-session
78
         switch (action) {
78
         switch (action) {
79
-            case 'session-initiate':
79
+            case 'session-initiate': {
80
                 logger.log("(TIME) received session-initiate:\t", now);
80
                 logger.log("(TIME) received session-initiate:\t", now);
81
                 const startMuted = $(iq).find('jingle>startmuted');
81
                 const startMuted = $(iq).find('jingle>startmuted');
82
                 if (startMuted && startMuted.length > 0) {
82
                 if (startMuted && startMuted.length > 0) {
112
                 Statistics.analytics.sendEvent(
112
                 Statistics.analytics.sendEvent(
113
                     'xmpp.session-initiate', now);
113
                     'xmpp.session-initiate', now);
114
                 break;
114
                 break;
115
-            case 'session-terminate':
115
+            }
116
+            case 'session-terminate': {
116
                 logger.log('terminating...', sess.sid);
117
                 logger.log('terminating...', sess.sid);
117
                 let reasonCondition = null;
118
                 let reasonCondition = null;
118
                 let reasonText = null;
119
                 let reasonText = null;
125
                 this.eventEmitter.emit(XMPPEvents.CALL_ENDED,
126
                 this.eventEmitter.emit(XMPPEvents.CALL_ENDED,
126
                     sess, reasonCondition, reasonText);
127
                     sess, reasonCondition, reasonText);
127
                 break;
128
                 break;
129
+            }
128
             case 'transport-replace':
130
             case 'transport-replace':
129
                 logger.info("(TIME) Start transport replace", now);
131
                 logger.info("(TIME) Start transport replace", now);
130
                 Statistics.analytics.sendEvent(
132
                 Statistics.analytics.sendEvent(
203
                             iceservers.push(dict);
205
                             iceservers.push(dict);
204
                             break;
206
                             break;
205
                         case 'turn':
207
                         case 'turn':
206
-                        case 'turns':
208
+                        case 'turns': {
207
                             dict.url = type + ':';
209
                             dict.url = type + ':';
208
                             const username = el.attr('username');
210
                             const username = el.attr('username');
209
                             // https://code.google.com/p/webrtc/issues/detail?id=1508
211
                             // https://code.google.com/p/webrtc/issues/detail?id=1508
234
                                 || dict.credential;
236
                                 || dict.credential;
235
                             iceservers.push(dict);
237
                             iceservers.push(dict);
236
                             break;
238
                             break;
239
+                        }
237
                     }
240
                     }
238
                 });
241
                 });
239
                 self.ice_config.iceServers = iceservers;
242
                 self.ice_config.iceServers = iceservers;
251
         const data = {};
254
         const data = {};
252
         Object.keys(this.sessions).forEach((sid) => {
255
         Object.keys(this.sessions).forEach((sid) => {
253
             const session = self.sessions[sid];
256
             const session = self.sessions[sid];
254
-            const pc = session.peerconnection
257
+            const pc = session.peerconnection;
255
             if (pc && pc.updateLog) {
258
             if (pc && pc.updateLog) {
256
                 // FIXME: should probably be a .dump call
259
                 // FIXME: should probably be a .dump call
257
                 data["jingle_" + sid] = {
260
                 data["jingle_" + sid] = {

+ 4
- 4
modules/xmpp/strophe.ping.js Прегледај датотеку

1
 /* global $, $iq, Strophe */
1
 /* global $, $iq, Strophe */
2
-import {getLogger} from "jitsi-meet-logger";
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
4
-import GlobalOnErrorHandler from "../util/GlobalOnErrorHandler";
5
-import XMPPEvents from "../../service/xmpp/XMPPEvents";
6
 import ConnectionPlugin from "./ConnectionPlugin";
5
 import ConnectionPlugin from "./ConnectionPlugin";
6
+import GlobalOnErrorHandler from "../util/GlobalOnErrorHandler";
7
 
7
 
8
 /**
8
 /**
9
  * Ping every 10 sec
9
  * Ping every 10 sec
103
             return;
103
             return;
104
         }
104
         }
105
         this.intervalId = window.setInterval(() => {
105
         this.intervalId = window.setInterval(() => {
106
-            this.ping(remoteJid, (result) => {
106
+            this.ping(remoteJid, () => {
107
                 this.failedPings = 0;
107
                 this.failedPings = 0;
108
             }, (error) => {
108
             }, (error) => {
109
                 this.failedPings += 1;
109
                 this.failedPings += 1;

+ 4
- 3
modules/xmpp/strophe.rayo.js Прегледај датотеку

1
-/* jshint -W117 */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $iq, Strophe */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
4
 import ConnectionPlugin from "./ConnectionPlugin";
5
 import ConnectionPlugin from "./ConnectionPlugin";
5
 
6
 
32
                 to: focusMucJid
33
                 to: focusMucJid
33
             });
34
             });
34
             req.c('dial', {
35
             req.c('dial', {
35
-                xmlns: self.RAYO_XMLNS,
36
+                xmlns: RAYO_XMLNS,
36
                 to: to,
37
                 to: to,
37
                 from: from
38
                 from: from
38
             });
39
             });

+ 5
- 7
modules/xmpp/xmpp.js Прегледај датотеку

1
-/* global $, APP, config, Strophe */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $msg, Base64, Strophe */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
4
 import EventEmitter from "events";
5
 import EventEmitter from "events";
5
 import Pako from "pako";
6
 import Pako from "pako";
6
 import RandomUtil from "../util/RandomUtil";
7
 import RandomUtil from "../util/RandomUtil";
7
-import RTCEvents from "../../service/RTC/RTCEvents";
8
-import XMPPEvents from "../../service/xmpp/XMPPEvents";
9
 import * as JitsiConnectionErrors from "../../JitsiConnectionErrors";
8
 import * as JitsiConnectionErrors from "../../JitsiConnectionErrors";
10
 import * as JitsiConnectionEvents from "../../JitsiConnectionEvents";
9
 import * as JitsiConnectionEvents from "../../JitsiConnectionEvents";
11
-import RTC from "../RTC/RTC";
12
 import RTCBrowserType from "../RTC/RTCBrowserType";
10
 import RTCBrowserType from "../RTC/RTCBrowserType";
13
 import initEmuc from "./strophe.emuc";
11
 import initEmuc from "./strophe.emuc";
14
 import initJingle from "./strophe.jingle";
12
 import initJingle from "./strophe.jingle";
24
     }
22
     }
25
 
23
 
26
     return new Strophe.Connection(bosh);
24
     return new Strophe.Connection(bosh);
27
-};
25
+}
28
 
26
 
29
 export default class XMPP {
27
 export default class XMPP {
30
     constructor(options, token) {
28
     constructor(options, token) {
273
 
271
 
274
     removeListener (type, listener) {
272
     removeListener (type, listener) {
275
         this.eventEmitter.removeListener(type, listener);
273
         this.eventEmitter.removeListener(type, listener);
276
-    };
274
+    }
277
 
275
 
278
     /**
276
     /**
279
      * Sends 'data' as a log message to the focus. Returns true iff a message
277
      * Sends 'data' as a log message to the focus. Returns true iff a message

+ 2
- 1
package.json Прегледај датотеку

35
     "babel-polyfill": "*",
35
     "babel-polyfill": "*",
36
     "babel-preset-es2015": "*",
36
     "babel-preset-es2015": "*",
37
     "babel-register": "*",
37
     "babel-register": "*",
38
+    "eslint": "*",
38
     "jshint": "^2.8.0",
39
     "jshint": "^2.8.0",
39
     "precommit-hook": "^3.0.0",
40
     "precommit-hook": "^3.0.0",
40
     "string-replace-loader": "*",
41
     "string-replace-loader": "*",
42
   },
43
   },
43
   "scripts": {
44
   "scripts": {
44
     "install": "webpack -p",
45
     "install": "webpack -p",
45
-    "lint": "jshint .",
46
+    "lint": "jshint . && eslint .",
46
     "validate": "npm ls"
47
     "validate": "npm ls"
47
   },
48
   },
48
   "pre-commit": [
49
   "pre-commit": [

Loading…
Откажи
Сачувај