alicezetion 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/replit/__replit_disk_meta.json +1 -1
- package/.cache/replit/nix/env.json +1 -1
- package/index.js +5 -2
- package/leiamnash/addExternalModule.js +6 -10
- package/leiamnash/addUserToGroup.js +16 -52
- package/leiamnash/changeAdminStatus.js +37 -69
- package/leiamnash/changeArchivedStatus.js +12 -26
- package/leiamnash/changeBio.js +6 -19
- package/leiamnash/changeBlockedStatus.js +3 -14
- package/leiamnash/changeGroupImage.js +16 -40
- package/leiamnash/changeNickname.js +11 -27
- package/leiamnash/changeThreadColor.js +10 -20
- package/leiamnash/changeThreadEmoji.js +10 -24
- package/leiamnash/chat.js +279 -414
- package/leiamnash/createNewGroup.js +12 -28
- package/leiamnash/createPoll.js +13 -25
- package/leiamnash/deleteMessage.js +12 -24
- package/leiamnash/deleteThread.js +11 -25
- package/leiamnash/forwardAttachment.js +13 -26
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/getCurrentUserID.js +1 -1
- package/leiamnash/getEmojiUrl.js +2 -4
- package/leiamnash/getFriendsList.js +10 -21
- package/leiamnash/getThreadHistory.js +58 -166
- package/leiamnash/getThreadHistoryDeprecated.js +20 -42
- package/leiamnash/getThreadInfo.js +25 -60
- package/leiamnash/getThreadInfoDeprecated.js +18 -42
- package/leiamnash/getThreadList.js +41 -66
- package/leiamnash/getThreadListDeprecated.js +14 -43
- package/leiamnash/getThreadPictures.js +17 -37
- package/leiamnash/getUserID.js +9 -14
- package/leiamnash/getUserInfo.js +12 -18
- package/leiamnash/handleFriendRequest.js +37 -52
- package/leiamnash/handleMessageRequest.js +14 -32
- package/leiamnash/httpGet.js +12 -17
- package/leiamnash/httpPost.js +12 -17
- package/leiamnash/listen.js +553 -0
- package/leiamnash/listenMqtt-Test.js +687 -0
- package/leiamnash/listenMqtt.js +1 -2
- package/leiamnash/logout.js +13 -20
- package/leiamnash/markAsDelivered.js +11 -22
- package/leiamnash/markAsRead.js +11 -21
- package/leiamnash/markAsReadAll.js +10 -20
- package/leiamnash/markAsSeen.js +7 -18
- package/leiamnash/muteThread.js +11 -18
- package/leiamnash/removeUserFromGroup.js +14 -48
- package/leiamnash/resolvePhotoUrl.js +8 -17
- package/leiamnash/searchForThread.js +10 -21
- package/leiamnash/sendTypingIndicator.js +14 -47
- package/leiamnash/setMessageReaction.js +12 -26
- package/leiamnash/setPostReaction.js +13 -26
- package/leiamnash/setTitle.js +13 -29
- package/leiamnash/threadColors.js +28 -44
- package/leiamnash/unfriend.js +9 -19
- package/leiamnash/unsendMessage.js +9 -19
- package/package.json +1 -1
- package/replit.nix +1 -3
- package/utils.js +0 -0
@@ -4,58 +4,43 @@ var utils = require("../utils");
|
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
callback = function (err, friendList) {
|
23
|
-
if (err) {
|
24
|
-
return rejectFunc(err);
|
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
|
+
};
|
25
22
|
}
|
26
|
-
resolveFunc(friendList);
|
27
|
-
};
|
28
|
-
}
|
29
23
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
24
|
+
var form = {
|
25
|
+
viewer_id: 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;
|
36
45
|
};
|
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
|
-
};
|
46
|
+
};
|
@@ -3,27 +3,21 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
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
|
-
}
|
8
|
+
if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
|
13
9
|
|
14
|
-
var resolveFunc = function(){};
|
15
|
-
var rejectFunc = function(){};
|
10
|
+
var resolveFunc = function () { };
|
11
|
+
var rejectFunc = function () { };
|
16
12
|
var returnPromise = new Promise(function (resolve, reject) {
|
17
13
|
resolveFunc = resolve;
|
18
14
|
rejectFunc = reject;
|
19
15
|
});
|
20
16
|
|
21
17
|
if (!callback) {
|
22
|
-
callback = function (err,
|
23
|
-
if (err)
|
24
|
-
|
25
|
-
}
|
26
|
-
resolveFunc(friendList);
|
18
|
+
callback = function (err, data) {
|
19
|
+
if (err) return rejectFunc(err);
|
20
|
+
resolveFunc(data);
|
27
21
|
};
|
28
22
|
}
|
29
23
|
|
@@ -31,35 +25,23 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
31
25
|
client: "mercury"
|
32
26
|
};
|
33
27
|
|
34
|
-
if (utils.getType(threadID) !== "Array")
|
35
|
-
threadID = [threadID];
|
36
|
-
}
|
28
|
+
if (utils.getType(threadID) !== "Array") threadID = [threadID];
|
37
29
|
|
38
30
|
var messageBox = accept ? "inbox" : "other";
|
39
|
-
|
40
|
-
for (var i = 0; i < threadID.length; i++) {
|
41
|
-
form[messageBox + "[" + i + "]"] = threadID[i];
|
42
|
-
}
|
31
|
+
for (var i = 0; i < threadID.length; i++) form[messageBox + "[" + i + "]"] = threadID[i];
|
43
32
|
|
44
33
|
defaultFuncs
|
45
|
-
.post(
|
46
|
-
"https://www.facebook.com/ajax/mercury/move_thread.php",
|
47
|
-
ctx.jar,
|
48
|
-
form
|
49
|
-
)
|
34
|
+
.post("https://www.facebook.com/ajax/mercury/move_thread.php", ctx.jar, form)
|
50
35
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
51
|
-
.then(function(resData) {
|
52
|
-
if (resData.error)
|
53
|
-
throw resData;
|
54
|
-
}
|
55
|
-
|
36
|
+
.then(function (resData) {
|
37
|
+
if (resData.error) throw resData;
|
56
38
|
return callback();
|
57
39
|
})
|
58
|
-
.catch(function(err) {
|
40
|
+
.catch(function (err) {
|
59
41
|
log.error("handleMessageRequest", err);
|
60
42
|
return callback(err);
|
61
43
|
});
|
62
|
-
|
44
|
+
|
63
45
|
return returnPromise;
|
64
46
|
};
|
65
47
|
};
|
package/leiamnash/httpGet.js
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function httpGet(url, form, callback, notAPI) {
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
10
|
|
11
11
|
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
@@ -17,36 +17,31 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
17
17
|
callback = form;
|
18
18
|
form = {};
|
19
19
|
}
|
20
|
-
|
21
20
|
form = form || {};
|
22
21
|
|
23
|
-
callback = callback || function(err, data) {
|
24
|
-
|
25
|
-
|
22
|
+
callback = callback || function (err, data) {
|
23
|
+
if (err) return rejectFunc(err);
|
24
|
+
resolveFunc(data);
|
26
25
|
};
|
27
26
|
|
28
27
|
if (notAPI) {
|
29
28
|
utils
|
30
29
|
.get(url, ctx.jar, form, ctx.globalOptions)
|
31
|
-
.then(
|
32
|
-
|
33
|
-
})
|
34
|
-
.catch(function(err) {
|
30
|
+
.then(resData => callback(null, resData.body.toString()))
|
31
|
+
.catch(function (err) {
|
35
32
|
log.error("httpGet", err);
|
36
33
|
return callback(err);
|
37
34
|
});
|
38
|
-
}
|
35
|
+
}
|
36
|
+
else {
|
39
37
|
defaultFuncs
|
40
38
|
.get(url, ctx.jar, form)
|
41
|
-
.then(
|
42
|
-
|
43
|
-
})
|
44
|
-
.catch(function(err) {
|
39
|
+
.then(resData => callback(null, resData.body.toString()))
|
40
|
+
.catch(function (err) {
|
45
41
|
log.error("httpGet", err);
|
46
42
|
return callback(err);
|
47
43
|
});
|
48
44
|
}
|
49
|
-
|
50
45
|
return returnPromise;
|
51
46
|
};
|
52
47
|
};
|
package/leiamnash/httpPost.js
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
5
|
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function httpGet(url, form, callback, notAPI) {
|
8
|
-
var resolveFunc = function(){};
|
9
|
-
var rejectFunc = function(){};
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
10
|
|
11
11
|
var returnPromise = new Promise(function (resolve, reject) {
|
12
12
|
resolveFunc = resolve;
|
@@ -17,36 +17,31 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
17
17
|
callback = form;
|
18
18
|
form = {};
|
19
19
|
}
|
20
|
-
|
21
20
|
form = form || {};
|
22
21
|
|
23
|
-
callback = callback || function(err, data) {
|
24
|
-
|
25
|
-
|
22
|
+
callback = callback || function (err, data) {
|
23
|
+
if (err) return rejectFunc(err);
|
24
|
+
resolveFunc(data);
|
26
25
|
};
|
27
26
|
|
28
27
|
if (notAPI) {
|
29
28
|
utils
|
30
29
|
.post(url, ctx.jar, form, ctx.globalOptions)
|
31
|
-
.then(
|
32
|
-
|
33
|
-
})
|
34
|
-
.catch(function(err) {
|
30
|
+
.then(resData => callback(null, resData.body.toString()))
|
31
|
+
.catch(function (err) {
|
35
32
|
log.error("httpPost", err);
|
36
33
|
return callback(err);
|
37
34
|
});
|
38
|
-
}
|
35
|
+
}
|
36
|
+
else {
|
39
37
|
defaultFuncs
|
40
38
|
.post(url, ctx.jar, form, {})
|
41
|
-
.then(
|
42
|
-
|
43
|
-
})
|
44
|
-
.catch(function(err) {
|
39
|
+
.then(resData => callback(null, resData.body.toString()))
|
40
|
+
.catch(function (err) {
|
45
41
|
log.error("httpPost", err);
|
46
42
|
return callback(err);
|
47
43
|
});
|
48
44
|
}
|
49
|
-
|
50
45
|
return returnPromise;
|
51
46
|
};
|
52
47
|
};
|