node-ainzfb-new 1.7.10-13 → 1.7.10-14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils.js +19 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-ainzfb-new",
3
- "version": "1.7.10-13",
3
+ "version": "1.7.10-14",
4
4
  "description": "A Facebook chat API that doesn't rely on XMPP. Will NOT be deprecated after April 30th 2015.",
5
5
  "scripts": {
6
6
  "test": "mocha",
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
- /*function getAppState(jar) {
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
- logger(`Process Done: ${prettyMilliseconds(Date.now() - process.env.startTime)}`, '[ FCA-SUS ]');
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
- else return appstate;
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
+ };