alicezetion 1.7.0 → 1.7.2
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/Extra/Database/index.js +399 -0
- package/Extra/Database/methods.js +286 -0
- package/Extra/ExtraAddons.js +213 -0
- package/Extra/ExtraGetThread.js +1 -0
- package/Extra/ExtraUptimeRobot.js +59 -0
- package/Extra/PM2/ecosystem.config.js +23 -0
- package/Extra/Src/Last-Run.js +48 -0
- package/Language/index.json +151 -0
- package/StateCrypt.js +22 -0
- package/broadcast.js +42 -0
- package/index.js +755 -533
- package/logger.js +21 -0
- package/package.json +35 -21
- package/replit.nix +0 -3
- package/src/addExternalModule.js +23 -0
- package/{leiamnash → src}/addUserToGroup.js +11 -23
- package/{leiamnash → src}/changeAdminStatus.js +32 -16
- package/{leiamnash → src}/changeArchivedStatus.js +9 -17
- package/src/changeAvt.js +91 -0
- package/{leiamnash → src}/changeBio.js +16 -24
- package/{leiamnash → src}/changeBlockedStatus.js +13 -18
- package/{leiamnash → src}/changeGroupImage.js +14 -23
- package/{leiamnash → src}/changeNickname.js +9 -14
- package/{leiamnash → src}/changeThreadColor.js +6 -10
- package/{leiamnash → src}/changeThreadEmoji.js +6 -11
- package/{leiamnash → src}/chat.js +116 -127
- package/{leiamnash → src}/createNewGroup.js +19 -27
- package/{leiamnash → src}/createPoll.js +6 -12
- package/{leiamnash → src}/deleteMessage.js +8 -13
- package/{leiamnash → src}/deleteThread.js +7 -14
- package/{leiamnash → src}/forwardAttachment.js +9 -16
- package/src/getAccessToken.js +32 -0
- package/{leiamnash → src}/getCurrentUserID.js +0 -0
- package/{leiamnash → src}/getEmojiUrl.js +1 -2
- package/{leiamnash → src}/getFriendsList.js +11 -14
- package/src/getMessage.js +84 -0
- package/{leiamnash → src}/getThreadHistory.js +27 -38
- package/{leiamnash → src}/getThreadHistoryDeprecated.js +14 -25
- package/src/getThreadInfo.js +197 -0
- package/{leiamnash → src}/getThreadInfoDeprecated.js +12 -24
- package/{leiamnash → src}/getThreadList.js +122 -88
- package/{leiamnash → src}/getThreadListDeprecated.js +9 -20
- package/{leiamnash → src}/getThreadPictures.js +9 -17
- package/{leiamnash → src}/getUserID.js +8 -11
- package/{leiamnash → src}/getUserInfo.js +12 -16
- package/src/getUserInfoV2.js +35 -0
- package/src/handleFriendRequest.js +47 -0
- package/{leiamnash → src}/handleMessageRequest.js +12 -22
- package/{leiamnash → src}/httpGet.js +15 -13
- package/{leiamnash → src}/httpPost.js +14 -13
- package/src/httpPostFormData.js +46 -0
- package/src/listenMqtt.js +1280 -0
- package/{leiamnash → src}/logout.js +7 -9
- package/{leiamnash → src}/markAsDelivered.js +14 -18
- package/{leiamnash → src}/markAsRead.js +30 -28
- package/{leiamnash → src}/markAsSeen.js +18 -19
- package/{leiamnash → src}/muteThread.js +7 -8
- package/{leiamnash/setMessageReaction.js → src/react.js} +15 -18
- package/{leiamnash → src}/removeUserFromGroup.js +13 -20
- package/{leiamnash → src}/resolvePhotoUrl.js +7 -13
- package/{leiamnash → src}/searchForThread.js +8 -13
- package/{leiamnash/markAsReadAll.js → src/seen.js} +10 -13
- package/{leiamnash → src}/sendTypingIndicator.js +23 -31
- package/src/setPostReaction.js +104 -0
- package/{leiamnash → src}/setTitle.js +15 -21
- package/src/threadColors.js +39 -0
- package/{leiamnash → src}/unfriend.js +9 -13
- package/{leiamnash/unsendMessage.js → src/unsend.js} +7 -16
- package/utils.js +1112 -1236
- package/leiamnash/addExternalModule.js +0 -19
- package/leiamnash/changeApprovalMode.js +0 -80
- package/leiamnash/getThreadInfo.js +0 -212
- package/leiamnash/handleFriendRequest.js +0 -61
- package/leiamnash/listenMqtt.js +0 -1129
- package/leiamnash/setPostReaction.js +0 -76
- package/leiamnash/threadColors.js +0 -57
package/index.js
CHANGED
@@ -1,61 +1,139 @@
|
|
1
|
-
|
1
|
+
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
var cheerio = require("cheerio");
|
5
|
-
var log = require("npmlog");
|
3
|
+
/!-[ Max Cpu Speed ]-!/
|
6
4
|
|
5
|
+
process.env.UV_THREADPOOL_SIZE = require('os').cpus().length;
|
6
|
+
|
7
|
+
/!-[ Global Set ]-!/
|
8
|
+
|
9
|
+
global.isThread = new Array();
|
10
|
+
global.isUser = new Array();
|
11
|
+
global.startTime = Date.now();
|
12
|
+
global.getText = require('gettext.js')();
|
13
|
+
|
14
|
+
/!-[ Require All Package Need Use ]-!/
|
15
|
+
/*globalThis.Fca = new Object({
|
16
|
+
test: console,log("test"),
|
17
|
+
Require: new Object({})
|
18
|
+
});*/
|
19
|
+
var utils = require("./utils"),
|
20
|
+
cheerio = require("cheerio"),
|
21
|
+
log = require("npmlog"),
|
22
|
+
//{ getAccessToken } = require('./Extra/ExtraAddons'),
|
23
|
+
logger = require('./logger'),
|
24
|
+
fs = require('fs-extra'),
|
25
|
+
getText = require('gettext.js')(),
|
26
|
+
logger = require('./logger'),
|
27
|
+
Fetch = require('got'),
|
28
|
+
fs = require('fs-extra'),
|
29
|
+
StateCrypt = require('./StateCrypt'),
|
30
|
+
Client = require("@replit/database"),
|
31
|
+
languageFile = require('./Language/index.json'),
|
32
|
+
ObjFastConfig = {
|
33
|
+
"Language": "en",
|
34
|
+
"MainColor": "#9900FF",
|
35
|
+
"BroadCast": true,
|
36
|
+
"EncryptFeature": true,
|
37
|
+
"PreKey": "",
|
38
|
+
"Uptime": false
|
39
|
+
};
|
40
|
+
|
41
|
+
|
42
|
+
/!-[ Check File To Run Process ]-!/
|
43
|
+
|
44
|
+
try {
|
45
|
+
if (!fs.existsSync('./alice/alicezetion.json')) {
|
46
|
+
fs.writeFileSync("./alice/alicezetion.json", JSON.stringify(ObjFastConfig, null, "\t"));
|
47
|
+
process.exit(1);
|
48
|
+
} else if (fs.existsSync('./alice/alicezetion.json')) {
|
49
|
+
try {
|
50
|
+
var DataLanguageSetting = require("../../alicezetion.json");
|
51
|
+
} catch (e) {
|
52
|
+
logger("Invalid Config Settings, Restoring Default...");
|
53
|
+
fs.writeFileSync("./alice/alicezetion.json", JSON.stringify(ObjFastConfig, null, "\t"));
|
54
|
+
process.exit(1);
|
55
|
+
}
|
56
|
+
try {
|
57
|
+
if (DataLanguageSetting && !DataLanguageSetting.PreKey) {
|
58
|
+
DataLanguageSetting.PreKey = "";
|
59
|
+
fs.writeFileSync("./alice/alicezetion.json", JSON.stringify(DataLanguageSetting, null, "\t"));
|
60
|
+
}
|
61
|
+
} catch (e) {
|
62
|
+
console.log(e);
|
63
|
+
}
|
64
|
+
if (!languageFile.some(i => i.Language == DataLanguageSetting.Language)) {
|
65
|
+
logger("Not Support Language: " + DataLanguageSetting.Language + " Only 'en' and 'vi'", "[ Alicezetion ]");
|
66
|
+
process.exit(0);
|
67
|
+
}
|
68
|
+
var Language = languageFile.find(i => i.Language == DataLanguageSetting.Language).Folder.Index;
|
69
|
+
} else process.exit(1);
|
70
|
+
if (utils.getType(DataLanguageSetting.BroadCast) != "Boolean" && DataLanguageSetting.BroadCast != undefined) {
|
71
|
+
log.warn("FastConfig-BroadCast", getText.gettext(Language.IsNotABoolean, DataLanguageSetting.BroadCast));
|
72
|
+
process.exit(0)
|
73
|
+
} else if (DataLanguageSetting.BroadCast == undefined) {
|
74
|
+
fs.writeFileSync("./alice/alicezetion.json", JSON.stringify(ObjFastConfig, null, "\t"));
|
75
|
+
process.exit(1);
|
76
|
+
}
|
77
|
+
|
78
|
+
global.FastConfig = DataLanguageSetting;
|
79
|
+
|
80
|
+
} catch (e) {
|
81
|
+
console.log(e);
|
82
|
+
logger.Error();
|
83
|
+
}
|
84
|
+
|
85
|
+
/!-[ Set Variable For Process ]-!/
|
86
|
+
|
87
|
+
log.maxRecordSize = 100;
|
7
88
|
var checkVerified = null;
|
8
89
|
|
9
|
-
|
10
|
-
log.maxRecordSize = defaultLogRecordSize;
|
90
|
+
/!-[ Function setOptions ]-!/
|
11
91
|
|
12
92
|
function setOptions(globalOptions, options) {
|
13
93
|
Object.keys(options).map(function(key) {
|
14
94
|
switch (key) {
|
15
|
-
case
|
95
|
+
case 'pauseLog':
|
16
96
|
if (options.pauseLog) log.pause();
|
17
97
|
break;
|
18
|
-
case
|
98
|
+
case 'online':
|
19
99
|
globalOptions.online = Boolean(options.online);
|
20
100
|
break;
|
21
|
-
case
|
101
|
+
case 'logLevel':
|
22
102
|
log.level = options.logLevel;
|
23
103
|
globalOptions.logLevel = options.logLevel;
|
24
104
|
break;
|
25
|
-
case
|
105
|
+
case 'logRecordSize':
|
26
106
|
log.maxRecordSize = options.logRecordSize;
|
27
107
|
globalOptions.logRecordSize = options.logRecordSize;
|
28
108
|
break;
|
29
|
-
case
|
109
|
+
case 'selfListen':
|
30
110
|
globalOptions.selfListen = Boolean(options.selfListen);
|
31
111
|
break;
|
32
|
-
case
|
112
|
+
case 'listenEvents':
|
33
113
|
globalOptions.listenEvents = Boolean(options.listenEvents);
|
34
114
|
break;
|
35
|
-
case
|
115
|
+
case 'pageID':
|
36
116
|
globalOptions.pageID = options.pageID.toString();
|
37
117
|
break;
|
38
|
-
case
|
118
|
+
case 'updatePresence':
|
39
119
|
globalOptions.updatePresence = Boolean(options.updatePresence);
|
40
120
|
break;
|
41
|
-
case
|
121
|
+
case 'forceLogin':
|
42
122
|
globalOptions.forceLogin = Boolean(options.forceLogin);
|
43
123
|
break;
|
44
|
-
case
|
124
|
+
case 'userAgent':
|
45
125
|
globalOptions.userAgent = options.userAgent;
|
46
126
|
break;
|
47
|
-
case
|
48
|
-
globalOptions.autoMarkDelivery = Boolean(
|
49
|
-
options.autoMarkDelivery
|
50
|
-
);
|
127
|
+
case 'autoMarkDelivery':
|
128
|
+
globalOptions.autoMarkDelivery = Boolean(options.autoMarkDelivery);
|
51
129
|
break;
|
52
|
-
case
|
130
|
+
case 'autoMarkRead':
|
53
131
|
globalOptions.autoMarkRead = Boolean(options.autoMarkRead);
|
54
132
|
break;
|
55
|
-
case
|
133
|
+
case 'listenTyping':
|
56
134
|
globalOptions.listenTyping = Boolean(options.listenTyping);
|
57
135
|
break;
|
58
|
-
case
|
136
|
+
case 'proxy':
|
59
137
|
if (typeof options.proxy != "string") {
|
60
138
|
delete globalOptions.proxy;
|
61
139
|
utils.setProxy();
|
@@ -64,58 +142,40 @@ function setOptions(globalOptions, options) {
|
|
64
142
|
utils.setProxy(globalOptions.proxy);
|
65
143
|
}
|
66
144
|
break;
|
67
|
-
case
|
145
|
+
case 'autoReconnect':
|
68
146
|
globalOptions.autoReconnect = Boolean(options.autoReconnect);
|
69
147
|
break;
|
70
|
-
case
|
148
|
+
case 'emitReady':
|
71
149
|
globalOptions.emitReady = Boolean(options.emitReady);
|
72
150
|
break;
|
73
151
|
default:
|
74
|
-
log.warn(
|
75
|
-
"setOptions",
|
76
|
-
"Unrecognized option given to setOptions: " + key
|
77
|
-
);
|
152
|
+
log.warn("setOptions", "Unrecognized option given to setOptions: " + key);
|
78
153
|
break;
|
79
154
|
}
|
80
155
|
});
|
81
156
|
}
|
82
157
|
|
83
|
-
|
84
|
-
var maybeCookie = jar
|
85
|
-
.getCookies("https://www.facebook.com")
|
86
|
-
.filter(function(val) {
|
87
|
-
return val.cookieString().split("=")[0] === "c_user";
|
88
|
-
});
|
158
|
+
/!-[ Function BuildAPI ]-!/
|
89
159
|
|
90
|
-
|
91
|
-
|
92
|
-
error:
|
93
|
-
"Error retrieving userID. This can be caused by a lot of things, including getting blocked by Facebook for logging in from an unknown location. Try logging in with a browser to verify.",
|
94
|
-
};
|
95
|
-
}
|
160
|
+
async function buildAPI(globalOptions, html, jar) {
|
161
|
+
var maybeCookie = jar.getCookies("https://www.facebook.com").filter(function(val) { return val.cookieString().split("=")[0] === "c_user"; });
|
96
162
|
|
97
|
-
if (
|
98
|
-
|
99
|
-
|
100
|
-
"Checkpoint detected. Please log in with a browser to verify."
|
101
|
-
);
|
102
|
-
}
|
163
|
+
if (maybeCookie.length === 0) throw { error: Language.ErrAppState };
|
164
|
+
|
165
|
+
if (html.indexOf("/checkpoint/block/?next") > -1) log.warn("login", Language.CheckPointLevelI);
|
103
166
|
|
104
|
-
var userID = maybeCookie[0]
|
105
|
-
|
106
|
-
.split("=")[1]
|
107
|
-
.toString();
|
108
|
-
//log.info("login", `Logged in as ${userID}`);
|
167
|
+
var userID = maybeCookie[0].cookieString().split("=")[1].toString();
|
168
|
+
process.env['UID'] = userID;
|
109
169
|
|
110
170
|
try {
|
111
171
|
clearInterval(checkVerified);
|
112
|
-
} catch (
|
172
|
+
} catch (e) {
|
173
|
+
console.log(e);
|
174
|
+
}
|
113
175
|
|
114
|
-
var clientID = (
|
176
|
+
var clientID = (Math.random() * 2147483648 | 0).toString(16);
|
115
177
|
|
116
|
-
let oldFBMQTTMatch = html.match(
|
117
|
-
/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/
|
118
|
-
);
|
178
|
+
let oldFBMQTTMatch = html.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/);
|
119
179
|
let mqttEndpoint = null;
|
120
180
|
let region = null;
|
121
181
|
let irisSeqID = null;
|
@@ -125,140 +185,58 @@ function buildAPI(globalOptions, html, jar) {
|
|
125
185
|
irisSeqID = oldFBMQTTMatch[1];
|
126
186
|
mqttEndpoint = oldFBMQTTMatch[2];
|
127
187
|
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
128
|
-
|
188
|
+
logger(getText.gettext(Language.Area, region), "[ FCA-SUS ]");
|
129
189
|
} else {
|
130
|
-
let newFBMQTTMatch = html.match(
|
131
|
-
/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/
|
132
|
-
);
|
190
|
+
let newFBMQTTMatch = html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/);
|
133
191
|
if (newFBMQTTMatch) {
|
134
192
|
irisSeqID = newFBMQTTMatch[2];
|
135
193
|
mqttEndpoint = newFBMQTTMatch[1].replace(/\\\//g, "/");
|
136
|
-
region = new URL(mqttEndpoint).searchParams
|
137
|
-
.get("region")
|
138
|
-
.toUpperCase();
|
139
|
-
// log.info("login", `Got this account's message region: ${region}`);
|
194
|
+
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
140
195
|
} else {
|
141
|
-
let legacyFBMQTTMatch = html.match(
|
142
|
-
/(\["MqttWebConfig",\[\],{fbid:")(.+?)(",appID:219994525426954,endpoint:")(.+?)(",pollingEndpoint:")(.+?)(3790])/
|
143
|
-
);
|
196
|
+
let legacyFBMQTTMatch = html.match(/(\["MqttWebConfig",\[\],{fbid:")(.+?)(",appID:219994525426954,endpoint:")(.+?)(",pollingEndpoint:")(.+?)(3790])/);
|
144
197
|
if (legacyFBMQTTMatch) {
|
145
198
|
mqttEndpoint = legacyFBMQTTMatch[4];
|
146
|
-
region = new URL(mqttEndpoint).searchParams
|
147
|
-
|
148
|
-
|
149
|
-
/* log.warn(
|
150
|
-
"login",
|
151
|
-
`Cannot get sequence ID with new RegExp. Fallback to old RegExp (without seqID)...`
|
152
|
-
);
|
153
|
-
log.info(
|
154
|
-
"login",
|
155
|
-
`Got this account's message region: ${region}`
|
156
|
-
);
|
157
|
-
log.info(
|
158
|
-
"login",
|
159
|
-
`[Unused] Polling endpoint: ${legacyFBMQTTMatch[6]}`
|
160
|
-
);*/
|
199
|
+
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
200
|
+
log.warn("login", `Cannot get sequence ID with new RegExp. Fallback to old RegExp (without seqID)...`);
|
201
|
+
logger("login", `[Unused] Polling endpoint: ${legacyFBMQTTMatch[6]}`);
|
161
202
|
} else {
|
162
|
-
|
203
|
+
log.warn("login", getText.gettext(Language.NoAreaData));
|
163
204
|
noMqttData = html;
|
164
205
|
}
|
165
206
|
}
|
166
207
|
}
|
167
208
|
|
168
|
-
// All data available to api functions
|
169
209
|
var ctx = {
|
170
210
|
userID: userID,
|
171
211
|
jar: jar,
|
172
212
|
clientID: clientID,
|
173
213
|
globalOptions: globalOptions,
|
174
214
|
loggedIn: true,
|
175
|
-
access_token:
|
215
|
+
access_token: 'none',
|
176
216
|
clientMutationId: 0,
|
177
217
|
mqttClient: undefined,
|
178
218
|
lastSeqId: irisSeqID,
|
179
219
|
syncToken: undefined,
|
180
220
|
mqttEndpoint,
|
181
221
|
region,
|
182
|
-
firstListen: true
|
222
|
+
firstListen: true
|
183
223
|
};
|
184
224
|
|
185
225
|
var api = {
|
186
226
|
setOptions: setOptions.bind(null, globalOptions),
|
187
227
|
getAppState: function getAppState() {
|
188
228
|
return utils.getAppState(jar);
|
189
|
-
}
|
229
|
+
}
|
190
230
|
};
|
191
231
|
|
192
|
-
if (noMqttData)
|
193
|
-
api["htmlData"] = noMqttData;
|
194
|
-
}
|
232
|
+
if (noMqttData) api["htmlData"] = noMqttData;
|
195
233
|
|
196
|
-
const apiFuncNames =
|
197
|
-
"addExternalModule",
|
198
|
-
"addUserToGroup",
|
199
|
-
"changeAdminStatus",
|
200
|
-
"changeApprovalMode",
|
201
|
-
"changeArchivedStatus",
|
202
|
-
"changeBio",
|
203
|
-
"changeBlockedStatus",
|
204
|
-
"changeGroupImage",
|
205
|
-
"changeNickname",
|
206
|
-
"changeThreadColor",
|
207
|
-
"changeThreadEmoji",
|
208
|
-
"createNewGroup",
|
209
|
-
"createPoll",
|
210
|
-
"deleteMessage",
|
211
|
-
"deleteThread",
|
212
|
-
"forwardAttachment",
|
213
|
-
"getCurrentUserID",
|
214
|
-
"getEmojiUrl",
|
215
|
-
"getFriendsList",
|
216
|
-
"getThreadHistory",
|
217
|
-
"getThreadInfo",
|
218
|
-
"getThreadList",
|
219
|
-
"getThreadPictures",
|
220
|
-
"getUserID",
|
221
|
-
"getUserInfo",
|
222
|
-
"handleMessageRequest",
|
223
|
-
"listenMqtt",
|
224
|
-
"logout",
|
225
|
-
"markAsDelivered",
|
226
|
-
"markAsRead",
|
227
|
-
"markAsReadAll",
|
228
|
-
"markAsSeen",
|
229
|
-
"muteThread",
|
230
|
-
"removeUserFromGroup",
|
231
|
-
"resolvePhotoUrl",
|
232
|
-
"searchForThread",
|
233
|
-
"chat",
|
234
|
-
"sendTypingIndicator",
|
235
|
-
"setMessageReaction",
|
236
|
-
"setTitle",
|
237
|
-
"threadColors",
|
238
|
-
"unsendMessage",
|
239
|
-
"unfriend",
|
240
|
-
|
241
|
-
// HTTP
|
242
|
-
"httpGet",
|
243
|
-
"httpPost",
|
244
|
-
|
245
|
-
// Deprecated features
|
246
|
-
"getThreadListDeprecated",
|
247
|
-
"getThreadHistoryDeprecated",
|
248
|
-
"getThreadInfoDeprecated",
|
249
|
-
];
|
234
|
+
const apiFuncNames = fs.readdirSync(__dirname + "/src").filter((File) => File.endsWith(".js") && !File.includes('Dev'));
|
250
235
|
|
251
236
|
var defaultFuncs = utils.makeDefaults(html, userID, ctx);
|
252
237
|
|
253
238
|
// Load all api functions in a loop
|
254
|
-
apiFuncNames.map(
|
255
|
-
api[v] = require("./leiamnash/" + v)(defaultFuncs, api, ctx);
|
256
|
-
});
|
257
|
-
|
258
|
-
//Removing original `listen` that uses pull.
|
259
|
-
//Map it to listenMqtt instead for backward compatibly.
|
260
|
-
api.listen = api.listenMqtt;
|
261
|
-
|
239
|
+
apiFuncNames.map(v => api[v.replace(".js", "")] = require('./src/' + v)(defaultFuncs, api, ctx));
|
262
240
|
return [ctx, defaultFuncs, api];
|
263
241
|
}
|
264
242
|
|
@@ -269,27 +247,24 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
269
247
|
var arr = [];
|
270
248
|
|
271
249
|
// This will be empty, but just to be sure we leave it
|
272
|
-
$("#login_form input").map(
|
273
|
-
arr.push({ val: $(v).val(), name: $(v).attr("name") });
|
274
|
-
});
|
250
|
+
$("#login_form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
|
275
251
|
|
276
252
|
arr = arr.filter(function(v) {
|
277
253
|
return v.val && v.val.length;
|
278
254
|
});
|
279
255
|
|
280
256
|
var form = utils.arrToForm(arr);
|
281
|
-
form.lsd = utils.getFrom(html,
|
282
|
-
form.lgndim = Buffer.from(
|
283
|
-
'{"w":1440,"h":900,"aw":1440,"ah":834,"c":24}'
|
284
|
-
).toString("base64");
|
257
|
+
form.lsd = utils.getFrom(html, "[\"LSD\",[],{\"token\":\"", "\"}");
|
258
|
+
form.lgndim = Buffer.from("{\"w\":1440,\"h\":900,\"aw\":1440,\"ah\":834,\"c\":24}").toString('base64');
|
285
259
|
form.email = email;
|
286
260
|
form.pass = password;
|
287
|
-
form.default_persistent =
|
288
|
-
form.lgnrnd = utils.getFrom(html,
|
289
|
-
form.locale =
|
290
|
-
form.timezone =
|
261
|
+
form.default_persistent = '0';
|
262
|
+
form.lgnrnd = utils.getFrom(html, "name=\"lgnrnd\" value=\"", "\"");
|
263
|
+
form.locale = 'en_US';
|
264
|
+
form.timezone = '240';
|
291
265
|
form.lgnjs = ~~(Date.now() / 1000);
|
292
266
|
|
267
|
+
|
293
268
|
// Getting cookies from the HTML page... (kill me now plz)
|
294
269
|
// we used to get a bunch of cookies in the headers of the response of the
|
295
270
|
// request, but FB changed and they now send those cookies inside the JS.
|
@@ -299,42 +274,23 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
299
274
|
// variable name.
|
300
275
|
//
|
301
276
|
// ---------- Very Hacky Part Starts -----------------
|
302
|
-
var willBeCookies = html.split(
|
277
|
+
var willBeCookies = html.split("\"_js_");
|
303
278
|
willBeCookies.slice(1).map(function(val) {
|
304
|
-
var cookieData = JSON.parse(
|
305
|
-
|
306
|
-
);
|
307
|
-
jar.setCookie(
|
308
|
-
utils.formatCookie(cookieData, "facebook"),
|
309
|
-
"https://www.facebook.com"
|
310
|
-
);
|
279
|
+
var cookieData = JSON.parse("[\"" + utils.getFrom(val, "", "]") + "]");
|
280
|
+
jar.setCookie(utils.formatCookie(cookieData, "facebook"), "https://www.facebook.com");
|
311
281
|
});
|
312
282
|
// ---------- Very Hacky Part Ends -----------------
|
313
283
|
|
314
|
-
// log.info("login", "Logging in...");
|
315
284
|
return utils
|
316
|
-
.post(
|
317
|
-
"https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110",
|
318
|
-
jar,
|
319
|
-
form,
|
320
|
-
loginOptions
|
321
|
-
)
|
285
|
+
.post("https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110", jar, form, loginOptions)
|
322
286
|
.then(utils.saveCookies(jar))
|
323
287
|
.then(function(res) {
|
324
288
|
var headers = res.headers;
|
325
|
-
if (!headers.location) {
|
326
|
-
throw { error: "Wrong username/password." };
|
327
|
-
}
|
289
|
+
if (!headers.location) throw { error: Language.InvaildAccount };
|
328
290
|
|
329
291
|
// This means the account has login approvals turned on.
|
330
|
-
if (
|
331
|
-
|
332
|
-
"https://www.facebook.com/checkpoint/"
|
333
|
-
) > -1
|
334
|
-
) {
|
335
|
-
log.info("login", "You have login approvals turned on.");
|
336
|
-
var nextURL =
|
337
|
-
"https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php";
|
292
|
+
if (headers.location.indexOf('https://www.facebook.com/checkpoint/') > -1) {
|
293
|
+
var nextURL = 'https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php';
|
338
294
|
|
339
295
|
return utils
|
340
296
|
.get(headers.location, jar, null, loginOptions)
|
@@ -344,12 +300,7 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
344
300
|
// Make the form in advance which will contain the fb_dtsg and nh
|
345
301
|
var $ = cheerio.load(html);
|
346
302
|
var arr = [];
|
347
|
-
$("form input").map(
|
348
|
-
arr.push({
|
349
|
-
val: $(v).val(),
|
350
|
-
name: $(v).attr("name"),
|
351
|
-
});
|
352
|
-
});
|
303
|
+
$("form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
|
353
304
|
|
354
305
|
arr = arr.filter(function(v) {
|
355
306
|
return v.val && v.val.length;
|
@@ -358,76 +309,36 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
358
309
|
var form = utils.arrToForm(arr);
|
359
310
|
if (html.indexOf("checkpoint/?next") > -1) {
|
360
311
|
setTimeout(() => {
|
361
|
-
checkVerified = setInterval(
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
})
|
367
|
-
.then(utils.saveCookies(jar))
|
368
|
-
.then(res => {
|
369
|
-
try {
|
370
|
-
JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*()/, ""));
|
371
|
-
} catch (ex) {
|
372
|
-
clearInterval(checkVerified);
|
373
|
-
log.info("login", "Verified from browser. Logging in...");
|
374
|
-
return loginHelper(utils.getAppState(jar), email, password, loginOptions, callback);
|
375
|
-
}
|
376
|
-
})
|
377
|
-
.catch(ex => {
|
378
|
-
log.error("login", ex);
|
379
|
-
}); */
|
380
|
-
},
|
381
|
-
5000,
|
382
|
-
{
|
383
|
-
fb_dtsg: form.fb_dtsg,
|
384
|
-
jazoest: form.jazoest,
|
385
|
-
dpr: 1,
|
386
|
-
}
|
387
|
-
);
|
312
|
+
checkVerified = setInterval((_form) => {}, 5000, {
|
313
|
+
fb_dtsg: form.fb_dtsg,
|
314
|
+
jazoest: form.jazoest,
|
315
|
+
dpr: 1
|
316
|
+
});
|
388
317
|
}, 2500);
|
389
318
|
throw {
|
390
|
-
error:
|
319
|
+
error: 'login-approval',
|
391
320
|
continue: function submit2FA(code) {
|
392
321
|
form.approvals_code = code;
|
393
|
-
form[
|
394
|
-
"#checkpointSubmitButton"
|
395
|
-
).html(); //'Continue';
|
322
|
+
form['submit[Continue]'] = $("#checkpointSubmitButton").html(); //'Continue';
|
396
323
|
var prResolve = null;
|
397
324
|
var prReject = null;
|
398
|
-
var rtPromise = new Promise(function(
|
399
|
-
resolve,
|
400
|
-
reject
|
401
|
-
) {
|
325
|
+
var rtPromise = new Promise(function(resolve, reject) {
|
402
326
|
prResolve = resolve;
|
403
327
|
prReject = reject;
|
404
328
|
});
|
405
329
|
if (typeof code == "string") {
|
406
330
|
utils
|
407
|
-
.post(
|
408
|
-
nextURL,
|
409
|
-
jar,
|
410
|
-
form,
|
411
|
-
loginOptions
|
412
|
-
)
|
331
|
+
.post(nextURL, jar, form, loginOptions)
|
413
332
|
.then(utils.saveCookies(jar))
|
414
333
|
.then(function(res) {
|
415
|
-
var $ = cheerio.load(
|
416
|
-
|
417
|
-
);
|
418
|
-
var error = $(
|
419
|
-
"#approvals_code"
|
420
|
-
)
|
421
|
-
.parent()
|
422
|
-
.attr("data-xui-error");
|
334
|
+
var $ = cheerio.load(res.body);
|
335
|
+
var error = $("#approvals_code").parent().attr("data-xui-error");
|
423
336
|
if (error) {
|
424
337
|
throw {
|
425
|
-
error:
|
426
|
-
|
427
|
-
errordesc:
|
428
|
-
"Invalid 2FA code.",
|
338
|
+
error: 'login-approval',
|
339
|
+
errordesc: Language.InvaildTwoAuthCode,
|
429
340
|
lerror: error,
|
430
|
-
continue: submit2FA
|
341
|
+
continue: submit2FA
|
431
342
|
};
|
432
343
|
}
|
433
344
|
})
|
@@ -435,287 +346,585 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
|
|
435
346
|
// Use the same form (safe I hope)
|
436
347
|
delete form.no_fido;
|
437
348
|
delete form.approvals_code;
|
438
|
-
form.name_action_selected =
|
439
|
-
|
440
|
-
|
441
|
-
return utils
|
442
|
-
.post(
|
443
|
-
nextURL,
|
444
|
-
jar,
|
445
|
-
form,
|
446
|
-
loginOptions
|
447
|
-
)
|
448
|
-
.then(
|
449
|
-
utils.saveCookies(
|
450
|
-
jar
|
451
|
-
)
|
452
|
-
);
|
349
|
+
form.name_action_selected = 'save_device'; //'save_device' || 'dont_save;
|
350
|
+
|
351
|
+
return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
|
453
352
|
})
|
454
353
|
.then(function(res) {
|
455
354
|
var headers = res.headers;
|
456
|
-
if (
|
457
|
-
!headers.location &&
|
458
|
-
res.body.indexOf(
|
459
|
-
"Review Recent Login"
|
460
|
-
) > -1
|
461
|
-
) {
|
462
|
-
throw {
|
463
|
-
error:
|
464
|
-
"Something went wrong with login approvals.",
|
465
|
-
};
|
466
|
-
}
|
355
|
+
if (!headers.location && res.body.indexOf('Review Recent Login') > -1) throw { error: Language.ApprovalsErr };
|
467
356
|
|
468
|
-
var appState = utils.getAppState(
|
469
|
-
|
470
|
-
)
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
) {
|
475
|
-
callback = function(
|
476
|
-
err,
|
477
|
-
api
|
478
|
-
) {
|
479
|
-
if (err) {
|
480
|
-
return prReject(
|
481
|
-
err
|
482
|
-
);
|
483
|
-
}
|
484
|
-
return prResolve(
|
485
|
-
api
|
486
|
-
);
|
357
|
+
var appState = utils.getAppState(jar);
|
358
|
+
|
359
|
+
if (callback === prCallback) {
|
360
|
+
callback = function(err, api) {
|
361
|
+
if (err) return prReject(err);
|
362
|
+
return prResolve(api);
|
487
363
|
};
|
488
364
|
}
|
489
365
|
|
490
366
|
// Simply call loginHelper because all it needs is the jar
|
491
367
|
// and will then complete the login process
|
492
|
-
return loginHelper(
|
493
|
-
appState,
|
494
|
-
email,
|
495
|
-
password,
|
496
|
-
loginOptions,
|
497
|
-
callback
|
498
|
-
);
|
368
|
+
return loginHelper(appState, email, password, loginOptions, callback);
|
499
369
|
})
|
500
370
|
.catch(function(err) {
|
501
371
|
// Check if using Promise instead of callback
|
502
|
-
if (
|
503
|
-
|
504
|
-
) {
|
505
|
-
prReject(err);
|
506
|
-
} else {
|
507
|
-
callback(err);
|
508
|
-
}
|
372
|
+
if (callback === prCallback) prReject(err);
|
373
|
+
else callback(err);
|
509
374
|
});
|
510
375
|
} else {
|
511
376
|
utils
|
512
|
-
.post(
|
513
|
-
"https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php",
|
514
|
-
jar,
|
515
|
-
form,
|
516
|
-
loginOptions,
|
517
|
-
null,
|
518
|
-
{
|
519
|
-
Referer:
|
520
|
-
"https://www.facebook.com/checkpoint/?next",
|
521
|
-
}
|
522
|
-
)
|
377
|
+
.post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php", jar, form, loginOptions, null, { "Referer": "https://www.facebook.com/checkpoint/?next" })
|
523
378
|
.then(utils.saveCookies(jar))
|
524
|
-
.then(
|
379
|
+
.then(res => {
|
525
380
|
try {
|
526
|
-
JSON.parse(
|
527
|
-
res.body.replace(
|
528
|
-
/for\s*\(\s*;\s*;\s*\)\s*;\s*/,
|
529
|
-
""
|
530
|
-
)
|
531
|
-
);
|
381
|
+
JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, ""));
|
532
382
|
} catch (ex) {
|
533
|
-
clearInterval(
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
"Verified from browser. Logging in..."
|
539
|
-
);*/
|
540
|
-
if (
|
541
|
-
callback ===
|
542
|
-
prCallback
|
543
|
-
) {
|
544
|
-
callback = function(
|
545
|
-
err,
|
546
|
-
api
|
547
|
-
) {
|
548
|
-
if (err) {
|
549
|
-
return prReject(
|
550
|
-
err
|
551
|
-
);
|
552
|
-
}
|
553
|
-
return prResolve(
|
554
|
-
api
|
555
|
-
);
|
383
|
+
clearInterval(checkVerified);
|
384
|
+
if (callback === prCallback) {
|
385
|
+
callback = function(err, api) {
|
386
|
+
if (err) return prReject(err);
|
387
|
+
return prResolve(api);
|
556
388
|
};
|
557
389
|
}
|
558
|
-
return loginHelper(
|
559
|
-
utils.getAppState(
|
560
|
-
jar
|
561
|
-
),
|
562
|
-
email,
|
563
|
-
password,
|
564
|
-
loginOptions,
|
565
|
-
callback
|
566
|
-
);
|
390
|
+
return loginHelper(utils.getAppState(jar), email, password, loginOptions, callback);
|
567
391
|
}
|
568
392
|
})
|
569
|
-
.catch(
|
393
|
+
.catch(ex => {
|
570
394
|
log.error("login", ex);
|
571
|
-
if (
|
572
|
-
|
573
|
-
) {
|
574
|
-
prReject(ex);
|
575
|
-
} else {
|
576
|
-
callback(ex);
|
577
|
-
}
|
395
|
+
if (callback === prCallback) prReject(ex);
|
396
|
+
else callback(ex);
|
578
397
|
});
|
579
398
|
}
|
580
399
|
return rtPromise;
|
581
|
-
}
|
400
|
+
}
|
582
401
|
};
|
583
402
|
} else {
|
584
|
-
if (!loginOptions.forceLogin) {
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
};
|
589
|
-
}
|
590
|
-
if (
|
591
|
-
html.indexOf("Suspicious Login Attempt") >
|
592
|
-
-1
|
593
|
-
) {
|
594
|
-
form["submit[This was me]"] = "This was me";
|
595
|
-
} else {
|
596
|
-
form["submit[This Is Okay]"] =
|
597
|
-
"This Is Okay";
|
598
|
-
}
|
403
|
+
if (!loginOptions.forceLogin) throw { error: Language.ForceLoginNotEnable };
|
404
|
+
|
405
|
+
if (html.indexOf("Suspicious Login Attempt") > -1) form['submit[This was me]'] = "This was me";
|
406
|
+
else form['submit[This Is Okay]'] = "This Is Okay";
|
599
407
|
|
600
408
|
return utils
|
601
409
|
.post(nextURL, jar, form, loginOptions)
|
602
410
|
.then(utils.saveCookies(jar))
|
603
411
|
.then(function() {
|
604
412
|
// Use the same form (safe I hope)
|
605
|
-
form.name_action_selected =
|
606
|
-
|
607
|
-
|
608
|
-
return utils
|
609
|
-
.post(
|
610
|
-
nextURL,
|
611
|
-
jar,
|
612
|
-
form,
|
613
|
-
loginOptions
|
614
|
-
)
|
615
|
-
.then(utils.saveCookies(jar));
|
413
|
+
form.name_action_selected = 'save_device';
|
414
|
+
|
415
|
+
return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
|
616
416
|
})
|
617
417
|
.then(function(res) {
|
618
418
|
var headers = res.headers;
|
619
419
|
|
620
|
-
if (
|
621
|
-
!headers.location &&
|
622
|
-
res.body.indexOf(
|
623
|
-
"Review Recent Login"
|
624
|
-
) > -1
|
625
|
-
) {
|
626
|
-
throw {
|
627
|
-
error:
|
628
|
-
"Something went wrong with review recent login.",
|
629
|
-
};
|
630
|
-
}
|
420
|
+
if (!headers.location && res.body.indexOf('Review Recent Login') > -1) throw { error: "Something went wrong with review recent login." };
|
631
421
|
|
632
422
|
var appState = utils.getAppState(jar);
|
633
423
|
|
634
424
|
// Simply call loginHelper because all it needs is the jar
|
635
425
|
// and will then complete the login process
|
636
|
-
return loginHelper(
|
637
|
-
appState,
|
638
|
-
email,
|
639
|
-
password,
|
640
|
-
loginOptions,
|
641
|
-
callback
|
642
|
-
);
|
426
|
+
return loginHelper(appState, email, password, loginOptions, callback);
|
643
427
|
})
|
644
|
-
.catch(
|
645
|
-
callback(e);
|
646
|
-
});
|
428
|
+
.catch(e => callback(e));
|
647
429
|
}
|
648
430
|
});
|
649
431
|
}
|
650
432
|
|
651
|
-
return utils
|
652
|
-
.get("https://www.facebook.com/", jar, null, loginOptions)
|
653
|
-
.then(utils.saveCookies(jar));
|
433
|
+
return utils.get('https://www.facebook.com/', jar, null, loginOptions).then(utils.saveCookies(jar));
|
654
434
|
});
|
655
435
|
};
|
656
436
|
}
|
657
437
|
|
438
|
+
function makeid(length) {
|
439
|
+
var result = '';
|
440
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
441
|
+
var charactersLength = characters.length;
|
442
|
+
for (var i = 0; i < length; i++) {
|
443
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
444
|
+
}
|
445
|
+
return result;
|
446
|
+
}
|
447
|
+
|
448
|
+
|
658
449
|
// Helps the login
|
659
|
-
function loginHelper(
|
660
|
-
appState,
|
661
|
-
email,
|
662
|
-
password,
|
663
|
-
globalOptions,
|
664
|
-
callback,
|
665
|
-
prCallback
|
666
|
-
) {
|
450
|
+
async function loginHelper(appState, email, password, globalOptions, callback, prCallback) {
|
667
451
|
var mainPromise = null;
|
668
452
|
var jar = utils.getJar();
|
669
453
|
|
670
454
|
// If we're given an appState we loop through it and save each cookie
|
671
455
|
// back into the jar.
|
672
|
-
|
673
|
-
appState
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
456
|
+
try {
|
457
|
+
if (appState) {
|
458
|
+
//const readline = require("readline");
|
459
|
+
//const chalk = require("chalk");
|
460
|
+
//const figlet = require("figlet");
|
461
|
+
//const os = require("os");
|
462
|
+
//const { execSync } = require('child_process');
|
463
|
+
// let rl = readline.createInterface({
|
464
|
+
// input: process.stdin,
|
465
|
+
// output: process.stdout,
|
466
|
+
// prompt: chalk.hex('#00CCCC').bold('[FCA-SUS] • ')
|
467
|
+
// });
|
468
|
+
// let type = {
|
469
|
+
// 1: {
|
470
|
+
// "name": "Tạo Mật Khẩu Cho Appstate",
|
471
|
+
// onRun: async function() {
|
472
|
+
// try {
|
473
|
+
// rl.question("Hãy Nhập Mật Khẩu Bạn Muốn Đặt Cho Appstate !", (answer) => {
|
474
|
+
// console.log("Được Rồi Mật Khẩu Của Bạn Là: " + answer + ", Bạn Hãy Nhớ Kĩ Nhé !");
|
475
|
+
// process.env["FBKEY"] = answer;
|
476
|
+
// fs.writeFile('../.env', `FBKEY=${answer}`, function (err) {
|
477
|
+
// if (err) {
|
478
|
+
// submiterr(err)
|
479
|
+
// logger("Tạo File ENV Thất Bại !", "[ FCA-SUS ]")
|
480
|
+
// rl.pause();
|
481
|
+
// }
|
482
|
+
// else logger("Tạo Thành Công File ENV !","[ FCA-SUS ]")
|
483
|
+
// rl.pause();
|
484
|
+
// });
|
485
|
+
// })
|
486
|
+
// }
|
487
|
+
// catch (e) {
|
488
|
+
// console.log(e);
|
489
|
+
// logger("Đã Có Lỗi Khi Đang Try Tạo Ra Câu Hỏi =))", "[ FCA-SUS ]");
|
490
|
+
// rl.pause();
|
491
|
+
// }
|
492
|
+
// }
|
493
|
+
// },
|
494
|
+
// 2: {
|
495
|
+
// "name": "Tiếp Tục Chạy Fca Mà Không Cần Mã Hóa AppState",
|
496
|
+
// onRun: async function () {
|
497
|
+
// rl.pause();
|
498
|
+
// }
|
499
|
+
// },
|
500
|
+
// 3: {
|
501
|
+
// "name": "Đổi Mật Khẩu AppState (Comming Soon..)",
|
502
|
+
// onRun: async function () {
|
503
|
+
// console.log(chalk.red.bold("Đã bảo là comming soon rồi mà >:v"));
|
504
|
+
// }
|
505
|
+
// }
|
506
|
+
// }
|
507
|
+
// const localbrand = JSON.parse(readFileSync('./package.json')).name;
|
508
|
+
// const localbrand2 = JSON.parse(readFileSync('./node_modules/fca-sus/package.json')).version;
|
509
|
+
// var axios = require('axios');
|
510
|
+
// axios.get('https://raw.githubusercontent.com/amogusdevlol/fca-sus/main/package.json').then(async (res) => {
|
511
|
+
// if (localbrand.toUpperCase() == 'HORIZON') {
|
512
|
+
// console.group(chalk.bold.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'))
|
513
|
+
// console.log(chalk.bold.hex('#00FFCC')("[</>]") + chalk.bold.yellow(' => ') + "Hệ Điều Hành: " + chalk.bold.red(os.type()));
|
514
|
+
// console.log(chalk.bold.hex('#00FFCC')("[</>]") + chalk.bold.yellow(' => ') + "Thông Tin Máy: " + chalk.bold.red(os.version()));
|
515
|
+
// console.log(chalk.bold.hex('#00FFCC')("[</>]") + chalk.bold.yellow(' => ') + "Phiên Bản Hiện Tại: " + chalk.bold.red(localbrand2));
|
516
|
+
// console.log(chalk.bold.hex('#00FFCC')("[</>]") + chalk.bold.yellow(' => ') + "Phiên Bản Mới Nhất: " + chalk.bold.red(res.data.version));
|
517
|
+
// console.groupEnd();
|
518
|
+
// }
|
519
|
+
// else {
|
520
|
+
// console.clear();
|
521
|
+
// console.log(figlet.textSync('TeamHorizon', {font: 'ANSI Shadow',horizontalLayout: 'default',verticalLayout: 'default',width: 0,whitespaceBreak: true }))
|
522
|
+
// console.log(chalk.hex('#9966CC')(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`));
|
523
|
+
// }
|
524
|
+
// });
|
687
525
|
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
526
|
+
var backup = async(data) => {
|
527
|
+
if (fs.existsSync('./alicestate.json')) {
|
528
|
+
try {
|
529
|
+
fs.writeFileSync('./alicestate.json', data);
|
530
|
+
} catch (e) {
|
531
|
+
fs.writeFileSync('./alicestate.json', JSON.stringify(data, null, "\t"));
|
532
|
+
}
|
533
|
+
await new Promise(resolve => setTimeout(resolve, 5 * 1000));
|
534
|
+
process.exit(1);
|
535
|
+
} else return logger.Error();
|
536
|
+
}
|
537
|
+
|
538
|
+
switch (process.platform) {
|
539
|
+
case "win32":
|
540
|
+
{
|
541
|
+
try {
|
542
|
+
var { body } = await Fetch('https://decrypt-appstate-production.up.railway.app/getKey');
|
543
|
+
process.env['FBKEY'] = JSON.parse(body).Data;
|
544
|
+
} catch (e) {
|
545
|
+
logger(Language.ErrGetPassWord);
|
546
|
+
logger.Error();
|
547
|
+
process.exit(1);
|
548
|
+
}
|
549
|
+
}
|
550
|
+
break;
|
551
|
+
case "linux":
|
552
|
+
{
|
553
|
+
if (process.env["REPL_ID"] == undefined) {
|
554
|
+
try {
|
555
|
+
var { body } = await Fetch.get('https://decrypt-appstate-production.up.railway.app/getKey');
|
556
|
+
process.env['FBKEY'] = JSON.parse(body).Data;
|
557
|
+
} catch (e) {
|
558
|
+
logger.Error();
|
559
|
+
process.exit(1);
|
560
|
+
}
|
561
|
+
} else {
|
562
|
+
/* try {
|
563
|
+
const client = new Client();
|
564
|
+
let key = await client.get("FBKEY");
|
565
|
+
if (!key) {
|
566
|
+
await client.set("FBKEY", makeid(49));
|
567
|
+
let key = await client.get("FBKEY");
|
568
|
+
process.env['FBKEY'] = key;
|
569
|
+
} else {
|
570
|
+
process.env['FBKEY'] = key;
|
571
|
+
}
|
572
|
+
} catch (e) {
|
573
|
+
logger(Language.ErrGenerateKey, '[ FCA-SUS ]');
|
574
|
+
logger(e, '[ FCA-SUS ]');
|
575
|
+
logger.Error();
|
576
|
+
process.exit(0)
|
577
|
+
}*/
|
578
|
+
}
|
579
|
+
}
|
580
|
+
break;
|
581
|
+
case "android":
|
582
|
+
{
|
583
|
+
try {
|
584
|
+
var { body } = await Fetch.get('https://decrypt-appstate-production.up.railway.app/getKey');
|
585
|
+
process.env['FBKEY'] = JSON.parse(body).Data;
|
586
|
+
} catch (e) {
|
587
|
+
|
588
|
+
return logger.Error();
|
589
|
+
}
|
590
|
+
}
|
591
|
+
break;
|
592
|
+
default:
|
593
|
+
{
|
594
|
+
|
595
|
+
logger.Error();
|
596
|
+
process.exit(0);
|
597
|
+
}
|
598
|
+
}
|
599
|
+
|
600
|
+
try {
|
601
|
+
switch (require("../../FastConfigFca.json").EncryptFeature) {
|
602
|
+
case true:
|
603
|
+
{
|
604
|
+
appState = JSON.parse(JSON.stringify(appState, null, "\t"));
|
605
|
+
switch (utils.getType(appState)) {
|
606
|
+
case "Array":
|
607
|
+
{
|
608
|
+
|
609
|
+
}
|
610
|
+
break;
|
611
|
+
case "String":
|
612
|
+
{
|
613
|
+
try {
|
614
|
+
appState = StateCrypt.decryptState(appState, process.env['FBKEY']);
|
615
|
+
logger(Language.DecryptSuccess, '[ FCA-SUS ]');
|
616
|
+
} catch (e) {
|
617
|
+
if (process.env.Backup != undefined && process.env.Backup) {
|
618
|
+
backup(process.env.Backup);
|
619
|
+
} else switch (process.platform) {
|
620
|
+
case "win32":
|
621
|
+
{
|
622
|
+
try {
|
623
|
+
if (fs.existsSync('./backupappstate.json')) {
|
624
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
625
|
+
return backup(content);
|
626
|
+
}
|
627
|
+
} catch (e) {
|
628
|
+
|
629
|
+
logger.Error();
|
630
|
+
process.exit(0);
|
631
|
+
}
|
632
|
+
}
|
633
|
+
break;
|
634
|
+
case "linux":
|
635
|
+
{
|
636
|
+
if (process.env["REPL_ID"] == undefined) {
|
637
|
+
try {
|
638
|
+
if (fs.existsSync('./backupappstate.json')) {
|
639
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
640
|
+
return backup(content);
|
641
|
+
}
|
642
|
+
} catch (e) {
|
643
|
+
//logger(Language.ErrBackup, '[ FCA-SUS ]');
|
644
|
+
logger.Error();
|
645
|
+
process.exit(0);
|
646
|
+
}
|
647
|
+
} else {
|
648
|
+
try {
|
649
|
+
const client = new Client();
|
650
|
+
let key = await client.get("Backup");
|
651
|
+
if (key) {
|
652
|
+
return backup(JSON.stringify(key));
|
653
|
+
} else {
|
654
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
655
|
+
}
|
656
|
+
} catch (e) {
|
657
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
658
|
+
}
|
659
|
+
}
|
660
|
+
}
|
661
|
+
break;
|
662
|
+
case "android":
|
663
|
+
{
|
664
|
+
try {
|
665
|
+
if (fs.existsSync('./backupappstate.json')) {
|
666
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
667
|
+
return backup(content);
|
668
|
+
}
|
669
|
+
} catch (e) {
|
670
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
671
|
+
logger.Error();
|
672
|
+
process.exit(0);
|
673
|
+
}
|
674
|
+
}
|
675
|
+
}
|
676
|
+
logger(Language.DecryptFailed, '[ FCA-SUS ]');
|
677
|
+
return logger.Error();
|
678
|
+
}
|
679
|
+
logger(getText.gettext(Language.YourAppStatePass, process.env.FBKEY), '[ FCA-SUS ]');
|
680
|
+
}
|
681
|
+
break;
|
682
|
+
default:
|
683
|
+
{
|
684
|
+
logger(Language.InvaildAppState, "[ FCA-SUS ]");
|
685
|
+
process.exit(0)
|
686
|
+
}
|
687
|
+
}
|
688
|
+
}
|
689
|
+
break;
|
690
|
+
case false:
|
691
|
+
{
|
692
|
+
switch (utils.getType(appState)) {
|
693
|
+
case "Array":
|
694
|
+
{
|
695
|
+
logger(Language.EncryptStateOff, "[ FCA-SUS ]");
|
696
|
+
}
|
697
|
+
break;
|
698
|
+
case "String":
|
699
|
+
{
|
700
|
+
logger(Language.EncryptStateOff, "[ FCA-SUS ]");
|
701
|
+
try {
|
702
|
+
appState = StateCrypt.decryptState(appState, process.env['FBKEY']);
|
703
|
+
logger(Language.DecryptSuccess, '[ FCA-SUS ]');
|
704
|
+
} catch (e) {
|
705
|
+
if (process.env.Backup != undefined && process.env.Backup) {
|
706
|
+
backup(process.env.Backup);
|
707
|
+
} else switch (process.platform) {
|
708
|
+
case "win32":
|
709
|
+
{
|
710
|
+
try {
|
711
|
+
if (fs.existsSync('./backupappstate.json')) {
|
712
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
713
|
+
return backup(content);
|
714
|
+
}
|
715
|
+
} catch (e) {
|
716
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
717
|
+
logger.Error();
|
718
|
+
process.exit(0);
|
719
|
+
}
|
720
|
+
}
|
721
|
+
break;
|
722
|
+
case "linux":
|
723
|
+
{
|
724
|
+
if (process.env["REPL_ID"] == undefined) {
|
725
|
+
try {
|
726
|
+
if (fs.existsSync('./backupappstate.json')) {
|
727
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
728
|
+
return backup(content);
|
729
|
+
}
|
730
|
+
} catch (e) {
|
731
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
732
|
+
logger.Error();
|
733
|
+
process.exit(0);
|
734
|
+
}
|
735
|
+
} else {
|
736
|
+
try {
|
737
|
+
const client = new Client();
|
738
|
+
let key = await client.get("Backup");
|
739
|
+
if (key) {
|
740
|
+
return backup(JSON.stringify(key));
|
741
|
+
} else {
|
742
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
743
|
+
}
|
744
|
+
} catch (e) {
|
745
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
746
|
+
}
|
747
|
+
}
|
748
|
+
}
|
749
|
+
break;
|
750
|
+
case "android":
|
751
|
+
{
|
752
|
+
try {
|
753
|
+
if (fs.existsSync('./backupappstate.json')) {
|
754
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
755
|
+
return backup(content);
|
756
|
+
}
|
757
|
+
} catch (e) {
|
758
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
759
|
+
logger.Error();
|
760
|
+
process.exit(0);
|
761
|
+
}
|
762
|
+
}
|
763
|
+
}
|
764
|
+
logger(Language.DecryptFailed, '[ FCA-SUS ]');
|
765
|
+
return logger.Error();
|
766
|
+
}
|
767
|
+
}
|
768
|
+
break;
|
769
|
+
default:
|
770
|
+
{
|
771
|
+
logger(Language.InvaildAppState, "[ FCA-SUS ]");
|
772
|
+
process.exit(0)
|
773
|
+
}
|
774
|
+
}
|
775
|
+
}
|
776
|
+
break;
|
777
|
+
default:
|
778
|
+
{
|
779
|
+
logger(getText.gettext(Language.IsNotABoolean, require("../../FastConfigFca.json").EncryptFeature), "[ FCA-SUS ]")
|
780
|
+
process.exit(0);
|
781
|
+
}
|
782
|
+
}
|
783
|
+
} catch (e) {
|
784
|
+
console.log(e);
|
785
|
+
}
|
786
|
+
|
787
|
+
try {
|
788
|
+
appState = JSON.parse(appState);
|
789
|
+
} catch (e) {
|
790
|
+
try {
|
791
|
+
appState = appState;
|
792
|
+
} catch (e) {
|
793
|
+
return logger.Error();
|
794
|
+
}
|
795
|
+
}
|
796
|
+
try {
|
797
|
+
appState.map(function(c) {
|
798
|
+
var str = c.key + "=" + c.value + "; expires=" + c.expires + "; domain=" + c.domain + "; path=" + c.path + ";";
|
799
|
+
jar.setCookie(str, "http://" + c.domain);
|
800
|
+
});
|
801
|
+
switch (process.platform) {
|
802
|
+
case "win32":
|
803
|
+
{
|
804
|
+
try {
|
805
|
+
fs.writeFileSync("./backupappstate.json", JSON.stringify(appState, null, "\t"));
|
806
|
+
process.env.Backup = JSON.stringify(appState, null, "\t");
|
807
|
+
} catch (e) {
|
808
|
+
logger(Language.BackupFailed, '[ FCA-SUS ]');
|
809
|
+
}
|
810
|
+
}
|
811
|
+
break;
|
812
|
+
case "linux":
|
813
|
+
{
|
814
|
+
if (process.env["REPL_ID"] == undefined) {
|
815
|
+
try {
|
816
|
+
fs.writeFileSync("./backupappstate.json", JSON.stringify(appState, null, "\t"));
|
817
|
+
process.env.Backup = JSON.stringify(appState, null, "\t");
|
818
|
+
} catch (e) {
|
819
|
+
logger(Language.BackupFailed, '[ FCA-SUS ]');
|
820
|
+
}
|
821
|
+
} else {
|
822
|
+
try {
|
823
|
+
if (fs.existsSync('./backupappstate.json')) {
|
824
|
+
fs.unlinkSync('./backupappstate.json');
|
825
|
+
}
|
826
|
+
const client = new Client();
|
827
|
+
await client.set("Backup", appState);
|
828
|
+
process.env.Backup = JSON.stringify(appState, null, "\t");
|
829
|
+
} catch (e) {
|
830
|
+
logger(Language.BackupFailed, '[ FCA-SUS ]');
|
831
|
+
}
|
832
|
+
}
|
833
|
+
}
|
834
|
+
break;
|
835
|
+
case "android":
|
836
|
+
{
|
837
|
+
try {
|
838
|
+
fs.writeFileSync("./backupappstate.json", JSON.stringify(appState, null, "\t"));
|
839
|
+
process.env.Backup = JSON.stringify(appState, null, "\t");
|
840
|
+
} catch (e) {
|
841
|
+
logger(Language.BackupFailed, '[ FCA-SUS ]');
|
842
|
+
}
|
843
|
+
}
|
844
|
+
}
|
845
|
+
|
846
|
+
mainPromise = utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
|
847
|
+
} catch (e) {
|
848
|
+
|
849
|
+
if (process.env.Backup != undefined && process.env.Backup) {
|
850
|
+
return backup(process.env.Backup);
|
851
|
+
}
|
852
|
+
switch (process.platform) {
|
853
|
+
case "win32":
|
854
|
+
{
|
855
|
+
try {
|
856
|
+
if (fs.existsSync('./backupappstate.json')) {
|
857
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
858
|
+
return backup(content);
|
859
|
+
}
|
860
|
+
} catch (e) {
|
861
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
862
|
+
logger.Error();
|
863
|
+
process.exit(0);
|
864
|
+
}
|
865
|
+
}
|
866
|
+
break;
|
867
|
+
case "linux":
|
868
|
+
{
|
869
|
+
if (process.env["REPL_ID"] == undefined) {
|
870
|
+
try {
|
871
|
+
if (fs.existsSync('./backupappstate.json')) {
|
872
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
873
|
+
return backup(content);
|
874
|
+
}
|
875
|
+
} catch (e) {
|
876
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
877
|
+
logger.Error();
|
878
|
+
process.exit(0);
|
879
|
+
}
|
880
|
+
} else {
|
881
|
+
try {
|
882
|
+
const client = new Client();
|
883
|
+
let key = await client.get("Backup");
|
884
|
+
if (key) {
|
885
|
+
backup(JSON.stringify(key));
|
886
|
+
} else {
|
887
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
888
|
+
}
|
889
|
+
} catch (e) {
|
890
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
891
|
+
}
|
892
|
+
}
|
893
|
+
}
|
894
|
+
break;
|
895
|
+
case "android":
|
896
|
+
{
|
897
|
+
try {
|
898
|
+
if (fs.existsSync('./backupappstate.json')) {
|
899
|
+
let content = fs.readFileSync('./backupappstate.json', 'utf8');
|
900
|
+
return backup(content);
|
901
|
+
}
|
902
|
+
} catch (e) {
|
903
|
+
logger(Language.ErrBackup, '[ FCA-SUS ]');
|
904
|
+
logger.Error();
|
905
|
+
process.exit(0);
|
906
|
+
}
|
907
|
+
}
|
908
|
+
break;
|
909
|
+
}
|
718
910
|
|
911
|
+
console.log(e);
|
912
|
+
return //logger(Language.ScreenShotConsoleAndSendToAdmin, '[ FCA-SUS ]');
|
913
|
+
}
|
914
|
+
} else {
|
915
|
+
// Open the main page, then we login with the given credentials and finally
|
916
|
+
// load the main page again (it'll give us some IDs that we need)
|
917
|
+
mainPromise = utils
|
918
|
+
.get("https://www.facebook.com/", null, null, globalOptions, { noRef: true })
|
919
|
+
.then(utils.saveCookies(jar))
|
920
|
+
.then(makeLogin(jar, email, password, globalOptions, callback, prCallback))
|
921
|
+
.then(function() {
|
922
|
+
return utils.get('https://www.facebook.com/', jar, null, globalOptions).then(utils.saveCookies(jar));
|
923
|
+
});
|
924
|
+
}
|
925
|
+
} catch (e) {
|
926
|
+
console.log(e);
|
927
|
+
}
|
719
928
|
var ctx = null;
|
720
929
|
var _defaultFuncs = null;
|
721
930
|
var api = null;
|
@@ -725,72 +934,88 @@ function loginHelper(
|
|
725
934
|
// Hacky check for the redirection that happens on some ISPs, which doesn't return statusCode 3xx
|
726
935
|
var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
|
727
936
|
var redirect = reg.exec(res.body);
|
728
|
-
if (redirect && redirect[1])
|
729
|
-
return utils
|
730
|
-
.get(redirect[1], jar, null, globalOptions)
|
731
|
-
.then(utils.saveCookies(jar));
|
732
|
-
}
|
937
|
+
if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
|
733
938
|
return res;
|
734
939
|
})
|
735
|
-
.then(function(res) {
|
940
|
+
.then(async function(res) {
|
736
941
|
var html = res.body;
|
737
|
-
var stuff = buildAPI(globalOptions, html, jar);
|
942
|
+
var stuff = await buildAPI(globalOptions, html, jar);
|
738
943
|
ctx = stuff[0];
|
739
944
|
_defaultFuncs = stuff[1];
|
740
945
|
api = stuff[2];
|
741
946
|
return res;
|
742
947
|
});
|
743
|
-
|
744
948
|
// given a pageID we log in as a page
|
745
949
|
if (globalOptions.pageID) {
|
746
950
|
mainPromise = mainPromise
|
747
951
|
.then(function() {
|
748
|
-
return utils.get(
|
749
|
-
"https://www.facebook.com/" +
|
750
|
-
ctx.globalOptions.pageID +
|
751
|
-
"/messages/?section=messages&subsection=inbox",
|
752
|
-
ctx.jar,
|
753
|
-
null,
|
754
|
-
globalOptions
|
755
|
-
);
|
952
|
+
return utils.get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
|
756
953
|
})
|
757
954
|
.then(function(resData) {
|
758
|
-
var url = utils
|
759
|
-
.getFrom(
|
760
|
-
resData.body,
|
761
|
-
'window.location.replace("https:\\/\\/www.facebook.com\\',
|
762
|
-
'");'
|
763
|
-
)
|
764
|
-
.split("\\")
|
765
|
-
.join("");
|
955
|
+
var url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
|
766
956
|
url = url.substring(0, url.length - 1);
|
767
|
-
|
768
|
-
return utils.get(
|
769
|
-
"https://www.facebook.com" + url,
|
770
|
-
ctx.jar,
|
771
|
-
null,
|
772
|
-
globalOptions
|
773
|
-
);
|
957
|
+
return utils.get('https://www.facebook.com' + url, ctx.jar, null, globalOptions);
|
774
958
|
});
|
775
959
|
}
|
776
960
|
|
777
961
|
// At the end we call the callback or catch an exception
|
778
962
|
mainPromise
|
779
963
|
.then(function() {
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
964
|
+
/*logger(Language.DoneLogin, "[ FCA-SUS ]");
|
965
|
+
logger(Language.AutoCheckUpdate, "[ FCA-SUS ]");*/
|
966
|
+
//!---------- Auto Check, Update START -----------------!//
|
967
|
+
var Fetch = require('got');
|
968
|
+
var { readFileSync } = require('fs-extra');
|
969
|
+
const { execSync } = require('child_process');
|
970
|
+
Fetch('https://raw.githubusercontent.com/amogusdevlol/node-ainzfb/main/package.json').then(async(res) => {
|
971
|
+
const localbrand = JSON.parse(readFileSync('./node_modules/node-ainzfb-new/package.json')).version;
|
972
|
+
if (Number(localbrand.replace(/\./g, "")) < Number(JSON.parse(res.body.toString()).version.replace(/\./g, ""))) {
|
973
|
+
// log.warn("[ FCA-SUS ] •", getText.gettext(Language.NewVersionFound, JSON.parse(readFileSync('./node_modules/node-ainzfb/package.json')).version, JSON.parse(res.body.toString()).version));
|
974
|
+
log.warn("[ FCA-SUS ] •", Language.AutoUpdate);
|
975
|
+
try {
|
976
|
+
execSync('npm install node-ainzfb-new@latest', { stdio: 'inherit' });
|
977
|
+
logger(Language.UpdateSuccess, "[ FCA-SUS ]")
|
978
|
+
logger(Language.RestartAfterUpdate, '[ FCA-SUS ]');
|
979
|
+
await new Promise(resolve => setTimeout(resolve, 5 * 1000));
|
980
|
+
console.clear();
|
981
|
+
process.exit(1);
|
982
|
+
} catch (err) {
|
983
|
+
log.warn('Error Update: ' + err);
|
984
|
+
logger(Language.UpdateFailed, "[ FCA-SUS ]");
|
985
|
+
try {
|
986
|
+
require.resolve('sus-support');
|
987
|
+
} catch (e) {
|
988
|
+
logger(Language.InstallSupportTool, "[ FCA-SUS ]");
|
989
|
+
execSync('npm install git+https://github.com/amogusdevlol/sus-support.git', { stdio: 'inherit' });
|
990
|
+
process.exit(1);
|
991
|
+
}
|
992
|
+
var fcasp = require('sus-support');
|
993
|
+
try {
|
994
|
+
fcasp.onError()
|
995
|
+
} catch (e) {
|
996
|
+
//logger(Language.NotiAfterUseToolFail, "[ Fca - Helper ]")
|
997
|
+
//logger("rmdir ./node_modules then enter npm i && npm start", "[ Fca - Helper ]");
|
998
|
+
process.exit(0);
|
999
|
+
}
|
1000
|
+
|
1001
|
+
}
|
1002
|
+
} else {
|
1003
|
+
/*logger(getText.gettext(Language.LocalVersion, localbrand), "[ FCA-SUS ]");
|
1004
|
+
logger(Language.WishMessage[Math.floor(Math.random() * Language.WishMessage.length)], "[ FCA-SUS ]");*/
|
1005
|
+
require('./Extra/ExtraUptimeRobot')()
|
1006
|
+
await new Promise(resolve => setTimeout(resolve, 5 * 1000));
|
1007
|
+
callback(null, api);
|
1008
|
+
}
|
1009
|
+
});
|
1010
|
+
}).catch(function(e) {
|
1011
|
+
log.error("login", e.error || e);
|
785
1012
|
callback(e);
|
786
1013
|
});
|
1014
|
+
//!---------- Auto Check, Update END -----------------!//
|
787
1015
|
}
|
788
1016
|
|
789
1017
|
function login(loginData, options, callback) {
|
790
|
-
if (
|
791
|
-
utils.getType(options) === "Function" ||
|
792
|
-
utils.getType(options) === "AsyncFunction"
|
793
|
-
) {
|
1018
|
+
if (utils.getType(options) === 'Function' || utils.getType(options) === 'AsyncFunction') {
|
794
1019
|
callback = options;
|
795
1020
|
options = {};
|
796
1021
|
}
|
@@ -801,23 +1026,22 @@ function login(loginData, options, callback) {
|
|
801
1026
|
listenTyping: false,
|
802
1027
|
updatePresence: false,
|
803
1028
|
forceLogin: false,
|
804
|
-
autoMarkDelivery:
|
1029
|
+
autoMarkDelivery: false,
|
805
1030
|
autoMarkRead: false,
|
806
1031
|
autoReconnect: true,
|
807
|
-
logRecordSize:
|
808
|
-
online:
|
1032
|
+
logRecordSize: 100,
|
1033
|
+
online: false,
|
809
1034
|
emitReady: false,
|
810
|
-
userAgent:
|
811
|
-
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3.18",
|
1035
|
+
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
|
812
1036
|
};
|
813
1037
|
|
814
|
-
|
1038
|
+
//! bằng 1 cách nào đó tắt online sẽ đánh lừa được facebook :v
|
1039
|
+
//! phải có that có this chứ :v
|
1040
|
+
|
1041
|
+
setOptions(globalOptions, options);
|
815
1042
|
|
816
1043
|
var prCallback = null;
|
817
|
-
if (
|
818
|
-
utils.getType(callback) !== "Function" &&
|
819
|
-
utils.getType(callback) !== "AsyncFunction"
|
820
|
-
) {
|
1044
|
+
if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
|
821
1045
|
var rejectFunc = null;
|
822
1046
|
var resolveFunc = null;
|
823
1047
|
var returnPromise = new Promise(function(resolve, reject) {
|
@@ -825,22 +1049,20 @@ function login(loginData, options, callback) {
|
|
825
1049
|
rejectFunc = reject;
|
826
1050
|
});
|
827
1051
|
prCallback = function(error, api) {
|
828
|
-
if (error)
|
829
|
-
return rejectFunc(error);
|
830
|
-
}
|
1052
|
+
if (error) return rejectFunc(error);
|
831
1053
|
return resolveFunc(api);
|
832
1054
|
};
|
833
1055
|
callback = prCallback;
|
834
1056
|
}
|
835
|
-
loginHelper(
|
836
|
-
loginData.appState,
|
837
|
-
loginData.email,
|
838
|
-
loginData.password,
|
839
|
-
globalOptions,
|
840
|
-
callback,
|
841
|
-
prCallback
|
842
|
-
);
|
1057
|
+
loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
|
843
1058
|
return returnPromise;
|
844
1059
|
}
|
845
1060
|
|
846
|
-
module.exports =
|
1061
|
+
module.exports = alice;
|
1062
|
+
|
1063
|
+
|
1064
|
+
|
1065
|
+
|
1066
|
+
|
1067
|
+
|
1068
|
+
|