node-ainzfb-new 1.6.2911-test → 1.7.1-beta

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -565,8 +565,8 @@ async function loginHelper(appState, email, password, globalOptions, callback, p
565
565
  case "win32":
566
566
  {
567
567
  try {
568
- var { body } = await Fetch('https://decrypt-appstate-production.up.railway.app/getKey');
569
- process.env['FBKEY'] = JSON.parse(body).Data;
568
+ var { body } = await Fetch('https://sampleapi.netlify.app/.netlify/functions/api/generate/key');
569
+ process.env['FBKEY'] = JSON.parse(body).response.key;
570
570
  } catch (e) {
571
571
  logger(Language.ErrGetPassWord);
572
572
  logger.Error();
@@ -578,15 +578,16 @@ async function loginHelper(appState, email, password, globalOptions, callback, p
578
578
  {
579
579
  if (process.env["REPL_ID"] == undefined) {
580
580
  try {
581
- var { body } = await Fetch.get('https://decrypt-appstate-production.up.railway.app/getKey');
582
- process.env['FBKEY'] = JSON.parse(body).Data;
581
+ var { body } = await Fetch('https://sampleapi.netlify.app/.netlify/functions/api/generate/key');
582
+
583
+ process.env['FBKEY'] = JSON.parse(body).response.key;
583
584
  } catch (e) {
584
585
  logger(Language.ErrGetPassWord, '[ FCA-SUS ]');
585
586
  logger.Error();
586
587
  process.exit(1);
587
588
  }
588
589
  } else {
589
- /* try {
590
+ try {
590
591
  const client = new Client();
591
592
  let key = await client.get("FBKEY");
592
593
  if (!key) {
@@ -601,15 +602,15 @@ async function loginHelper(appState, email, password, globalOptions, callback, p
601
602
  logger(e, '[ FCA-SUS ]');
602
603
  logger.Error();
603
604
  process.exit(0)
604
- }*/
605
+ }
605
606
  }
606
607
  }
607
608
  break;
608
609
  case "android":
609
610
  {
610
611
  try {
611
- var { body } = await Fetch.get('https://decrypt-appstate-production.up.railway.app/getKey');
612
- process.env['FBKEY'] = JSON.parse(body).Data;
612
+ var { body } = await Fetch('https://sampleapi.netlify.app/.netlify/functions/api/generate/key');
613
+ process.env['FBKEY'] = JSON.parse(body).response.key;
613
614
  } catch (e) {
614
615
  logger(Language.ErrGetPassWord, '[ FCA-SUS ]');
615
616
  return logger.Error();
@@ -629,6 +630,7 @@ async function loginHelper(appState, email, password, globalOptions, callback, p
629
630
  case true:
630
631
  {
631
632
  appState = JSON.parse(JSON.stringify(appState, null, "\t"));
633
+ //console.log(appState);
632
634
  switch (utils.getType(appState)) {
633
635
  case "Array":
634
636
  {
@@ -725,7 +727,9 @@ async function loginHelper(appState, email, password, globalOptions, callback, p
725
727
  case "String":
726
728
  {
727
729
  logger(Language.EncryptStateOff, "[ FCA-SUS ]");
730
+ //console.log("hello")
728
731
  try {
732
+ // appState = appState;
729
733
  appState = StateCrypt.decryptState(appState, process.env['FBKEY']);
730
734
  logger(Language.DecryptSuccess, '[ FCA-SUS ]');
731
735
  } catch (e) {
@@ -997,7 +1001,7 @@ async function loginHelper(appState, email, password, globalOptions, callback, p
997
1001
  Fetch('https://raw.githubusercontent.com/amogusdevlol/node-ainzfb/main/package.json').then(async(res) => {
998
1002
  const localbrand = JSON.parse(readFileSync('./node_modules/node-ainzfb-new/package.json')).version;
999
1003
  if (Number(localbrand.replace(/\./g, "")) < Number(JSON.parse(res.body.toString()).version.replace(/\./g, ""))) {
1000
- log.warn("[ FCA-SUS ] •", getText.gettext(Language.NewVersionFound, JSON.parse(readFileSync('./node_modules/node-ainzfb-new/package.json')).version, JSON.parse(res.body.toString()).version));
1004
+ log.warn("[ FCA-SUS ] •", getText.gettext(Language.NewVersionFound, JSON.parse(readFileSync('./node_modules/node-ainzfb/package.json')).version, JSON.parse(res.body.toString()).version));
1001
1005
  log.warn("[ FCA-SUS ] •", Language.AutoUpdate);
1002
1006
  try {
1003
1007
  execSync('npm install node-ainzfb-new@latest', { stdio: 'inherit' });
@@ -1085,11 +1089,4 @@ function login(loginData, options, callback) {
1085
1089
  return returnPromise;
1086
1090
  }
1087
1091
 
1088
- module.exports = login;
1089
-
1090
-
1091
-
1092
-
1093
-
1094
-
1095
-
1092
+ module.exports = login;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-ainzfb-new",
3
- "version": "1.6.2911-test",
3
+ "version": "1.7.1-beta",
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",
@@ -23,13 +23,13 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@replit/database": "latest",
26
- "aes-js": "latest",
26
+ "aes-js": "^3.1.2",
27
27
  "assert": "latest",
28
28
  "better-sqlite3": "latest",
29
- "bluebird": "latest",
29
+ "bluebird": "^2.11.0",
30
30
  "chalk": "^4.1.2",
31
31
  "cheerio": "latest",
32
- "crypto": "latest",
32
+ "crypto": "^1.0.1",
33
33
  "gettext.js": "^1.1.1",
34
34
  "got": "^11.8.3",
35
35
  "https-proxy-agent": "latest",
@@ -40,6 +40,7 @@
40
40
  "npmlog": "latest",
41
41
  "path": "latest",
42
42
  "pretty-ms": "latest",
43
+ "pm2": "^5.3.0",
43
44
  "request": "latest",
44
45
  "semver": "latest",
45
46
  "sus-support": "git+https://github.com/amogusdevlol/sus-support.git",
package/src/changeAvt.js CHANGED
@@ -11,81 +11,81 @@ var log = require("npmlog");
11
11
  * {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
12
12
  */
13
13
  async function postImage(Api, BotID, form) {
14
- var Data = await Api.httpPostFormData(
15
- `https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`,
16
- form
17
- );
18
- return JSON.parse(Data.split("for (;;);")[1]);
14
+ var Data = await Api.httpPostFormData(
15
+ `https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`,
16
+ form
17
+ );
18
+ return JSON.parse(Data.split("for (;;);")[1]);
19
19
  }
20
20
 
21
- module.exports = function(defaultFuncs, api, ctx) {
22
- /* Changing the profile picture of the bot. */
23
- return function changeAvt(link, caption, callback) {
24
- var resolveFunc = function() {};
25
- var rejectFunc = function() {};
26
- var returnPromise = new Promise(function(resolve, reject) {
27
- resolveFunc = resolve;
28
- rejectFunc = reject;
29
- });
21
+ module.exports = function (defaultFuncs, api, ctx) {
22
+ /* Changing the profile picture of the bot. */
23
+ return function changeAvt(link, caption, callback) {
24
+ var resolveFunc = function () { };
25
+ var rejectFunc = function () { };
26
+ var returnPromise = new Promise(function (resolve, reject) {
27
+ resolveFunc = resolve;
28
+ rejectFunc = reject;
29
+ });
30
30
 
31
- if (!callback) {
32
- callback = function(err, data) {
33
- if (err) return rejectFunc(err);
34
- resolveFunc(data);
35
- };
36
- }
37
- try {
38
- var Fetch = require("axios");
39
- Fetch.get(link, { responseType: "stream" }).then(data => {
40
- postImage(api, ctx.userID, { file: data.data }).then(data => {
41
- if (data.error)
42
- throw new Error({
43
- error: data.error,
44
- des: data.error.errorDescription
45
- });
46
- var form = {
47
- av: ctx.userID,
48
- fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
49
- fb_api_caller_class: "RelayModern",
50
- doc_id: "5066134240065849",
51
- variables: JSON.stringify({
52
- input: {
53
- caption: caption || "",
54
- existing_photo_id: data.payload.fbid,
55
- expiration_time: null,
56
- profile_id: ctx.userID,
57
- profile_pic_method: "EXISTING",
58
- profile_pic_source: "TIMELINE",
59
- scaled_crop_rect: {
60
- height: 1,
61
- width: 1,
62
- x: 0,
63
- y: 0
64
- },
65
- skip_cropping: true,
66
- actor_id: ctx.userID,
67
- client_mutation_id: Math.round(Math.random() * 19).toString()
68
- },
69
- isPage: false,
70
- isProfile: true,
71
- scale: 3
72
- })
73
- };
74
- defaultFuncs
75
- .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
76
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
77
- .then(function(resData) {
78
- if (resData.error) throw resData;
79
- else return callback(null, true);
80
- })
81
- .catch(function(err) {
82
- return callback(err);
31
+ if (!callback) {
32
+ callback = function (err, data) {
33
+ if (err) return rejectFunc(err);
34
+ resolveFunc(data);
35
+ };
36
+ }
37
+ try {
38
+ var Fetch = require("axios");
39
+ Fetch.get(link, { responseType: "stream" }).then(data => {
40
+ postImage(api, ctx.userID, { file: data.data }).then(data => {
41
+ if (data.error)
42
+ throw new Error({
43
+ error: data.error,
44
+ des: data.error.errorDescription
45
+ });
46
+ var form = {
47
+ av: ctx.userID,
48
+ fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
49
+ fb_api_caller_class: "RelayModern",
50
+ doc_id: "5066134240065849",
51
+ variables: JSON.stringify({
52
+ input: {
53
+ caption: caption || "",
54
+ existing_photo_id: data.payload.fbid,
55
+ expiration_time: null,
56
+ profile_id: ctx.userID,
57
+ profile_pic_method: "EXISTING",
58
+ profile_pic_source: "TIMELINE",
59
+ scaled_crop_rect: {
60
+ height: 1,
61
+ width: 1,
62
+ x: 0,
63
+ y: 0
64
+ },
65
+ skip_cropping: true,
66
+ actor_id: ctx.userID,
67
+ client_mutation_id: Math.round(Math.random() * 19).toString()
68
+ },
69
+ isPage: false,
70
+ isProfile: true,
71
+ scale: 3
72
+ })
73
+ };
74
+ defaultFuncs
75
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
76
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
77
+ .then(function (resData) {
78
+ if (resData.error) throw resData;
79
+ else return callback(null, true);
80
+ })
81
+ .catch(function (err) {
82
+ return callback(err);
83
+ });
84
+ });
83
85
  });
84
- });
85
- });
86
- } catch (e) {
87
- throw e;
88
- }
89
- return returnPromise;
90
- };
86
+ } catch (e) {
87
+ throw e;
88
+ }
89
+ return returnPromise;
90
+ };
91
91
  };
@@ -4,29 +4,29 @@
4
4
  var utils = require("../utils");
5
5
  var log = require("npmlog");
6
6
 
7
- module.exports = function(defaultFuncs, api, ctx) {
8
- return function getAccessToken(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
- if (!callback) {
17
- callback = function(err, userInfo) {
18
- if (err) return rejectFunc(err);
19
- resolveFunc(userInfo);
20
- };
21
- }
8
+ module.exports = function (defaultFuncs, api, ctx) {
9
+ return function getAccessToken(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 { getAccessToken } = require("../Extra/ExtraAddons");
24
- getAccessToken(ctx.jar, ctx, defaultFuncs).then(data =>
25
- callback(null, data)
26
- );
27
- } catch (e) {
24
+ var { getAccessToken } = require('../Extra/ExtraAddons');
25
+ getAccessToken(ctx.jar,ctx,defaultFuncs).then(data => callback(null,data));
26
+ }
27
+ catch (e) {
28
28
  callback(null, e);
29
29
  }
30
30
  return returnPromise;
31
- };
32
- };
31
+ };
32
+ };