alicezetion 1.9.2 → 1.9.3
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/addExternalModule.js +19 -0
- package/src/addUserToGroup.js +113 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +55 -0
- package/{leiamnash → src}/changeAvatar.js +2 -3
- package/src/changeBio.js +77 -0
- package/src/changeBlockedStatus.js +47 -0
- package/src/changeGroupImage.js +132 -0
- package/src/changeNickname.js +59 -0
- package/src/changeThreadColor.js +65 -0
- package/src/changeThreadEmoji.js +55 -0
- package/{leiamnash → src}/chat.js +29 -4
- package/src/createNewGroup.js +86 -0
- package/src/createPoll.js +71 -0
- package/src/deleteMessage.js +56 -0
- package/src/deleteThread.js +56 -0
- package/src/edit.js +66 -0
- package/src/forwardAttachment.js +60 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +29 -0
- package/src/getFriendsList.js +83 -0
- package/src/getThreadHistory.js +666 -0
- package/src/getThreadInfo.js +232 -0
- package/src/getThreadList.js +241 -0
- package/src/getThreadPictures.js +79 -0
- package/src/getUserID.js +66 -0
- package/src/getUserInfo.js +74 -0
- package/src/handleFriendRequest.js +61 -0
- package/src/handleMessageRequest.js +65 -0
- package/src/httpGet.js +57 -0
- package/src/httpPost.js +57 -0
- package/src/httpPostFormData.js +63 -0
- package/src/listenMqtt.js +853 -0
- package/src/logout.js +75 -0
- package/src/markAsDelivered.js +58 -0
- package/src/markAsRead.js +80 -0
- package/src/markAsReadAll.js +50 -0
- package/src/markAsSeen.js +59 -0
- package/src/muteThread.js +52 -0
- package/src/react.js +109 -0
- package/{leiamnash → src}/refreshFb_dtsg.js +1 -1
- package/src/removeUserFromGroup.js +79 -0
- package/src/resolvePhotoUrl.js +45 -0
- package/src/searchForThread.js +53 -0
- package/src/seen.js +50 -0
- package/src/sendMessage.js +477 -0
- package/src/sendTypingIndicator.js +103 -0
- package/src/setMessageReaction.js +121 -0
- package/src/setPostReaction.js +109 -0
- package/src/setTitle.js +86 -0
- package/src/threadColors.js +131 -0
- package/src/unfriend.js +52 -0
- package/src/unsendMessage.js +49 -0
- package/{leiamnash → src}/uploadAttachment.js +1 -2
- package/leiamnash/addExternalModule.js +0 -15
- package/leiamnash/addUserToGroup.js +0 -77
- package/leiamnash/changeAdminStatus.js +0 -47
- package/leiamnash/changeArchivedStatus.js +0 -41
- package/leiamnash/changeBio.js +0 -64
- package/leiamnash/changeBlockedStatus.js +0 -36
- package/leiamnash/changeGroupImage.js +0 -105
- package/leiamnash/changeNickname.js +0 -43
- package/leiamnash/changeThreadColor.js +0 -61
- package/leiamnash/changeThreadEmoji.js +0 -41
- package/leiamnash/createNewGroup.js +0 -70
- package/leiamnash/createPoll.js +0 -59
- package/leiamnash/deleteMessage.js +0 -44
- package/leiamnash/deleteThread.js +0 -42
- package/leiamnash/edit.js +0 -59
- package/leiamnash/forwardAttachment.js +0 -47
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/getCurrentUserID.js +0 -7
- package/leiamnash/getEmojiUrl.js +0 -27
- package/leiamnash/getFriendsList.js +0 -73
- package/leiamnash/getInfoVideo.js +0 -134
- package/leiamnash/getThreadHistory.js +0 -537
- package/leiamnash/getThreadHistoryDeprecated.js +0 -71
- package/leiamnash/getThreadInfo.js +0 -171
- package/leiamnash/getThreadInfoDeprecated.js +0 -56
- package/leiamnash/getThreadList.js +0 -213
- package/leiamnash/getThreadListDeprecated.js +0 -46
- package/leiamnash/getThreadPictures.js +0 -59
- package/leiamnash/getUserID.js +0 -61
- package/leiamnash/getUserInfo.js +0 -66
- package/leiamnash/handleFriendRequest.js +0 -46
- package/leiamnash/handleMessageRequest.js +0 -47
- package/leiamnash/httpGet.js +0 -47
- package/leiamnash/httpPost.js +0 -47
- package/leiamnash/httpPostFormData.js +0 -42
- package/leiamnash/listenMqtt.js +0 -853
- package/leiamnash/logout.js +0 -68
- package/leiamnash/markAsDelivered.js +0 -47
- package/leiamnash/markAsRead.js +0 -70
- package/leiamnash/markAsReadAll.js +0 -40
- package/leiamnash/markAsSeen.js +0 -48
- package/leiamnash/muteThread.js +0 -45
- package/leiamnash/react.js +0 -109
- package/leiamnash/removeUserFromGroup.js +0 -45
- package/leiamnash/resolvePhotoUrl.js +0 -36
- package/leiamnash/searchForThread.js +0 -42
- package/leiamnash/seen.js +0 -40
- package/leiamnash/sendMessage.js +0 -315
- package/leiamnash/sendTypingIndicator.js +0 -70
- package/leiamnash/setMessageReaction.js +0 -103
- package/leiamnash/setPostReaction.js +0 -63
- package/leiamnash/setTitle.js +0 -70
- package/leiamnash/threadColors.js +0 -41
- package/leiamnash/unfriend.js +0 -42
- package/leiamnash/unsendMessage.js +0 -39
- /package/{leiamnash → src}/getMessage.js +0 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
const log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function handleFriendRequest(userID, accept, callback) {
|
8
|
+
if (utils.getType(accept) !== "Boolean") {
|
9
|
+
throw {
|
10
|
+
error: "Please pass a boolean as a second argument."
|
11
|
+
};
|
12
|
+
}
|
13
|
+
|
14
|
+
let resolveFunc = function () { };
|
15
|
+
let rejectFunc = function () { };
|
16
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
17
|
+
resolveFunc = resolve;
|
18
|
+
rejectFunc = reject;
|
19
|
+
});
|
20
|
+
|
21
|
+
if (!callback) {
|
22
|
+
callback = function (err, friendList) {
|
23
|
+
if (err) {
|
24
|
+
return rejectFunc(err);
|
25
|
+
}
|
26
|
+
resolveFunc(friendList);
|
27
|
+
};
|
28
|
+
}
|
29
|
+
|
30
|
+
const form = {
|
31
|
+
viewer_id: ctx.i_userID || ctx.userID,
|
32
|
+
"frefs[0]": "jwl",
|
33
|
+
floc: "friend_center_requests",
|
34
|
+
ref: "/reqs.php",
|
35
|
+
action: (accept ? "confirm" : "reject")
|
36
|
+
};
|
37
|
+
|
38
|
+
defaultFuncs
|
39
|
+
.post(
|
40
|
+
"https://www.facebook.com/requests/friends/ajax/",
|
41
|
+
ctx.jar,
|
42
|
+
form
|
43
|
+
)
|
44
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
45
|
+
.then(function (resData) {
|
46
|
+
if (resData.payload.err) {
|
47
|
+
throw {
|
48
|
+
err: resData.payload.err
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
return callback();
|
53
|
+
})
|
54
|
+
.catch(function (err) {
|
55
|
+
log.error("handleFriendRequest", err);
|
56
|
+
return callback(err);
|
57
|
+
});
|
58
|
+
|
59
|
+
return returnPromise;
|
60
|
+
};
|
61
|
+
};
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
const log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function handleMessageRequest(threadID, accept, callback) {
|
8
|
+
if (utils.getType(accept) !== "Boolean") {
|
9
|
+
throw {
|
10
|
+
error: "Please pass a boolean as a second argument."
|
11
|
+
};
|
12
|
+
}
|
13
|
+
|
14
|
+
let resolveFunc = function () { };
|
15
|
+
let rejectFunc = function () { };
|
16
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
17
|
+
resolveFunc = resolve;
|
18
|
+
rejectFunc = reject;
|
19
|
+
});
|
20
|
+
|
21
|
+
if (!callback) {
|
22
|
+
callback = function (err, friendList) {
|
23
|
+
if (err) {
|
24
|
+
return rejectFunc(err);
|
25
|
+
}
|
26
|
+
resolveFunc(friendList);
|
27
|
+
};
|
28
|
+
}
|
29
|
+
|
30
|
+
const form = {
|
31
|
+
client: "mercury"
|
32
|
+
};
|
33
|
+
|
34
|
+
if (utils.getType(threadID) !== "Array") {
|
35
|
+
threadID = [threadID];
|
36
|
+
}
|
37
|
+
|
38
|
+
const messageBox = accept ? "inbox" : "other";
|
39
|
+
|
40
|
+
for (let i = 0; i < threadID.length; i++) {
|
41
|
+
form[messageBox + "[" + i + "]"] = threadID[i];
|
42
|
+
}
|
43
|
+
|
44
|
+
defaultFuncs
|
45
|
+
.post(
|
46
|
+
"https://www.facebook.com/ajax/mercury/move_thread.php",
|
47
|
+
ctx.jar,
|
48
|
+
form
|
49
|
+
)
|
50
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
51
|
+
.then(function (resData) {
|
52
|
+
if (resData.error) {
|
53
|
+
throw resData;
|
54
|
+
}
|
55
|
+
|
56
|
+
return callback();
|
57
|
+
})
|
58
|
+
.catch(function (err) {
|
59
|
+
log.error("handleMessageRequest", err);
|
60
|
+
return callback(err);
|
61
|
+
});
|
62
|
+
|
63
|
+
return returnPromise;
|
64
|
+
};
|
65
|
+
};
|
package/src/httpGet.js
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
const log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function httpGet(url, form, customHeader, callback, notAPI) {
|
8
|
+
let resolveFunc = function () { };
|
9
|
+
let rejectFunc = function () { };
|
10
|
+
|
11
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
12
|
+
resolveFunc = resolve;
|
13
|
+
rejectFunc = reject;
|
14
|
+
});
|
15
|
+
|
16
|
+
if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
|
17
|
+
callback = form;
|
18
|
+
form = {};
|
19
|
+
}
|
20
|
+
|
21
|
+
if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
|
22
|
+
callback = customHeader;
|
23
|
+
customHeader = {};
|
24
|
+
}
|
25
|
+
|
26
|
+
customHeader = customHeader || {};
|
27
|
+
|
28
|
+
callback = callback || function (err, data) {
|
29
|
+
if (err) return rejectFunc(err);
|
30
|
+
resolveFunc(data);
|
31
|
+
};
|
32
|
+
|
33
|
+
if (notAPI) {
|
34
|
+
utils
|
35
|
+
.get(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
|
36
|
+
.then(function (resData) {
|
37
|
+
callback(null, resData.body.toString());
|
38
|
+
})
|
39
|
+
.catch(function (err) {
|
40
|
+
log.error("httpGet", err);
|
41
|
+
return callback(err);
|
42
|
+
});
|
43
|
+
} else {
|
44
|
+
defaultFuncs
|
45
|
+
.get(url, ctx.jar, form, null, customHeader)
|
46
|
+
.then(function (resData) {
|
47
|
+
callback(null, resData.body.toString());
|
48
|
+
})
|
49
|
+
.catch(function (err) {
|
50
|
+
log.error("httpGet", err);
|
51
|
+
return callback(err);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
return returnPromise;
|
56
|
+
};
|
57
|
+
};
|
package/src/httpPost.js
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
const log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return function httpPost(url, form, customHeader, callback, notAPI) {
|
8
|
+
let resolveFunc = function () { };
|
9
|
+
let rejectFunc = function () { };
|
10
|
+
|
11
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
12
|
+
resolveFunc = resolve;
|
13
|
+
rejectFunc = reject;
|
14
|
+
});
|
15
|
+
|
16
|
+
if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
|
17
|
+
callback = form;
|
18
|
+
form = {};
|
19
|
+
}
|
20
|
+
|
21
|
+
if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
|
22
|
+
callback = customHeader;
|
23
|
+
customHeader = {};
|
24
|
+
}
|
25
|
+
|
26
|
+
customHeader = customHeader || {};
|
27
|
+
|
28
|
+
callback = callback || function (err, data) {
|
29
|
+
if (err) return rejectFunc(err);
|
30
|
+
resolveFunc(data);
|
31
|
+
};
|
32
|
+
|
33
|
+
if (notAPI) {
|
34
|
+
utils
|
35
|
+
.post(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
|
36
|
+
.then(function (resData) {
|
37
|
+
callback(null, resData.body.toString());
|
38
|
+
})
|
39
|
+
.catch(function (err) {
|
40
|
+
log.error("httpPost", err);
|
41
|
+
return callback(err);
|
42
|
+
});
|
43
|
+
} else {
|
44
|
+
defaultFuncs
|
45
|
+
.post(url, ctx.jar, form, {}, customHeader)
|
46
|
+
.then(function (resData) {
|
47
|
+
callback(null, resData.body.toString());
|
48
|
+
})
|
49
|
+
.catch(function (err) {
|
50
|
+
log.error("httpPost", err);
|
51
|
+
return callback(err);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
return returnPromise;
|
56
|
+
};
|
57
|
+
};
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
const log = require("npmlog");
|
5
|
+
|
6
|
+
|
7
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
8
|
+
return function httpPostFormData(url, form, customHeader, callback, notAPI) {
|
9
|
+
let resolveFunc = function () { };
|
10
|
+
let rejectFunc = function () { };
|
11
|
+
|
12
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
13
|
+
resolveFunc = resolve;
|
14
|
+
rejectFunc = reject;
|
15
|
+
});
|
16
|
+
|
17
|
+
if (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction") {
|
18
|
+
callback = form;
|
19
|
+
form = {};
|
20
|
+
}
|
21
|
+
|
22
|
+
if (utils.getType(customHeader) == "Function" || utils.getType(customHeader) == "AsyncFunction") {
|
23
|
+
callback = customHeader;
|
24
|
+
customHeader = {};
|
25
|
+
}
|
26
|
+
|
27
|
+
customHeader = customHeader || {};
|
28
|
+
|
29
|
+
if (utils.getType(callback) == "Boolean") {
|
30
|
+
notAPI = callback;
|
31
|
+
callback = null;
|
32
|
+
}
|
33
|
+
|
34
|
+
callback = callback || function (err, data) {
|
35
|
+
if (err) return rejectFunc(err);
|
36
|
+
resolveFunc(data);
|
37
|
+
};
|
38
|
+
|
39
|
+
if (notAPI) {
|
40
|
+
utils
|
41
|
+
.postFormData(url, ctx.jar, form, ctx.globalOptions, ctx, customHeader)
|
42
|
+
.then(function (resData) {
|
43
|
+
callback(null, resData.body.toString());
|
44
|
+
})
|
45
|
+
.catch(function (err) {
|
46
|
+
log.error("httpPostFormData", err);
|
47
|
+
return callback(err);
|
48
|
+
});
|
49
|
+
} else {
|
50
|
+
defaultFuncs
|
51
|
+
.postFormData(url, ctx.jar, form, null, customHeader)
|
52
|
+
.then(function (resData) {
|
53
|
+
callback(null, resData.body.toString());
|
54
|
+
})
|
55
|
+
.catch(function (err) {
|
56
|
+
log.error("httpPostFormData", err);
|
57
|
+
return callback(err);
|
58
|
+
});
|
59
|
+
}
|
60
|
+
|
61
|
+
return returnPromise;
|
62
|
+
};
|
63
|
+
};
|