node-ainzfb-new 1.7.10-13 → 1.7.10-16tfwiu
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/src/changeAvt.js +73 -73
- package/src/editMessage.js +26 -29
- package/src/getAccessToken.js +21 -21
- package/src/getThreadInfo.js +18 -3423
- package/src/getUserInfoV2.js +22 -19
- package/src/pinMessage.js +13 -16
- package/src/shareContact.js +39 -49
- package/src/shareLink.js +48 -51
- package/utils.js +19 -8
package/src/getUserInfoV2.js
CHANGED
@@ -4,29 +4,32 @@
|
|
4
4
|
var utils = require("../utils");
|
5
5
|
var log = require("npmlog");
|
6
6
|
|
7
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
8
|
-
return function getUserInfoV2(id, callback) {
|
9
|
-
var resolveFunc = function() {};
|
10
|
-
var rejectFunc = function() {};
|
11
|
-
var returnPromise = new Promise(function(resolve, reject) {
|
12
|
-
resolveFunc = resolve;
|
13
|
-
rejectFunc = reject;
|
14
|
-
});
|
15
7
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
9
|
+
return function getUserInfoV2(id, callback) {
|
10
|
+
var resolveFunc = function () { };
|
11
|
+
var rejectFunc = function () { };
|
12
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
13
|
+
resolveFunc = resolve;
|
14
|
+
rejectFunc = reject;
|
15
|
+
});
|
16
|
+
|
17
|
+
if (!callback) {
|
18
|
+
callback = function (err, userInfo) {
|
19
|
+
if (err) return rejectFunc(err);
|
20
|
+
resolveFunc(userInfo);
|
21
|
+
};
|
22
|
+
}
|
22
23
|
try {
|
23
|
-
var { getInfo } = require(
|
24
|
-
getInfo(id)
|
24
|
+
var { getInfo } = require('../Extra/ExtraAddons');
|
25
|
+
getInfo(id)
|
26
|
+
.then(data => {
|
25
27
|
return callback(null, data);
|
26
28
|
});
|
27
|
-
}
|
29
|
+
}
|
30
|
+
catch (e) {
|
28
31
|
return callback(null, e);
|
29
32
|
}
|
30
33
|
return returnPromise;
|
31
|
-
|
32
|
-
};
|
34
|
+
};
|
35
|
+
};
|
package/src/pinMessage.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
'use strict';
|
2
2
|
|
3
|
-
const { generateOfflineThreadingID, getCurrentTimestamp } = require(
|
3
|
+
const { generateOfflineThreadingID, getCurrentTimestamp } = require('../utils');
|
4
4
|
|
5
5
|
function isCallable(func) {
|
6
6
|
try {
|
@@ -11,22 +11,22 @@ function isCallable(func) {
|
|
11
11
|
}
|
12
12
|
}
|
13
13
|
|
14
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
14
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
15
15
|
return function pinMessage(pinMode, messageID, threadID, callback) {
|
16
16
|
if (!ctx.mqttClient) {
|
17
|
-
throw new Error(
|
17
|
+
throw new Error('Not connected to MQTT');
|
18
18
|
}
|
19
19
|
|
20
20
|
ctx.wsReqNumber += 1;
|
21
21
|
ctx.wsTaskNumber += 1;
|
22
22
|
|
23
|
-
const taskLabel = pinMode ?
|
24
|
-
const queueNamePrefix = pinMode ?
|
23
|
+
const taskLabel = pinMode ? '430' : '431';
|
24
|
+
const queueNamePrefix = pinMode ? 'pin_msg_v2_' : 'unpin_msg_v2_';
|
25
25
|
|
26
26
|
const taskPayload = {
|
27
27
|
thread_key: threadID,
|
28
28
|
message_id: messageID,
|
29
|
-
timestamp_ms: getCurrentTimestamp()
|
29
|
+
timestamp_ms: getCurrentTimestamp(),
|
30
30
|
};
|
31
31
|
|
32
32
|
const task = {
|
@@ -34,28 +34,25 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
34
34
|
label: taskLabel,
|
35
35
|
payload: JSON.stringify(taskPayload),
|
36
36
|
queue_name: `${queueNamePrefix}${threadID}`,
|
37
|
-
task_id: ctx.wsTaskNumber
|
37
|
+
task_id: ctx.wsTaskNumber,
|
38
38
|
};
|
39
39
|
|
40
40
|
const content = {
|
41
|
-
app_id:
|
41
|
+
app_id: '2220391788200892',
|
42
42
|
payload: JSON.stringify({
|
43
43
|
data_trace_id: null,
|
44
44
|
epoch_id: parseInt(generateOfflineThreadingID()),
|
45
45
|
tasks: [task],
|
46
|
-
version_id:
|
46
|
+
version_id: '25095469420099952',
|
47
47
|
}),
|
48
48
|
request_id: ctx.wsReqNumber,
|
49
|
-
type: 3
|
49
|
+
type: 3,
|
50
50
|
};
|
51
51
|
|
52
52
|
if (isCallable(callback)) {
|
53
|
-
|
53
|
+
// to be implemented
|
54
54
|
}
|
55
55
|
|
56
|
-
ctx.mqttClient.publish(
|
57
|
-
qos: 1,
|
58
|
-
retain: false
|
59
|
-
});
|
56
|
+
ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
|
60
57
|
};
|
61
58
|
};
|
package/src/shareContact.js
CHANGED
@@ -3,54 +3,44 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
failure_count: null
|
44
|
-
}
|
45
|
-
],
|
46
|
-
epoch_id: utils.generateOfflineThreadingID(),
|
47
|
-
version_id: "7214102258676893"
|
48
|
-
}),
|
49
|
-
request_id: ++count_req,
|
50
|
-
type: 3
|
51
|
-
});
|
52
|
-
ctx.mqttClient.publish("/ls_req", form);
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return async function shareContact(text, senderID, threadID, mentionID, userID, leaverID, callback) {
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
if (!callback) {
|
15
|
+
callback = function (err, data) {
|
16
|
+
if (err) return rejectFunc(err);
|
17
|
+
resolveFunc(data);
|
18
|
+
};
|
19
|
+
}
|
20
|
+
let count_req = 0;
|
21
|
+
var form = JSON.stringify({
|
22
|
+
"app_id": "2220391788200892",
|
23
|
+
"payload": JSON.stringify({
|
24
|
+
tasks: [{
|
25
|
+
label: '359',
|
26
|
+
payload: JSON.stringify({
|
27
|
+
"contact_id": senderID,
|
28
|
+
"sync_group": 1,
|
29
|
+
"text": text || "",
|
30
|
+
"thread_id": threadID
|
31
|
+
}),
|
32
|
+
queue_name: 'messenger_contact_sharing',
|
33
|
+
task_id: Math.random() * 1001 << 0,
|
34
|
+
failure_count: null,
|
35
|
+
}],
|
36
|
+
epoch_id: utils.generateOfflineThreadingID(),
|
37
|
+
version_id: '7214102258676893',
|
38
|
+
}),
|
39
|
+
"request_id": ++count_req,
|
40
|
+
"type": 3
|
41
|
+
});
|
42
|
+
ctx.mqttClient.publish('/ls_req', form);
|
53
43
|
|
54
|
-
|
55
|
-
|
44
|
+
return returnPromise;
|
45
|
+
};
|
56
46
|
};
|
package/src/shareLink.js
CHANGED
@@ -3,55 +3,52 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
);
|
55
|
-
return returnPromise;
|
56
|
-
};
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return async function shareLink(text, url, threadID, callback) {
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
if (!callback) {
|
15
|
+
callback = function (err, data) {
|
16
|
+
if (err) return rejectFunc(err);
|
17
|
+
resolveFunc(data);
|
18
|
+
};
|
19
|
+
}
|
20
|
+
ctx.mqttClient.publish('/ls_req',
|
21
|
+
JSON.stringify({
|
22
|
+
"app_id": "2220391788200892",
|
23
|
+
"payload": JSON.stringify({
|
24
|
+
tasks: [{
|
25
|
+
label: 46,
|
26
|
+
payload: JSON.stringify({
|
27
|
+
"otid": utils.generateOfflineThreadingID(),
|
28
|
+
"source": 524289,
|
29
|
+
"sync_group": 1,
|
30
|
+
"send_type": 6,
|
31
|
+
"mark_thread_read": 0,
|
32
|
+
"url": url || "",
|
33
|
+
"text": text || "",
|
34
|
+
"thread_id": threadID,
|
35
|
+
"initiating_source": 0
|
36
|
+
}),
|
37
|
+
queue_name: threadID,
|
38
|
+
task_id: Math.random() * 1001 << 0,
|
39
|
+
failure_count: null,
|
40
|
+
}],
|
41
|
+
epoch_id: utils.generateOfflineThreadingID(),
|
42
|
+
version_id: '7191105584331330',
|
43
|
+
}),
|
44
|
+
"request_id": ++ctx.req_ID,
|
45
|
+
"type": 3
|
46
|
+
}),
|
47
|
+
{
|
48
|
+
qos: 1,
|
49
|
+
retain: false,
|
50
|
+
}
|
51
|
+
)
|
52
|
+
return returnPromise;
|
53
|
+
};
|
57
54
|
};
|
package/utils.js
CHANGED
@@ -1327,7 +1327,7 @@ function decodeClientPayload(payload) {
|
|
1327
1327
|
|
1328
1328
|
|
1329
1329
|
|
1330
|
-
function getAppState(jar) {
|
1330
|
+
/*function getAppState(jar) {
|
1331
1331
|
try {
|
1332
1332
|
var appstate = jar.getCookies("https://www.facebook.com").concat(jar.getCookies("https://facebook.com")).concat(jar.getCookies("https://www.messenger.com"));
|
1333
1333
|
|
@@ -1349,19 +1349,30 @@ function getAppState(jar) {
|
|
1349
1349
|
logger('Error retrieving cookies:', error, '[ FCA-SUS ]');
|
1350
1350
|
throw error;
|
1351
1351
|
}
|
1352
|
-
}
|
1353
|
-
|
1352
|
+
}*/
|
1353
|
+
function getAppState(jar) {
|
1354
1354
|
const prettyMilliseconds = require('pretty-ms');
|
1355
1355
|
var appstate = jar.getCookies("https://www.facebook.com").concat(jar.getCookies("https://facebook.com")).concat(jar.getCookies("https://www.messenger.com"));
|
1356
1356
|
var StateCrypt = require('./StateCrypt');
|
1357
1357
|
var logger = require('./logger');
|
1358
1358
|
logger('Encrypted Appstate Successfully!', '[ FCA-SUS ]');
|
1359
|
-
|
1359
|
+
|
1360
|
+
let processDuration = 0;
|
1361
|
+
if (process.env.startTime) {
|
1362
|
+
processDuration = Date.now() - parseInt(process.env.startTime);
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
if (isFinite(processDuration)) {
|
1366
|
+
logger(`Process Done: ${prettyMilliseconds(processDuration)}`, '[ FCA-SUS ]');
|
1367
|
+
} else {
|
1368
|
+
logger(`Process Done: Unable to calculate duration`, '[ FCA-SUS ]');
|
1369
|
+
}
|
1370
|
+
|
1360
1371
|
if (process.env['FBKEY']) {
|
1361
|
-
return StateCrypt.encryptState(JSON.stringify(appstate),process.env['FBKEY']);
|
1372
|
+
return StateCrypt.encryptState(JSON.stringify(appstate), process.env['FBKEY']);
|
1362
1373
|
}
|
1363
|
-
|
1364
|
-
}
|
1374
|
+
else return appstate;
|
1375
|
+
}
|
1365
1376
|
|
1366
1377
|
module.exports = {
|
1367
1378
|
isReadableStream:isReadableStream,
|
@@ -1403,4 +1414,4 @@ module.exports = {
|
|
1403
1414
|
getAdminTextMessageType,
|
1404
1415
|
setProxy,
|
1405
1416
|
getCurrentTimestamp
|
1406
|
-
};
|
1417
|
+
};
|