quickblox 2.20.0 → 2.21.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/quickblox.d.ts +1 -0
- package/quickblox.js +138 -4
- package/src/qbConfig.js +2 -1
- package/src/qbMain.js +24 -0
- package/src/qbProxy.js +46 -1
- package/src/qbUtils.js +66 -2
package/package.json
CHANGED
package/quickblox.d.ts
CHANGED
package/quickblox.js
CHANGED
|
@@ -55079,7 +55079,7 @@ module.exports = StreamManagement;
|
|
|
55079
55079
|
|
|
55080
55080
|
var config = {
|
|
55081
55081
|
version: '2.20.0',
|
|
55082
|
-
buildNumber: '
|
|
55082
|
+
buildNumber: '1166',
|
|
55083
55083
|
creds: {
|
|
55084
55084
|
'appId': 0,
|
|
55085
55085
|
'authKey': '',
|
|
@@ -55101,6 +55101,7 @@ var config = {
|
|
|
55101
55101
|
active: 2
|
|
55102
55102
|
},
|
|
55103
55103
|
pingTimeout: 1,
|
|
55104
|
+
pingDebug: false,
|
|
55104
55105
|
pingLocalhostTimeInterval: 5,
|
|
55105
55106
|
chatReconnectionTimeInterval: 3,
|
|
55106
55107
|
webrtc: {
|
|
@@ -55206,6 +55207,9 @@ module.exports = config;
|
|
|
55206
55207
|
var config = require('./qbConfig');
|
|
55207
55208
|
var Utils = require('./qbUtils');
|
|
55208
55209
|
const MessageProxy = require("./modules/chat/qbMessage");
|
|
55210
|
+
const Chat = require("./modules/chat/qbChat");
|
|
55211
|
+
const DialogProxy = require("./modules/chat/qbDialog");
|
|
55212
|
+
const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
|
|
55209
55213
|
|
|
55210
55214
|
// Actual QuickBlox API starts here
|
|
55211
55215
|
function QuickBlox() {}
|
|
@@ -55318,6 +55322,7 @@ QuickBlox.prototype = {
|
|
|
55318
55322
|
config.urls.type
|
|
55319
55323
|
].join('');
|
|
55320
55324
|
// account settings
|
|
55325
|
+
var self = this;
|
|
55321
55326
|
this.service.ajax({
|
|
55322
55327
|
url: accountSettingsUrl
|
|
55323
55328
|
}, function (err, response) {
|
|
@@ -55329,6 +55334,26 @@ QuickBlox.prototype = {
|
|
|
55329
55334
|
}
|
|
55330
55335
|
};
|
|
55331
55336
|
config.set(update);
|
|
55337
|
+
//
|
|
55338
|
+
self.chat = new Chat(self.service);
|
|
55339
|
+
self.chat.dialog = new DialogProxy(self.service);
|
|
55340
|
+
self.chat.message = new MessageProxy(self.service);
|
|
55341
|
+
//
|
|
55342
|
+
if (Utils.getEnv().browser) {
|
|
55343
|
+
/** add adapter.js*/
|
|
55344
|
+
require('webrtc-adapter');
|
|
55345
|
+
|
|
55346
|
+
/** add WebRTC API if API is avaible */
|
|
55347
|
+
if( Utils.isWebRTCAvailble() ) {
|
|
55348
|
+
var WebRTCClient = require('./modules/webrtc/qbWebRTCClient');
|
|
55349
|
+
self.webrtc = new WebRTCClient(self.service, self.chat);
|
|
55350
|
+
} else {
|
|
55351
|
+
self.webrtc = false;
|
|
55352
|
+
}
|
|
55353
|
+
} else {
|
|
55354
|
+
self.webrtc = false;
|
|
55355
|
+
}
|
|
55356
|
+
//
|
|
55332
55357
|
}
|
|
55333
55358
|
});
|
|
55334
55359
|
}
|
|
@@ -55755,13 +55780,58 @@ ServiceProxy.prototype = {
|
|
|
55755
55780
|
|
|
55756
55781
|
self.handleResponse(null, body, callback, retry);
|
|
55757
55782
|
}
|
|
55783
|
+
// if (self._fetchingSettings) {
|
|
55784
|
+
// self._fetchingSettings = false;
|
|
55785
|
+
// while (self._queue.length) {
|
|
55786
|
+
// var args = self._queue.shift();
|
|
55787
|
+
// self.ajax.apply(self, args);
|
|
55788
|
+
// }
|
|
55789
|
+
// }
|
|
55790
|
+
//
|
|
55758
55791
|
if (self._fetchingSettings) {
|
|
55759
55792
|
self._fetchingSettings = false;
|
|
55793
|
+
|
|
55794
|
+
var sharedApiHost = 'api.quickblox.com';
|
|
55795
|
+
var sharedChatHost = 'chat.quickblox.com';
|
|
55796
|
+
|
|
55797
|
+
sharedApiHost = sharedApiHost.replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
55798
|
+
sharedChatHost = sharedChatHost.replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
55799
|
+
|
|
55800
|
+
var RE_SHARED_API = new RegExp('^https?://' + sharedApiHost.replace(/\./g, '\\.') + '(?=[:/]|$)', 'i');
|
|
55801
|
+
var RE_SHARED_CHAT = new RegExp('^https?://' + sharedChatHost.replace(/\./g, '\\.') + '(?=[:/]|$)', 'i');
|
|
55802
|
+
|
|
55803
|
+
var newApiHost = (self.qbInst.config.endpoints.api || '').replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
55804
|
+
var newChatHost = (self.qbInst.config.endpoints.chat || '').replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
55805
|
+
var NEW_API_URL = 'https://' + newApiHost;
|
|
55806
|
+
var NEW_CHAT_URL = 'https://' + newChatHost;
|
|
55807
|
+
|
|
55760
55808
|
while (self._queue.length) {
|
|
55761
|
-
var args = self._queue.shift();
|
|
55809
|
+
var args = self._queue.shift(); // [params, callback]
|
|
55810
|
+
var p = args && args[0];
|
|
55811
|
+
|
|
55812
|
+
if (p && typeof p.url === 'string') {
|
|
55813
|
+
var url = p.url;
|
|
55814
|
+
var changed = false;
|
|
55815
|
+
|
|
55816
|
+
if (RE_SHARED_API.test(url)) {
|
|
55817
|
+
url = url.replace(RE_SHARED_API, NEW_API_URL);
|
|
55818
|
+
changed = true;
|
|
55819
|
+
}
|
|
55820
|
+
if (RE_SHARED_CHAT.test(url)) {
|
|
55821
|
+
url = url.replace(RE_SHARED_CHAT, NEW_CHAT_URL);
|
|
55822
|
+
changed = true;
|
|
55823
|
+
}
|
|
55824
|
+
|
|
55825
|
+
if (changed) {
|
|
55826
|
+
p.url = url;
|
|
55827
|
+
}
|
|
55828
|
+
}
|
|
55829
|
+
|
|
55762
55830
|
self.ajax.apply(self, args);
|
|
55763
55831
|
}
|
|
55764
55832
|
}
|
|
55833
|
+
|
|
55834
|
+
//
|
|
55765
55835
|
}
|
|
55766
55836
|
|
|
55767
55837
|
function retry(session) {
|
|
@@ -56029,9 +56099,68 @@ var Utils = {
|
|
|
56029
56099
|
},
|
|
56030
56100
|
|
|
56031
56101
|
QBLog: function(){
|
|
56102
|
+
var argsArr = Array.prototype.slice.call(arguments);
|
|
56103
|
+
|
|
56104
|
+
function containsPing(x) {
|
|
56105
|
+
var needle = 'ping';
|
|
56106
|
+
|
|
56107
|
+
try {
|
|
56108
|
+
if (x == null) return false;
|
|
56109
|
+
|
|
56110
|
+
if (typeof x === 'string') {
|
|
56111
|
+
return x.toLowerCase().indexOf(needle) !== -1;
|
|
56112
|
+
}
|
|
56113
|
+
|
|
56114
|
+
if (typeof x === 'number' || typeof x === 'boolean') {
|
|
56115
|
+
return false;
|
|
56116
|
+
}
|
|
56117
|
+
|
|
56118
|
+
if (typeof x === 'object') {
|
|
56119
|
+
//DELETE XEP-0198 SM packages from log:
|
|
56120
|
+
// <r xmlns="urn:xmpp:sm:3"/> and <a xmlns="urn:xmpp:sm:3" h="..."/>
|
|
56121
|
+
if (typeof x.outerHTML === 'string') {
|
|
56122
|
+
var oh = x.outerHTML.replace(/\s+/g, ' ').toLowerCase();
|
|
56123
|
+
if (
|
|
56124
|
+
oh.indexOf('urn:xmpp:sm:3') !== -1 &&
|
|
56125
|
+
(/^<\s*r\b/.test(oh) || /^<\s*a\b/.test(oh))
|
|
56126
|
+
) {
|
|
56127
|
+
return true;
|
|
56128
|
+
}
|
|
56129
|
+
}
|
|
56130
|
+
|
|
56131
|
+
var candidates = [
|
|
56132
|
+
x.textContent,
|
|
56133
|
+
x.innerHTML,
|
|
56134
|
+
x.outerHTML,
|
|
56135
|
+
x.nodeName,
|
|
56136
|
+
x.tagName,
|
|
56137
|
+
x.id
|
|
56138
|
+
];
|
|
56139
|
+
|
|
56140
|
+
for (var j = 0; j < candidates.length; j++) {
|
|
56141
|
+
var s = candidates[j];
|
|
56142
|
+
if (typeof s === 'string' && s.toLowerCase().indexOf(needle) !== -1) {
|
|
56143
|
+
return true;
|
|
56144
|
+
}
|
|
56145
|
+
}
|
|
56146
|
+
}
|
|
56147
|
+
} catch (_) {}
|
|
56148
|
+
|
|
56149
|
+
return false;
|
|
56150
|
+
}
|
|
56151
|
+
|
|
56152
|
+
|
|
56153
|
+
let shouldSuppressPing1 =
|
|
56154
|
+
config && config.pingDebug === false;
|
|
56155
|
+
let shouldSuppressPing2 =argsArr.some(containsPing);
|
|
56156
|
+
|
|
56157
|
+
let shouldSuppressPing = shouldSuppressPing1 && shouldSuppressPing2;
|
|
56158
|
+
|
|
56032
56159
|
if (this.loggers) {
|
|
56033
56160
|
for (var i=0; i<this.loggers.length; ++i) {
|
|
56034
|
-
|
|
56161
|
+
if (!shouldSuppressPing) {
|
|
56162
|
+
this.loggers[i](arguments);
|
|
56163
|
+
}
|
|
56035
56164
|
}
|
|
56036
56165
|
|
|
56037
56166
|
return;
|
|
@@ -56112,7 +56241,12 @@ var Utils = {
|
|
|
56112
56241
|
|
|
56113
56242
|
if(this.loggers){
|
|
56114
56243
|
for(var j=0;j<this.loggers.length;++j){
|
|
56115
|
-
this.loggers[j](arguments);
|
|
56244
|
+
// this.loggers[j](arguments);
|
|
56245
|
+
//
|
|
56246
|
+
if (!shouldSuppressPing) {
|
|
56247
|
+
this.loggers[j](arguments);
|
|
56248
|
+
}
|
|
56249
|
+
//
|
|
56116
56250
|
}
|
|
56117
56251
|
}
|
|
56118
56252
|
},
|
package/src/qbConfig.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
var config = {
|
|
15
15
|
version: '2.20.0',
|
|
16
|
-
buildNumber: '
|
|
16
|
+
buildNumber: '1166',
|
|
17
17
|
creds: {
|
|
18
18
|
'appId': 0,
|
|
19
19
|
'authKey': '',
|
|
@@ -35,6 +35,7 @@ var config = {
|
|
|
35
35
|
active: 2
|
|
36
36
|
},
|
|
37
37
|
pingTimeout: 1,
|
|
38
|
+
pingDebug: false,
|
|
38
39
|
pingLocalhostTimeInterval: 5,
|
|
39
40
|
chatReconnectionTimeInterval: 3,
|
|
40
41
|
webrtc: {
|
package/src/qbMain.js
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
var config = require('./qbConfig');
|
|
10
10
|
var Utils = require('./qbUtils');
|
|
11
11
|
const MessageProxy = require("./modules/chat/qbMessage");
|
|
12
|
+
const Chat = require("./modules/chat/qbChat");
|
|
13
|
+
const DialogProxy = require("./modules/chat/qbDialog");
|
|
14
|
+
const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
|
|
12
15
|
|
|
13
16
|
// Actual QuickBlox API starts here
|
|
14
17
|
function QuickBlox() {}
|
|
@@ -121,6 +124,7 @@ QuickBlox.prototype = {
|
|
|
121
124
|
config.urls.type
|
|
122
125
|
].join('');
|
|
123
126
|
// account settings
|
|
127
|
+
var self = this;
|
|
124
128
|
this.service.ajax({
|
|
125
129
|
url: accountSettingsUrl
|
|
126
130
|
}, function (err, response) {
|
|
@@ -132,6 +136,26 @@ QuickBlox.prototype = {
|
|
|
132
136
|
}
|
|
133
137
|
};
|
|
134
138
|
config.set(update);
|
|
139
|
+
//
|
|
140
|
+
self.chat = new Chat(self.service);
|
|
141
|
+
self.chat.dialog = new DialogProxy(self.service);
|
|
142
|
+
self.chat.message = new MessageProxy(self.service);
|
|
143
|
+
//
|
|
144
|
+
if (Utils.getEnv().browser) {
|
|
145
|
+
/** add adapter.js*/
|
|
146
|
+
require('webrtc-adapter');
|
|
147
|
+
|
|
148
|
+
/** add WebRTC API if API is avaible */
|
|
149
|
+
if( Utils.isWebRTCAvailble() ) {
|
|
150
|
+
var WebRTCClient = require('./modules/webrtc/qbWebRTCClient');
|
|
151
|
+
self.webrtc = new WebRTCClient(self.service, self.chat);
|
|
152
|
+
} else {
|
|
153
|
+
self.webrtc = false;
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
self.webrtc = false;
|
|
157
|
+
}
|
|
158
|
+
//
|
|
135
159
|
}
|
|
136
160
|
});
|
|
137
161
|
}
|
package/src/qbProxy.js
CHANGED
|
@@ -276,13 +276,58 @@ ServiceProxy.prototype = {
|
|
|
276
276
|
|
|
277
277
|
self.handleResponse(null, body, callback, retry);
|
|
278
278
|
}
|
|
279
|
+
// if (self._fetchingSettings) {
|
|
280
|
+
// self._fetchingSettings = false;
|
|
281
|
+
// while (self._queue.length) {
|
|
282
|
+
// var args = self._queue.shift();
|
|
283
|
+
// self.ajax.apply(self, args);
|
|
284
|
+
// }
|
|
285
|
+
// }
|
|
286
|
+
//
|
|
279
287
|
if (self._fetchingSettings) {
|
|
280
288
|
self._fetchingSettings = false;
|
|
289
|
+
|
|
290
|
+
var sharedApiHost = 'api.quickblox.com';
|
|
291
|
+
var sharedChatHost = 'chat.quickblox.com';
|
|
292
|
+
|
|
293
|
+
sharedApiHost = sharedApiHost.replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
294
|
+
sharedChatHost = sharedChatHost.replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
295
|
+
|
|
296
|
+
var RE_SHARED_API = new RegExp('^https?://' + sharedApiHost.replace(/\./g, '\\.') + '(?=[:/]|$)', 'i');
|
|
297
|
+
var RE_SHARED_CHAT = new RegExp('^https?://' + sharedChatHost.replace(/\./g, '\\.') + '(?=[:/]|$)', 'i');
|
|
298
|
+
|
|
299
|
+
var newApiHost = (self.qbInst.config.endpoints.api || '').replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
300
|
+
var newChatHost = (self.qbInst.config.endpoints.chat || '').replace(/^https?:\/\//i, '').replace(/\/+$/, '');
|
|
301
|
+
var NEW_API_URL = 'https://' + newApiHost;
|
|
302
|
+
var NEW_CHAT_URL = 'https://' + newChatHost;
|
|
303
|
+
|
|
281
304
|
while (self._queue.length) {
|
|
282
|
-
var args = self._queue.shift();
|
|
305
|
+
var args = self._queue.shift(); // [params, callback]
|
|
306
|
+
var p = args && args[0];
|
|
307
|
+
|
|
308
|
+
if (p && typeof p.url === 'string') {
|
|
309
|
+
var url = p.url;
|
|
310
|
+
var changed = false;
|
|
311
|
+
|
|
312
|
+
if (RE_SHARED_API.test(url)) {
|
|
313
|
+
url = url.replace(RE_SHARED_API, NEW_API_URL);
|
|
314
|
+
changed = true;
|
|
315
|
+
}
|
|
316
|
+
if (RE_SHARED_CHAT.test(url)) {
|
|
317
|
+
url = url.replace(RE_SHARED_CHAT, NEW_CHAT_URL);
|
|
318
|
+
changed = true;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (changed) {
|
|
322
|
+
p.url = url;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
283
326
|
self.ajax.apply(self, args);
|
|
284
327
|
}
|
|
285
328
|
}
|
|
329
|
+
|
|
330
|
+
//
|
|
286
331
|
}
|
|
287
332
|
|
|
288
333
|
function retry(session) {
|
package/src/qbUtils.js
CHANGED
|
@@ -171,9 +171,68 @@ var Utils = {
|
|
|
171
171
|
},
|
|
172
172
|
|
|
173
173
|
QBLog: function(){
|
|
174
|
+
var argsArr = Array.prototype.slice.call(arguments);
|
|
175
|
+
|
|
176
|
+
function containsPing(x) {
|
|
177
|
+
var needle = 'ping';
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
if (x == null) return false;
|
|
181
|
+
|
|
182
|
+
if (typeof x === 'string') {
|
|
183
|
+
return x.toLowerCase().indexOf(needle) !== -1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (typeof x === 'number' || typeof x === 'boolean') {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (typeof x === 'object') {
|
|
191
|
+
//DELETE XEP-0198 SM packages from log:
|
|
192
|
+
// <r xmlns="urn:xmpp:sm:3"/> and <a xmlns="urn:xmpp:sm:3" h="..."/>
|
|
193
|
+
if (typeof x.outerHTML === 'string') {
|
|
194
|
+
var oh = x.outerHTML.replace(/\s+/g, ' ').toLowerCase();
|
|
195
|
+
if (
|
|
196
|
+
oh.indexOf('urn:xmpp:sm:3') !== -1 &&
|
|
197
|
+
(/^<\s*r\b/.test(oh) || /^<\s*a\b/.test(oh))
|
|
198
|
+
) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
var candidates = [
|
|
204
|
+
x.textContent,
|
|
205
|
+
x.innerHTML,
|
|
206
|
+
x.outerHTML,
|
|
207
|
+
x.nodeName,
|
|
208
|
+
x.tagName,
|
|
209
|
+
x.id
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
for (var j = 0; j < candidates.length; j++) {
|
|
213
|
+
var s = candidates[j];
|
|
214
|
+
if (typeof s === 'string' && s.toLowerCase().indexOf(needle) !== -1) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
} catch (_) {}
|
|
220
|
+
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
let shouldSuppressPing1 =
|
|
226
|
+
config && config.pingDebug === false;
|
|
227
|
+
let shouldSuppressPing2 =argsArr.some(containsPing);
|
|
228
|
+
|
|
229
|
+
let shouldSuppressPing = shouldSuppressPing1 && shouldSuppressPing2;
|
|
230
|
+
|
|
174
231
|
if (this.loggers) {
|
|
175
232
|
for (var i=0; i<this.loggers.length; ++i) {
|
|
176
|
-
|
|
233
|
+
if (!shouldSuppressPing) {
|
|
234
|
+
this.loggers[i](arguments);
|
|
235
|
+
}
|
|
177
236
|
}
|
|
178
237
|
|
|
179
238
|
return;
|
|
@@ -254,7 +313,12 @@ var Utils = {
|
|
|
254
313
|
|
|
255
314
|
if(this.loggers){
|
|
256
315
|
for(var j=0;j<this.loggers.length;++j){
|
|
257
|
-
this.loggers[j](arguments);
|
|
316
|
+
// this.loggers[j](arguments);
|
|
317
|
+
//
|
|
318
|
+
if (!shouldSuppressPing) {
|
|
319
|
+
this.loggers[j](arguments);
|
|
320
|
+
}
|
|
321
|
+
//
|
|
258
322
|
}
|
|
259
323
|
}
|
|
260
324
|
},
|