podchat 9.4.4 → 11.2.0-snapshot.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/config.js +59 -0
- package/dist/{podchat-9.4.1.js → podchat-10.14.13.js} +87166 -72972
- package/examples/index-local.js +16 -16
- package/package.json +12 -7
- package/src/chat.js +15 -11
package/examples/index-local.js
CHANGED
|
@@ -7,12 +7,12 @@ var params = {
|
|
|
7
7
|
* ActiveMQ Config
|
|
8
8
|
*/
|
|
9
9
|
// protocol: "queue",
|
|
10
|
-
// queueHost: "
|
|
11
|
-
// queuePort: "
|
|
10
|
+
// queueHost: "***",
|
|
11
|
+
// queuePort: "***",
|
|
12
12
|
// queueUsername: "root",
|
|
13
|
-
// queuePassword: "
|
|
14
|
-
// queueReceive: "queue-in
|
|
15
|
-
// queueSend: "queue-out
|
|
13
|
+
// queuePassword: "***",
|
|
14
|
+
// queueReceive: "queue-in-***",
|
|
15
|
+
// queueSend: "queue-out-***",
|
|
16
16
|
// queueConnectionTimeout: 20000,
|
|
17
17
|
// serverName: "chat-server",
|
|
18
18
|
|
|
@@ -51,7 +51,7 @@ var params = {
|
|
|
51
51
|
fullResponseObject: false,
|
|
52
52
|
mapApiKey: '8b77db18704aa646ee5aaea13e7370f4f88b9e8c',
|
|
53
53
|
// typeCode: "talk",
|
|
54
|
-
token: "
|
|
54
|
+
token: "8dbbec9d51be497db95c729b422bd655",
|
|
55
55
|
// token: "f19933ae1b1e424db9965a243bf3bcd3", // {**REQUIRED**} SSO Token ZiZi
|
|
56
56
|
// token: "81025b3fbc1a4f7184c3600a2f874673", // {**REQUIRED**} SSO Token JiJi
|
|
57
57
|
// token: "3c4d62b6068043aa898cf7426d5cae68", // {**REQUIRED**} SSO Token FiFi
|
|
@@ -653,16 +653,16 @@ var chatReadyEventCallback = chatAgent.on('chatReady', function () {
|
|
|
653
653
|
* @param cellphoneNumber
|
|
654
654
|
* @param email
|
|
655
655
|
*/
|
|
656
|
-
var addContactInstantResult = chatAgent.addContacts({
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}, function (result) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
});
|
|
656
|
+
// var addContactInstantResult = chatAgent.addContacts({
|
|
657
|
+
// firstName: "Ahmad",
|
|
658
|
+
// lastName: "Sajadi",
|
|
659
|
+
// cellphoneNumber: "09158245345",
|
|
660
|
+
// // email: "zabbix_bot_1@fanap.ir",
|
|
661
|
+
// // username: "zabbix_bot_1"
|
|
662
|
+
// }, function (result) {
|
|
663
|
+
// console.log(result);
|
|
664
|
+
// console.log(result.contacts);
|
|
665
|
+
// });
|
|
666
666
|
|
|
667
667
|
/**
|
|
668
668
|
* UPDATE CONTACTS
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podchat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.2.0-snapshot.1",
|
|
4
4
|
"description": "Javascript SDK to use POD's Chat Service",
|
|
5
5
|
"main": "./src/chat.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "mocha --reporter spec --exit"
|
|
7
|
+
"test": "mocha --reporter spec --exit",
|
|
8
|
+
"publish:snapshot": "npm run version:snapshot && npm publish --tag snapshot",
|
|
9
|
+
"version:snapshot": "npm version prerelease --preid snapshot",
|
|
10
|
+
"publish:release": "npm run version:release && npm publish",
|
|
11
|
+
"version:release": "npm version 11.2.0"
|
|
8
12
|
},
|
|
9
13
|
"repository": {
|
|
10
14
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/
|
|
15
|
+
"url": "git+https://github.com/FanapSoft/pod-chat-js-sdk.git"
|
|
12
16
|
},
|
|
13
17
|
"keywords": [
|
|
14
18
|
"POD",
|
|
@@ -22,18 +26,19 @@
|
|
|
22
26
|
"author": "Masoud Amjadi <masoudmanson@gmail.com>",
|
|
23
27
|
"license": "MIT",
|
|
24
28
|
"bugs": {
|
|
25
|
-
"url": "https://github.com/
|
|
29
|
+
"url": "https://github.com/FanapSoft/pod-chat-js-sdk/issues"
|
|
26
30
|
},
|
|
27
|
-
"homepage": "https://github.com/
|
|
31
|
+
"homepage": "https://github.com/FanapSoft/pod-chat-js-sdk#readme",
|
|
28
32
|
"dependencies": {
|
|
29
33
|
"crypto-js": "^3.1.9-1",
|
|
30
|
-
"dexie": "^
|
|
34
|
+
"dexie": "^3.0.3",
|
|
35
|
+
"dompurify": "^2.3.3",
|
|
31
36
|
"faker": "^4.1.0",
|
|
32
37
|
"form-data": "^2.5.0",
|
|
33
38
|
"image-size": "^0.8.3",
|
|
34
39
|
"indexeddbshim": "^3.10.0",
|
|
35
40
|
"mime": "^2.4.4",
|
|
36
|
-
"podasync": "^2.
|
|
41
|
+
"podasync": "^2.8.3",
|
|
37
42
|
"query-string": "^6.8.1",
|
|
38
43
|
"request": "^2.88.0"
|
|
39
44
|
},
|
package/src/chat.js
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
ChatUtility,
|
|
10
10
|
FormData,
|
|
11
11
|
Request,
|
|
12
|
-
Dexie
|
|
12
|
+
Dexie,
|
|
13
|
+
DOMPurify;
|
|
13
14
|
|
|
14
15
|
function Chat(params) {
|
|
15
16
|
if (typeof (require) !== 'undefined' && typeof (exports) !== 'undefined') {
|
|
@@ -17,7 +18,8 @@
|
|
|
17
18
|
ChatUtility = require('./utility/utility.js'),
|
|
18
19
|
FormData = require('form-data'),
|
|
19
20
|
Request = require('request'),
|
|
20
|
-
Dexie = require('dexie').default || require('dexie')
|
|
21
|
+
Dexie = require('dexie').default || require('dexie'),
|
|
22
|
+
DOMPurify = require('dompurify');
|
|
21
23
|
|
|
22
24
|
var QueryString = require('querystring'),
|
|
23
25
|
FS = require('fs'),
|
|
@@ -44,7 +46,8 @@
|
|
|
44
46
|
Async = window.POD.Async,
|
|
45
47
|
ChatUtility = window.POD.ChatUtility,
|
|
46
48
|
FormData = window.FormData,
|
|
47
|
-
Dexie = window.Dexie
|
|
49
|
+
Dexie = window.Dexie,
|
|
50
|
+
DOMPurify = window.DOMPurify;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/*******************************************************
|
|
@@ -200,10 +203,7 @@
|
|
|
200
203
|
recordingVoiceInterval,
|
|
201
204
|
upoadingInterval,
|
|
202
205
|
protocol = params.protocol || 'websocket',
|
|
203
|
-
|
|
204
|
-
queuePort = params.queuePort,
|
|
205
|
-
queueUsername = params.queueUsername,
|
|
206
|
-
queuePassword = params.queuePassword,
|
|
206
|
+
queueServers = params.queueServers || [],
|
|
207
207
|
queueReceive = params.queueReceive,
|
|
208
208
|
queueSend = params.queueSend,
|
|
209
209
|
queueConnectionTimeout = params.queueConnectionTimeout,
|
|
@@ -362,14 +362,15 @@
|
|
|
362
362
|
* @return {undefined}
|
|
363
363
|
*/
|
|
364
364
|
initAsync = function () {
|
|
365
|
+
if(protocol === 'queue' && (!Array.isArray(queueServers) || queueServers.length == 0)) {
|
|
366
|
+
console.log('Queue Servers are invalid!', queueServers);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
365
369
|
var asyncGetReadyTime = new Date().getTime();
|
|
366
370
|
|
|
367
371
|
asyncClient = new Async({
|
|
368
372
|
protocol: protocol,
|
|
369
|
-
|
|
370
|
-
queuePort: queuePort,
|
|
371
|
-
queueUsername: queueUsername,
|
|
372
|
-
queuePassword: queuePassword,
|
|
373
|
+
servers: queueServers,
|
|
373
374
|
queueReceive: queueReceive,
|
|
374
375
|
queueSend: queueSend,
|
|
375
376
|
queueConnectionTimeout: queueConnectionTimeout,
|
|
@@ -1470,6 +1471,9 @@
|
|
|
1470
1471
|
messageVO.content = JSON.stringify(params.content);
|
|
1471
1472
|
} else {
|
|
1472
1473
|
messageVO.content = params.content;
|
|
1474
|
+
if(DOMPurify.isSupported) {
|
|
1475
|
+
messageVO.content = DOMPurify.sanitize(messageVO.content, {ALLOWED_TAGS: []});
|
|
1476
|
+
}
|
|
1473
1477
|
}
|
|
1474
1478
|
}
|
|
1475
1479
|
|