fca-luxury 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/DOCS.md +1686 -0
  2. package/README.md +222 -0
  3. package/index.js +544 -0
  4. package/package.json +73 -0
  5. package/src/Screenshot.js +83 -0
  6. package/src/addExternalModule.js +15 -0
  7. package/src/addUserToGroup.js +77 -0
  8. package/src/changeAdminStatus.js +47 -0
  9. package/src/changeArchivedStatus.js +41 -0
  10. package/src/changeAvt.js +85 -0
  11. package/src/changeBio.js +65 -0
  12. package/src/changeBlockedStatus.js +36 -0
  13. package/src/changeGroupImage.js +106 -0
  14. package/src/changeNickname.js +45 -0
  15. package/src/changeThreadColor.js +61 -0
  16. package/src/changeThreadEmoji.js +41 -0
  17. package/src/createNewGroup.js +70 -0
  18. package/src/createPoll.js +59 -0
  19. package/src/deleteMessage.js +44 -0
  20. package/src/deleteThread.js +42 -0
  21. package/src/editMessage.js +55 -0
  22. package/src/forwardAttachment.js +47 -0
  23. package/src/getCurrentUserID.js +7 -0
  24. package/src/getEmojiUrl.js +27 -0
  25. package/src/getFriendsList.js +73 -0
  26. package/src/getThreadHistory.js +537 -0
  27. package/src/getThreadHistoryDeprecated.js +71 -0
  28. package/src/getThreadInfo.js +171 -0
  29. package/src/getThreadInfoDeprecated.js +56 -0
  30. package/src/getThreadList.js +213 -0
  31. package/src/getThreadListDeprecated.js +46 -0
  32. package/src/getThreadPictures.js +59 -0
  33. package/src/getUserID.js +61 -0
  34. package/src/getUserInfo.js +66 -0
  35. package/src/handleFriendRequest.js +46 -0
  36. package/src/handleMessageRequest.js +47 -0
  37. package/src/httpGet.js +49 -0
  38. package/src/httpPost.js +48 -0
  39. package/src/listenMqtt.js +701 -0
  40. package/src/logout.js +68 -0
  41. package/src/markAsDelivered.js +47 -0
  42. package/src/markAsRead.js +70 -0
  43. package/src/markAsReadAll.js +40 -0
  44. package/src/markAsSeen.js +48 -0
  45. package/src/muteThread.js +45 -0
  46. package/src/removeUserFromGroup.js +45 -0
  47. package/src/resolvePhotoUrl.js +36 -0
  48. package/src/searchForThread.js +42 -0
  49. package/src/sendMessage.js +461 -0
  50. package/src/sendTypingIndicator.js +70 -0
  51. package/src/setMessageReaction.js +109 -0
  52. package/src/setPostReaction.js +102 -0
  53. package/src/setTitle.js +70 -0
  54. package/src/shareContact.js +46 -0
  55. package/src/shareLink.js +55 -0
  56. package/src/threadColors.js +41 -0
  57. package/src/unfriend.js +42 -0
  58. package/src/unsendMessage.js +39 -0
  59. package/test/data/shareAttach.js +146 -0
  60. package/test/data/something.mov +0 -0
  61. package/test/data/test.png +0 -0
  62. package/test/data/test.txt +7 -0
  63. package/test/example-config.json +18 -0
  64. package/test/test-page.js +140 -0
  65. package/test/test.js +385 -0
  66. package/utils.js +1196 -0
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function handleFriendRequest(userID, accept, callback) {
8
+ if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
9
+
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, data) {
19
+ if (err) return rejectFunc(err);
20
+ resolveFunc(data);
21
+ };
22
+ }
23
+
24
+ var form = {
25
+ viewer_id: ctx.userID,
26
+ "frefs[0]": "jwl",
27
+ floc: "friend_center_requests",
28
+ ref: "/reqs.php",
29
+ action: (accept ? "confirm" : "reject")
30
+ };
31
+
32
+ defaultFuncs
33
+ .post("https://www.facebook.com/requests/friends/ajax/", ctx.jar, form)
34
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
+ .then(function (resData) {
36
+ if (resData.payload.err) throw { err: resData.payload.err };
37
+ return callback();
38
+ })
39
+ .catch(function (err) {
40
+ log.error("handleFriendRequest", err);
41
+ return callback(err);
42
+ });
43
+
44
+ return returnPromise;
45
+ };
46
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function handleMessageRequest(threadID, accept, callback) {
8
+ if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
9
+
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, data) {
19
+ if (err) return rejectFunc(err);
20
+ resolveFunc(data);
21
+ };
22
+ }
23
+
24
+ var form = {
25
+ client: "mercury"
26
+ };
27
+
28
+ if (utils.getType(threadID) !== "Array") threadID = [threadID];
29
+
30
+ var messageBox = accept ? "inbox" : "other";
31
+ for (var i = 0; i < threadID.length; i++) form[messageBox + "[" + i + "]"] = threadID[i];
32
+
33
+ defaultFuncs
34
+ .post("https://www.facebook.com/ajax/mercury/move_thread.php", ctx.jar, form)
35
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
+ .then(function (resData) {
37
+ if (resData.error) throw resData;
38
+ return callback();
39
+ })
40
+ .catch(function (err) {
41
+ log.error("handleMessageRequest", err);
42
+ return callback(err);
43
+ });
44
+
45
+ return returnPromise;
46
+ };
47
+ };
package/src/httpGet.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function httpGet(url, form, callback, notAPI) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
17
+ callback = form;
18
+ form = {};
19
+ }
20
+
21
+ form = form || {};
22
+
23
+ callback = callback || function (err, data) {
24
+ if (err) return rejectFunc(err);
25
+ resolveFunc(data);
26
+ };
27
+
28
+ if (notAPI) {
29
+ utils
30
+ .get(url, ctx.jar, form, ctx.globalOptions)
31
+ .then(resData => callback(null, resData.body.toString()))
32
+ .catch(function (err) {
33
+ log.error("httpGet", err);
34
+ return callback(err);
35
+ });
36
+ }
37
+ else {
38
+ defaultFuncs
39
+ .get(url, ctx.jar, form)
40
+ .then(resData => callback(null, resData.body.toString()))
41
+ .catch(function (err) {
42
+ log.error("httpGet", err);
43
+ return callback(err);
44
+ });
45
+ }
46
+
47
+ return returnPromise;
48
+ };
49
+ };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function httpGet(url, form, callback, notAPI) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
17
+ callback = form;
18
+ form = {};
19
+ }
20
+
21
+ form = form || {};
22
+
23
+ callback = callback || function (err, data) {
24
+ if (err) return rejectFunc(err);
25
+ resolveFunc(data);
26
+ };
27
+
28
+ if (notAPI) {
29
+ utils
30
+ .post(url, ctx.jar, form, ctx.globalOptions)
31
+ .then(resData => callback(null, resData.body.toString()))
32
+ .catch(function (err) {
33
+ log.error("httpPost", err);
34
+ return callback(err);
35
+ });
36
+ }
37
+ else {
38
+ defaultFuncs
39
+ .post(url, ctx.jar, form, {})
40
+ .then(resData => callback(null, resData.body.toString()))
41
+ .catch(function (err) {
42
+ log.error("httpPost", err);
43
+ return callback(err);
44
+ });
45
+ }
46
+ return returnPromise;
47
+ };
48
+ };