alicezetion 1.5.3 → 1.5.5
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 +576 -382
- package/leiamnash/addExternalModule.js +19 -16
- package/leiamnash/addUserToGroup.js +113 -79
- package/leiamnash/changeAdminStatus.js +79 -79
- package/leiamnash/changeArchivedStatus.js +55 -41
- package/leiamnash/changeBio.js +77 -65
- package/leiamnash/changeBlockedStatus.js +47 -36
- package/leiamnash/changeGroupImage.js +129 -106
- package/leiamnash/changeNickname.js +59 -45
- package/leiamnash/changeThreadColor.js +71 -62
- package/leiamnash/changeThreadEmoji.js +55 -42
- package/leiamnash/chat.js +459 -374
- package/leiamnash/createNewGroup.js +86 -70
- package/leiamnash/createPoll.js +71 -60
- package/leiamnash/deleteMessage.js +56 -45
- package/leiamnash/deleteThread.js +56 -43
- package/leiamnash/forwardAttachment.js +60 -48
- package/leiamnash/getCurrentUserID.js +7 -7
- package/leiamnash/getEmojiUrl.js +29 -27
- package/leiamnash/getFriendsList.js +84 -73
- package/leiamnash/getThreadHistory.js +645 -537
- package/leiamnash/getThreadHistoryDeprecated.js +93 -0
- package/leiamnash/getThreadInfo.js +206 -425
- package/leiamnash/getThreadInfoDeprecated.js +80 -0
- package/leiamnash/getThreadList.js +238 -213
- package/leiamnash/getThreadListDeprecated.js +75 -0
- package/leiamnash/getThreadPictures.js +79 -59
- package/leiamnash/getUserID.js +66 -62
- package/leiamnash/getUserInfo.js +72 -113
- package/leiamnash/handleFriendRequest.js +61 -46
- package/leiamnash/handleMessageRequest.js +65 -49
- package/leiamnash/httpGet.js +52 -49
- package/leiamnash/httpPost.js +52 -48
- package/leiamnash/listenMqtt.js +789 -787
- package/leiamnash/logout.js +75 -68
- package/leiamnash/markAsDelivered.js +58 -48
- package/leiamnash/markAsRead.js +80 -70
- package/leiamnash/markAsReadAll.js +49 -42
- package/leiamnash/markAsSeen.js +59 -51
- package/leiamnash/muteThread.js +52 -47
- package/leiamnash/removeUserFromGroup.js +79 -49
- package/leiamnash/resolvePhotoUrl.js +45 -37
- package/leiamnash/searchForThread.js +53 -43
- package/leiamnash/sendTypingIndicator.js +103 -80
- package/leiamnash/setMessageReaction.js +117 -109
- package/leiamnash/setPostReaction.js +76 -102
- package/leiamnash/setTitle.js +86 -74
- package/leiamnash/threadColors.js +57 -39
- package/leiamnash/unfriend.js +52 -43
- package/leiamnash/unsendMessage.js +49 -40
- package/package.json +72 -90
- package/utils.js +1356 -1684
- package/Extra/Database/index.js +0 -469
- package/Extra/ExtraAddons.js +0 -82
- package/Extra/ExtraFindUID.js +0 -62
- package/Extra/ExtraGetThread.js +0 -340
- package/Extra/ExtraScreenShot.js +0 -430
- package/Extra/ExtraUptimeRobot.js +0 -38
- package/Extra/Html/Classic/script.js +0 -119
- package/Extra/Html/Classic/style.css +0 -8
- package/Extra/Security/AES_256_GCM/index.js +0 -0
- package/Extra/Security/Base/Step_1.js +0 -6
- package/Extra/Security/Base/Step_2.js +0 -22
- package/Extra/Security/Base/Step_3.js +0 -22
- package/Extra/Security/Base/index.js +0 -174
- package/Extra/Security/Index.js +0 -5
- package/Extra/Security/Step_1.js +0 -6
- package/Extra/Security/Step_2.js +0 -22
- package/Extra/Security/Step_3.js +0 -22
- package/Extra/Src/Change_Environment.js +0 -24
- package/Extra/Src/Check_Update.js +0 -67
- package/Extra/Src/History.js +0 -115
- package/Extra/Src/Instant_Update.js +0 -65
- package/Extra/Src/Last-Run.js +0 -65
- package/Extra/Src/Premium.js +0 -81
- package/Extra/Src/Release_Memory.js +0 -41
- package/Extra/Src/Websocket.js +0 -213
- package/Extra/Src/image/checkmate.jpg +0 -0
- package/Extra/Src/uuid.js +0 -137
- package/Func/AcceptAgreement.js +0 -31
- package/Func/ClearCache.js +0 -64
- package/Func/ReportV1.js +0 -54
- package/Language/index.json +0 -217
- package/Main.js +0 -1270
- package/broadcast.js +0 -40
- package/leiamnash/Dev_Horizon_Data.js +0 -125
- package/leiamnash/Premium.js +0 -25
- package/leiamnash/Screenshot.js +0 -83
- package/leiamnash/changeAvt.js +0 -85
- package/leiamnash/getAccessToken.js +0 -28
- package/leiamnash/getMessage.js +0 -80
- package/leiamnash/getThreadMain.js +0 -220
- package/leiamnash/getUID.js +0 -59
- package/leiamnash/getUserInfoMain.js +0 -65
- package/leiamnash/getUserInfoV2.js +0 -32
- package/leiamnash/getUserInfoV3.js +0 -63
- package/leiamnash/getUserInfoV4.js +0 -55
- package/leiamnash/getUserInfoV5.js +0 -61
- package/leiamnash/httpPostFormData.js +0 -41
- package/leiamnash/sendMessage.js +0 -379
- package/logger.js +0 -66
package/leiamnash/logout.js
CHANGED
@@ -1,68 +1,75 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require("../utils");
|
4
|
-
var log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function
|
7
|
-
return function logout(callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err, friendList) {
|
17
|
-
if (err)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
.
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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 logout(callback) {
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback) {
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
var form = {
|
25
|
+
pmid: "0"
|
26
|
+
};
|
27
|
+
|
28
|
+
defaultFuncs
|
29
|
+
.post(
|
30
|
+
"https://www.facebook.com/bluebar/modern_settings_menu/?help_type=364455653583099&show_contextual_help=1",
|
31
|
+
ctx.jar,
|
32
|
+
form
|
33
|
+
)
|
34
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
35
|
+
.then(function(resData) {
|
36
|
+
var elem = resData.jsmods.instances[0][2][0].filter(function(v) {
|
37
|
+
return v.value === "logout";
|
38
|
+
})[0];
|
39
|
+
|
40
|
+
var html = resData.jsmods.markup.filter(function(v) {
|
41
|
+
return v[0] === elem.markup.__m;
|
42
|
+
})[0][1].__html;
|
43
|
+
|
44
|
+
var form = {
|
45
|
+
fb_dtsg: utils.getFrom(html, '"fb_dtsg" value="', '"'),
|
46
|
+
ref: utils.getFrom(html, '"ref" value="', '"'),
|
47
|
+
h: utils.getFrom(html, '"h" value="', '"')
|
48
|
+
};
|
49
|
+
|
50
|
+
return defaultFuncs
|
51
|
+
.post("https://www.facebook.com/logout.php", ctx.jar, form)
|
52
|
+
.then(utils.saveCookies(ctx.jar));
|
53
|
+
})
|
54
|
+
.then(function(res) {
|
55
|
+
if (!res.headers) {
|
56
|
+
throw { error: "An error occurred when logging out." };
|
57
|
+
}
|
58
|
+
|
59
|
+
return defaultFuncs
|
60
|
+
.get(res.headers.location, ctx.jar)
|
61
|
+
.then(utils.saveCookies(ctx.jar));
|
62
|
+
})
|
63
|
+
.then(function() {
|
64
|
+
ctx.loggedIn = false;
|
65
|
+
log.info("logout", "Logged out successfully.");
|
66
|
+
callback();
|
67
|
+
})
|
68
|
+
.catch(function(err) {
|
69
|
+
log.error("logout", err);
|
70
|
+
return callback(err);
|
71
|
+
});
|
72
|
+
|
73
|
+
return returnPromise;
|
74
|
+
};
|
75
|
+
};
|
@@ -1,48 +1,58 @@
|
|
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 markAsDelivered(threadID, messageID, callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err,
|
17
|
-
if (err)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
form
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
.
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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 markAsDelivered(threadID, messageID, callback) {
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback) {
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
if (!threadID || !messageID) {
|
25
|
+
return callback("Error: messageID or threadID is not defined");
|
26
|
+
}
|
27
|
+
|
28
|
+
var form = {};
|
29
|
+
|
30
|
+
form["message_ids[0]"] = messageID;
|
31
|
+
form["thread_ids[" + threadID + "][0]"] = messageID;
|
32
|
+
|
33
|
+
defaultFuncs
|
34
|
+
.post(
|
35
|
+
"https://www.facebook.com/ajax/mercury/delivery_receipts.php",
|
36
|
+
ctx.jar,
|
37
|
+
form
|
38
|
+
)
|
39
|
+
.then(utils.saveCookies(ctx.jar))
|
40
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
|
+
.then(function (resData) {
|
42
|
+
if (resData.error) {
|
43
|
+
throw resData;
|
44
|
+
}
|
45
|
+
|
46
|
+
return callback();
|
47
|
+
})
|
48
|
+
.catch(function (err) {
|
49
|
+
log.error("markAsDelivered", err);
|
50
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
|
51
|
+
ctx.loggedIn = false;
|
52
|
+
}
|
53
|
+
return callback(err);
|
54
|
+
});
|
55
|
+
|
56
|
+
return returnPromise;
|
57
|
+
};
|
58
|
+
};
|
package/leiamnash/markAsRead.js
CHANGED
@@ -1,70 +1,80 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require("../utils");
|
4
|
-
var log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return async function markAsRead(threadID, read, callback) {
|
8
|
-
if (utils.getType(read) === 'Function' || utils.getType(read) === 'AsyncFunction') {
|
9
|
-
callback = read;
|
10
|
-
read = true;
|
11
|
-
}
|
12
|
-
if (read == undefined)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
form["
|
24
|
-
form["
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require("../utils");
|
4
|
+
var log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
+
return async function markAsRead(threadID, read, callback) {
|
8
|
+
if (utils.getType(read) === 'Function' || utils.getType(read) === 'AsyncFunction') {
|
9
|
+
callback = read;
|
10
|
+
read = true;
|
11
|
+
}
|
12
|
+
if (read == undefined) {
|
13
|
+
read = true;
|
14
|
+
}
|
15
|
+
|
16
|
+
if (!callback) {
|
17
|
+
callback = () => { };
|
18
|
+
}
|
19
|
+
|
20
|
+
var form = {};
|
21
|
+
|
22
|
+
if (typeof ctx.globalOptions.pageID !== 'undefined') {
|
23
|
+
form["source"] = "PagesManagerMessagesInterface";
|
24
|
+
form["request_user_id"] = ctx.globalOptions.pageID;
|
25
|
+
form["ids[" + threadID + "]"] = read;
|
26
|
+
form["watermarkTimestamp"] = new Date().getTime();
|
27
|
+
form["shouldSendReadReceipt"] = true;
|
28
|
+
form["commerce_last_message_type"] = "";
|
29
|
+
//form["titanOriginatedThreadId"] = utils.generateThreadingID(ctx.clientID);
|
30
|
+
|
31
|
+
let resData;
|
32
|
+
try {
|
33
|
+
resData = await (
|
34
|
+
defaultFuncs
|
35
|
+
.post(
|
36
|
+
"https://www.facebook.com/ajax/mercury/change_read_status.php",
|
37
|
+
ctx.jar,
|
38
|
+
form
|
39
|
+
)
|
40
|
+
.then(utils.saveCookies(ctx.jar))
|
41
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
42
|
+
);
|
43
|
+
} catch (e) {
|
44
|
+
callback(e);
|
45
|
+
return e;
|
46
|
+
}
|
47
|
+
|
48
|
+
if (resData.error) {
|
49
|
+
let err = resData.error;
|
50
|
+
log.error("markAsRead", err);
|
51
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
|
52
|
+
ctx.loggedIn = false;
|
53
|
+
}
|
54
|
+
callback(err);
|
55
|
+
return err;
|
56
|
+
}
|
57
|
+
|
58
|
+
callback();
|
59
|
+
return null;
|
60
|
+
} else {
|
61
|
+
try {
|
62
|
+
if (ctx.mqttClient) {
|
63
|
+
let err = await new Promise(r => ctx.mqttClient.publish("/mark_thread", JSON.stringify({
|
64
|
+
threadID,
|
65
|
+
mark: "read",
|
66
|
+
state: read
|
67
|
+
}), { qos: 1, retain: false }, r));
|
68
|
+
if (err) throw err;
|
69
|
+
} else {
|
70
|
+
throw {
|
71
|
+
error: "You can only use this function after you start listening."
|
72
|
+
};
|
73
|
+
}
|
74
|
+
} catch (e) {
|
75
|
+
callback(e);
|
76
|
+
return e;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
};
|
80
|
+
};
|
@@ -1,43 +1,50 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require("../utils");
|
4
|
-
var log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function
|
7
|
-
return function markAsReadAll(callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err,
|
17
|
-
if (err)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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 markAsReadAll(callback) {
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback) {
|
16
|
+
callback = function (err, friendList) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc(friendList);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
var form = {
|
25
|
+
folder: 'inbox'
|
26
|
+
};
|
27
|
+
|
28
|
+
defaultFuncs
|
29
|
+
.post(
|
30
|
+
"https://www.facebook.com/ajax/mercury/mark_folder_as_read.php",
|
31
|
+
ctx.jar,
|
32
|
+
form
|
33
|
+
)
|
34
|
+
.then(utils.saveCookies(ctx.jar))
|
35
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
36
|
+
.then(function(resData) {
|
37
|
+
if (resData.error) {
|
38
|
+
throw resData;
|
39
|
+
}
|
40
|
+
|
41
|
+
return callback();
|
42
|
+
})
|
43
|
+
.catch(function(err) {
|
44
|
+
log.error("markAsReadAll", err);
|
45
|
+
return callback(err);
|
46
|
+
});
|
47
|
+
|
48
|
+
return returnPromise;
|
49
|
+
};
|
43
50
|
};
|
package/leiamnash/markAsSeen.js
CHANGED
@@ -1,51 +1,59 @@
|
|
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
|
8
|
-
if (utils.getType(seen_timestamp) == "Function" ||
|
9
|
-
utils.getType(seen_timestamp) == "AsyncFunction") {
|
10
|
-
callback = seen_timestamp;
|
11
|
-
seen_timestamp = Date.now();
|
12
|
-
}
|
13
|
-
|
14
|
-
var resolveFunc = function () { };
|
15
|
-
var rejectFunc = function () { };
|
16
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
17
|
-
resolveFunc = resolve;
|
18
|
-
rejectFunc = reject;
|
19
|
-
});
|
20
|
-
|
21
|
-
if (!callback) {
|
22
|
-
callback = function (err,
|
23
|
-
if (err)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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 markAsRead(seen_timestamp, callback) {
|
8
|
+
if (utils.getType(seen_timestamp) == "Function" ||
|
9
|
+
utils.getType(seen_timestamp) == "AsyncFunction") {
|
10
|
+
callback = seen_timestamp;
|
11
|
+
seen_timestamp = Date.now();
|
12
|
+
}
|
13
|
+
|
14
|
+
var resolveFunc = function () { };
|
15
|
+
var rejectFunc = function () { };
|
16
|
+
var 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
|
+
var form = {
|
31
|
+
seen_timestamp: seen_timestamp
|
32
|
+
};
|
33
|
+
|
34
|
+
defaultFuncs
|
35
|
+
.post(
|
36
|
+
"https://www.facebook.com/ajax/mercury/mark_seen.php",
|
37
|
+
ctx.jar,
|
38
|
+
form
|
39
|
+
)
|
40
|
+
.then(utils.saveCookies(ctx.jar))
|
41
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
42
|
+
.then(function (resData) {
|
43
|
+
if (resData.error) {
|
44
|
+
throw resData;
|
45
|
+
}
|
46
|
+
|
47
|
+
return callback();
|
48
|
+
})
|
49
|
+
.catch(function (err) {
|
50
|
+
log.error("markAsSeen", err);
|
51
|
+
if (utils.getType(err) == "Object" && err.error === "Not logged in.") {
|
52
|
+
ctx.loggedIn = false;
|
53
|
+
}
|
54
|
+
return callback(err);
|
55
|
+
});
|
56
|
+
|
57
|
+
return returnPromise;
|
58
|
+
};
|
59
|
+
};
|