fca-horidai-remastered 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Extra/Database/index.js +4 -4
- package/Extra/ExtraGetThread.js +22 -22
- package/Extra/Security/Base/index.js +5 -5
- package/Extra/Src/Release_Memory.js +5 -5
- package/Extra/Src/Websocket.js +3 -3
- package/Main.js +140 -104
- package/index.js +11 -11
- package/package.json +1 -1
- package/src/acpUsers.js +40 -0
- package/src/addFriends.js +37 -0
- package/src/changeAvatar.js +93 -0
- package/src/changeBlockedStatusMqtt.js +79 -0
- package/src/changeCover.js +73 -0
- package/src/changeName.js +79 -0
- package/src/createCommentPost.js +228 -0
- package/src/createPollMqtt.js +56 -0
- package/src/createPost.js +277 -0
- package/src/createPostGroup.js +79 -0
- package/src/forwardMessage.js +60 -0
- package/src/getAcceptList.js +38 -0
- package/src/getThreadInfoDeprecated.js +56 -0
- package/src/listenMqtt.js +1 -1
- package/src/pinMessage.js +58 -0
- package/src/refreshFb_dtsg.js +81 -0
- package/src/sendComment.js +161 -0
- package/src/setMessageReactionMqtt.js +62 -0
- package/src/setStoryReaction.js +53 -0
- package/src/setTheme.js +310 -0
- package/src/unsendMessageMqtt.js +59 -0
- package/src/uploadAttachment.js +95 -0
- package/test/Db2.js +4 -4
- package/test/Horizon_Database/Database.sqlite +0 -0
- package/test/Horizon_Database/SyntheticDatabase.sqlite +0 -0
- package/utils.js +34 -5
- package/.gitattributes +0 -2
- package/LICENSE +0 -21
- package/README.md +0 -152
- package/SECURITY.md +0 -18
package/Extra/Database/index.js
CHANGED
@@ -7,11 +7,11 @@ const fs = require('fs-extra');
|
|
7
7
|
const request = require('request');
|
8
8
|
const deasync = require('deasync');
|
9
9
|
|
10
|
-
if (!fs.existsSync(process.cwd() + '/
|
11
|
-
fs.mkdirSync(process.cwd() + '/
|
12
|
-
fs.writeFileSync(process.cwd() + '/
|
10
|
+
if (!fs.existsSync(process.cwd() + '/main/database_fca')) {
|
11
|
+
fs.mkdirSync(process.cwd() + '/main/database_fca');
|
12
|
+
fs.writeFileSync(process.cwd() + '/main/database_fca/A_README.md', 'This folder is used by ChernobyL(NANI =)) ) to store data. Do not delete this folder or any of the files in it.', 'utf8');
|
13
13
|
}
|
14
|
-
var db = new BetterDB(process.cwd() + "/
|
14
|
+
var db = new BetterDB(process.cwd() + "/main/database_fca/SyntheticDatabase.sqlite");
|
15
15
|
|
16
16
|
function Lset(key, value) {
|
17
17
|
if (!key)
|
package/Extra/ExtraGetThread.js
CHANGED
@@ -6,11 +6,11 @@ const logger = require("../logger");
|
|
6
6
|
const getText = global.Fca.getText;
|
7
7
|
var language = require("../Language/index.json");
|
8
8
|
const fs = require("fs");
|
9
|
-
language = language.find(i => i.Language == require(process.cwd() + "/
|
9
|
+
language = language.find(i => i.Language == require(process.cwd() + "/main/json/configfca.json").Language).Folder.ExtraGetThread;
|
10
10
|
const Always_True = [];
|
11
11
|
if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
12
|
-
if (!fs.existsSync(process.cwd() + "/
|
13
|
-
fs.writeFileSync(process.cwd() + "/
|
12
|
+
if (!fs.existsSync(process.cwd() + "/main/database_fca/Threads.json")) {
|
13
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify({}));
|
14
14
|
}
|
15
15
|
}
|
16
16
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type != "default" && global.Fca.Require.FastConfig.AntiGetInfo.Database_Type != "json") {
|
@@ -32,15 +32,15 @@ exports.createData = function(threadID,threadData) {
|
|
32
32
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
33
33
|
try {
|
34
34
|
try {
|
35
|
-
var data = require(process.cwd() + "/
|
35
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
36
36
|
}
|
37
37
|
catch (e) {
|
38
38
|
var data = {};
|
39
|
-
fs.writeFileSync(process.cwd() + "/
|
39
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data));
|
40
40
|
}
|
41
41
|
|
42
42
|
data[String(threadID)] = Object(threadData);
|
43
|
-
fs.writeFileSync(process.cwd() + "/
|
43
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data));
|
44
44
|
logger.Normal(getText(language.CreateDatabaseSuccess,String(threadID)));
|
45
45
|
}
|
46
46
|
catch (e) {
|
@@ -64,15 +64,15 @@ exports.updateData = function(threadID,threadData) {
|
|
64
64
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
65
65
|
try {
|
66
66
|
try {
|
67
|
-
var data = require(process.cwd() + "/
|
67
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
68
68
|
}
|
69
69
|
catch (e) {
|
70
70
|
var data = {};
|
71
|
-
fs.writeFileSync(process.cwd() + "/
|
71
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data));
|
72
72
|
}
|
73
73
|
|
74
74
|
data[String(threadID)] = Object(threadData);
|
75
|
-
fs.writeFileSync(process.cwd() + "/
|
75
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data));
|
76
76
|
logger.Normal(getText(language.updateDataSuccess,String(threadID)));
|
77
77
|
}
|
78
78
|
catch (e) {
|
@@ -94,15 +94,15 @@ exports.updateMessageCount = function(threadID,threadData) {
|
|
94
94
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
95
95
|
try {
|
96
96
|
try {
|
97
|
-
var data = require(process.cwd() + "/
|
97
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
98
98
|
}
|
99
99
|
catch (e) {
|
100
100
|
var data = {};
|
101
|
-
fs.writeFileSync(process.cwd() + "/
|
101
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data));
|
102
102
|
}
|
103
103
|
|
104
104
|
data[String(threadID)] = Object(threadData);
|
105
|
-
fs.writeFileSync(process.cwd() + "/
|
105
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data));
|
106
106
|
}
|
107
107
|
catch (e) {
|
108
108
|
console.log(e);
|
@@ -129,7 +129,7 @@ exports.getData = function(threadID) {
|
|
129
129
|
let Sw;
|
130
130
|
if (Always_True.includes(threadID)) Sw = true
|
131
131
|
else Sw = data.hasOwnProperty(String(threadID))
|
132
|
-
var data = require(process.cwd() + "/
|
132
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
133
133
|
switch (Sw) {
|
134
134
|
case true: {
|
135
135
|
return data[String(threadID)];
|
@@ -154,11 +154,11 @@ exports.deleteAll = function(data) {
|
|
154
154
|
}
|
155
155
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
156
156
|
try {
|
157
|
-
var data1 = require(process.cwd() + "/
|
157
|
+
var data1 = require(process.cwd() + "/main/database_fca/Threads.json");
|
158
158
|
for (let i of data) {
|
159
159
|
delete data1[String(i)];
|
160
160
|
}
|
161
|
-
fs.writeFileSync(process.cwd() + "/
|
161
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data1));
|
162
162
|
}
|
163
163
|
catch (e) {
|
164
164
|
console.log(e);
|
@@ -173,7 +173,7 @@ exports.getAll = function() {
|
|
173
173
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
174
174
|
try {
|
175
175
|
const Data_Res = []
|
176
|
-
var data = require(process.cwd() + "/
|
176
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
177
177
|
for (let i of Object.keys(data)) {
|
178
178
|
Data_Res.push({
|
179
179
|
ID: String(i),
|
@@ -202,7 +202,7 @@ exports.hasData = function(threadID) {
|
|
202
202
|
try {
|
203
203
|
if (Always_True.includes(threadID)) return true;
|
204
204
|
else {
|
205
|
-
var data = require(process.cwd() + "/
|
205
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
206
206
|
var has = data.hasOwnProperty(String(threadID));
|
207
207
|
if (has === true) Always_True.push(threadID);
|
208
208
|
return has
|
@@ -232,7 +232,7 @@ exports.alreadyUpdate = function(threadID) {
|
|
232
232
|
}
|
233
233
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
234
234
|
try {
|
235
|
-
var data = require(process.cwd() + "/
|
235
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
236
236
|
var Time = data[String(threadID)].TimeUpdate;
|
237
237
|
try {
|
238
238
|
if (global.Fca.startTime >= (Time + (3600 * 1000))) {
|
@@ -273,7 +273,7 @@ exports.readyCreate = function(Name) {
|
|
273
273
|
}
|
274
274
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
275
275
|
try {
|
276
|
-
var data = require(process.cwd() + "/
|
276
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
277
277
|
switch (data.hasOwnProperty(String(Name))) {
|
278
278
|
case true: {
|
279
279
|
if (Number(global.Fca.startTime) >= Number(data[String(Name)] + (120 * 1000))) {
|
@@ -301,9 +301,9 @@ exports.setLastRun = function(Name,LastRun) {
|
|
301
301
|
}
|
302
302
|
else if (global.Fca.Require.FastConfig.AntiGetInfo.Database_Type == "json") {
|
303
303
|
try {
|
304
|
-
var data = require(process.cwd() + "/
|
304
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
305
305
|
data[String(Name)] = String(lastRun(LastRun));
|
306
|
-
fs.writeFileSync(process.cwd() + "/
|
306
|
+
fs.writeFileSync(process.cwd() + "/main/database_fca/Threads.json",JSON.stringify(data));
|
307
307
|
}
|
308
308
|
catch (e) {
|
309
309
|
console.log(e);
|
@@ -339,7 +339,7 @@ exports.getLastRun = function(Name) {
|
|
339
339
|
let Sw;
|
340
340
|
if (Always_True.includes(Name)) Sw = true;
|
341
341
|
else Sw = data.hasOwnProperty(String(Name));
|
342
|
-
var data = require(process.cwd() + "/
|
342
|
+
var data = require(process.cwd() + "/main/database_fca/Threads.json");
|
343
343
|
switch (Sw) {
|
344
344
|
case true: {
|
345
345
|
return data[String(Name)];
|
@@ -9,20 +9,20 @@ const Already_Action = { First: 0, Encode: { Status: false, Data: Array }, Decod
|
|
9
9
|
|
10
10
|
var ArrPassWord;
|
11
11
|
|
12
|
-
if (!fs.existsSync(process.cwd() + '/
|
12
|
+
if (!fs.existsSync(process.cwd() + '/main/database_fca') || !fs.existsSync(process.cwd() + '/main/database_fca/RandPass.json')) {
|
13
13
|
const crypto = require('crypto');
|
14
14
|
ArrPassWord = Array.from({length: 101}, (_,i) => crypto.randomBytes(5).toString('hex'));
|
15
15
|
if (Database().has('Security')) {
|
16
16
|
Database().delete('Security');
|
17
17
|
}
|
18
|
-
if (!fs.existsSync(process.cwd() + '/
|
19
|
-
fs.mkdirSync(process.cwd() + '/
|
18
|
+
if (!fs.existsSync(process.cwd() + '/main/database_fca')) {
|
19
|
+
fs.mkdirSync(process.cwd() + '/main/database_fca');
|
20
20
|
}
|
21
|
-
fs.writeFileSync(process.cwd() + '/
|
21
|
+
fs.writeFileSync(process.cwd() + '/main/database_fca/RandPass.json', JSON.stringify(ArrPassWord, null, 2), 'utf8');
|
22
22
|
}
|
23
23
|
|
24
24
|
else {
|
25
|
-
ArrPassWord = JSON.stringify(fs.readFileSync(process.cwd() + '/
|
25
|
+
ArrPassWord = JSON.stringify(fs.readFileSync(process.cwd() + '/main/database_fca/RandPass.json'));
|
26
26
|
}
|
27
27
|
|
28
28
|
/**
|
@@ -73,19 +73,19 @@ class MemoryManager extends EventEmitter {
|
|
73
73
|
|
74
74
|
switch (this.logLevel) {
|
75
75
|
case 'debug':
|
76
|
-
console.debug(logMessage);
|
76
|
+
//console.debug(logMessage);
|
77
77
|
break;
|
78
78
|
case 'info':
|
79
|
-
global.Fca.Require.logger.Info(logMessage);
|
79
|
+
//global.Fca.Require.logger.Info(logMessage);
|
80
80
|
break;
|
81
81
|
case 'warn':
|
82
|
-
global.Fca.Require.logger.Normal(logMessage);
|
82
|
+
//global.Fca.Require.logger.Normal(logMessage);
|
83
83
|
break;
|
84
84
|
case 'error':
|
85
|
-
global.Fca.Require.logger.Error(logMessage);
|
85
|
+
//global.Fca.Require.logger.Error(logMessage);
|
86
86
|
break;
|
87
87
|
default:
|
88
|
-
global.Fca.Require.logger.Normal(logMessage);
|
88
|
+
//global.Fca.Require.logger.Normal(logMessage);
|
89
89
|
}
|
90
90
|
if (this.allowLog) {
|
91
91
|
fs.appendFile(this.logFile, `${logMessage}\n`, (err) => {
|
package/Extra/Src/Websocket.js
CHANGED
@@ -178,7 +178,7 @@ module.exports.connect = function(WebSocket) {
|
|
178
178
|
return Ws_Client.Websocket.send(JSON.stringify({ Status: "Pong" }));
|
179
179
|
}
|
180
180
|
case "FastConfig_Change": {
|
181
|
-
const FastConfig_Path = require(process.cwd() + "/
|
181
|
+
const FastConfig_Path = require(process.cwd() + "/main/json/configfca.json");
|
182
182
|
const FastConfig_Global = global.Fca.Require.FastConfig;
|
183
183
|
const SetConfig = function(Name, Value, Path, Main_Path) {
|
184
184
|
try {
|
@@ -190,11 +190,11 @@ module.exports.connect = function(WebSocket) {
|
|
190
190
|
FastConfig_Path[Name] = Value;
|
191
191
|
(HowTo[Name]).includes('(Restart required)') == false ? global.Fca.Require.FastConfig[Name] = Value : '';
|
192
192
|
}
|
193
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
193
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(FastConfig_Path, null, "\t"));
|
194
194
|
return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: `Success ${ (HowTo[Name]).includes('(Restart required)') == true ? 'RestartRequired' : ''}` }));
|
195
195
|
}
|
196
196
|
catch (e) {
|
197
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
197
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(FastConfig_Global, null, "\t"));
|
198
198
|
return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: e}));
|
199
199
|
}
|
200
200
|
};
|
package/Main.js
CHANGED
@@ -253,12 +253,15 @@ function setOptions(globalOptions, options) {
|
|
253
253
|
*/
|
254
254
|
|
255
255
|
function buildAPI(globalOptions, html, jar, bypass_region) {
|
256
|
+
//new feat
|
257
|
+
const fb_dtsg = utils.getFroms(html, '["DTSGInitData",[],{"token":"', '","')[0]; //nhăm nhăm nhăm nhăm
|
258
|
+
|
256
259
|
//check tiktik
|
257
260
|
var userID;
|
258
261
|
var cookie = jar.getCookies("https://www.facebook.com");
|
262
|
+
//.log(cookie)
|
259
263
|
var maybeUser = cookie.filter(function(val) { return val.cookieString().split("=")[0] === "c_user"; });
|
260
264
|
var maybeTiktik = cookie.filter(function(val) { return val.cookieString().split("=")[0] === "i_user"; });
|
261
|
-
|
262
265
|
if (maybeUser.length === 0 && maybeTiktik.length === 0) {
|
263
266
|
if (global.Fca.Require.FastConfig.AutoLogin) {
|
264
267
|
return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
|
@@ -290,18 +293,31 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
290
293
|
var CHECK_MQTT = {
|
291
294
|
oldFBMQTTMatch: html.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/),
|
292
295
|
newFBMQTTMatch: html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/),
|
293
|
-
legacyFBMQTTMatch: html.match(
|
296
|
+
legacyFBMQTTMatch: html.match(/\["MqttWebConfig",\[\],{"fbid":"(.*?)","appID":219994525426954,"endpoint":"(.*?)","pollingEndpoint":"(.*?)"/)
|
294
297
|
}
|
295
298
|
|
299
|
+
// tổng hợp danh sách region never die của Kanzu =))
|
300
|
+
/**
|
301
|
+
* PRN = Paris (France)
|
302
|
+
* VLL (Virginia Low Latency)
|
303
|
+
* ATN (Ashburn)
|
304
|
+
* SIN = Singapore
|
305
|
+
* HKG = Hong Kong
|
306
|
+
* TPE = Taipei (Taiwan)
|
307
|
+
* ICN = Seoul (South Korea)
|
308
|
+
* NRT = Tokyo (Japan)
|
309
|
+
* BOM = Mumbai (India)
|
310
|
+
* TPE = Taipei (Taiwan)
|
311
|
+
*/
|
312
|
+
|
296
313
|
let Slot = Object.keys(CHECK_MQTT);
|
297
|
-
|
298
314
|
var mqttEndpoint,region,irisSeqID;
|
299
315
|
Object.keys(CHECK_MQTT).map(function(MQTT) {
|
300
316
|
if (CHECK_MQTT[MQTT] && !region) {
|
301
317
|
switch (Slot.indexOf(MQTT)) {
|
302
318
|
case 0: {
|
303
319
|
irisSeqID = CHECK_MQTT[MQTT][1];
|
304
|
-
mqttEndpoint = CHECK_MQTT[MQTT][2];
|
320
|
+
mqttEndpoint = CHECK_MQTT[MQTT][2].replace(/\\\//g, "/");
|
305
321
|
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
306
322
|
return;
|
307
323
|
}
|
@@ -312,7 +328,7 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
312
328
|
return;
|
313
329
|
}
|
314
330
|
case 2: {
|
315
|
-
mqttEndpoint = CHECK_MQTT[MQTT][
|
331
|
+
mqttEndpoint = CHECK_MQTT[MQTT][2].replace(/\\\//g, "/"); //is important lmao f?
|
316
332
|
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
317
333
|
return;
|
318
334
|
}
|
@@ -320,6 +336,14 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
320
336
|
return;
|
321
337
|
}
|
322
338
|
});
|
339
|
+
|
340
|
+
if (!region) {
|
341
|
+
region = ['prn',"TPE","atn","hkg","sin"][Math.random()*5|0];
|
342
|
+
}
|
343
|
+
if (!mqttEndpoint) {
|
344
|
+
mqttEndpoint = "wss://edge-chat.facebook.com/chat?region=" + region;
|
345
|
+
}
|
346
|
+
|
323
347
|
var ctx = {
|
324
348
|
userID: userID,
|
325
349
|
jar: jar,
|
@@ -335,7 +359,8 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
335
359
|
region: region,
|
336
360
|
firstListen: true,
|
337
361
|
req_ID: 0,
|
338
|
-
callback_Task: {}
|
362
|
+
callback_Task: {},
|
363
|
+
fb_dtsg //i love u
|
339
364
|
};
|
340
365
|
|
341
366
|
var api = {
|
@@ -344,7 +369,6 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
344
369
|
return utils.getAppState(jar);
|
345
370
|
}
|
346
371
|
};
|
347
|
-
|
348
372
|
if (region && mqttEndpoint) {
|
349
373
|
//do sth
|
350
374
|
}
|
@@ -359,6 +383,9 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
359
383
|
}
|
360
384
|
|
361
385
|
var defaultFuncs = utils.makeDefaults(html, userID, ctx);
|
386
|
+
api.postFormData = function(url, body) {
|
387
|
+
return defaultFuncs.postFormData(url, ctx.jar, body);
|
388
|
+
};
|
362
389
|
|
363
390
|
fs.readdirSync(__dirname + "/src").filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => {
|
364
391
|
if (File == 'getThreadInfo.js' && global.Fca.Require.FastConfig.AntiGetInfo.AntiGetThreadInfo != true || File == 'getUserInfo.js' && global.Fca.Require.FastConfig.AntiGetInfo.AntiGetUserInfo != true) api[File.split('.').slice(0, -1).join('.')] = require('./src/' + (File.includes('getThreadInfo') ? 'getThreadMain.js' : 'getUserInfoMain.js'))(defaultFuncs, api, ctx)
|
@@ -955,97 +982,105 @@ try {
|
|
955
982
|
console.log(e);
|
956
983
|
}
|
957
984
|
|
958
|
-
function CheckAndFixErr(res) {
|
959
|
-
|
960
|
-
if (
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
985
|
+
function CheckAndFixErr(res, fastSwitch) {
|
986
|
+
|
987
|
+
if (fastSwitch) return res;
|
988
|
+
let reg_antierr = /7431627028261359627/gs; // =))))))
|
989
|
+
if (reg_antierr.test(res.body)) {
|
990
|
+
const Data = JSON.stringify(res.body);
|
991
|
+
const Dt_Check = Data.split('2Fhome.php&gfid=')[1];
|
992
|
+
if (Dt_Check == undefined) return res
|
993
|
+
const fid = Dt_Check.split("\\\\")[0];//fix sau
|
994
|
+
if (Dt_Check == undefined || Dt_Check == "") return res
|
995
|
+
const final_fid = fid.split(`\\`)[0];
|
996
|
+
if (final_fid == undefined || final_fid == '') return res;
|
997
|
+
const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
|
998
|
+
bypass_region_err = true;
|
999
|
+
return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
|
1000
|
+
}
|
1001
|
+
else return res
|
1002
|
+
}
|
1003
|
+
|
1004
|
+
function Redirect(res,fastSwitch) {
|
1005
|
+
if (fastSwitch) return res;
|
1006
|
+
var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
|
1007
|
+
redirect = reg.exec(res.body);
|
1008
|
+
if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions)
|
1009
|
+
return res;
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
let redirect = [1, "https://m.facebook.com/"];
|
1013
|
+
let bypass_region_err = false;
|
1014
|
+
var ctx,api;
|
1015
|
+
mainPromise = mainPromise
|
1016
|
+
.then(res => Redirect(res))
|
1017
|
+
.then(res => CheckAndFixErr(res))
|
1018
|
+
//fix via login with defaut UA return WWW.facebook.com not m.facebook.com
|
1019
|
+
|
1020
|
+
.then(function(res) {
|
1021
|
+
if (global.OnAutoLoginProcess) return res;
|
1022
|
+
else {
|
1023
|
+
let Regex_Via = /MPageLoadClientMetrics/gs; //default for normal account, can easily get region, without this u can't get region in some case but u can run normal
|
1024
|
+
if (!Regex_Via.test(res.body)) {
|
1025
|
+
//www.facebook.com
|
1026
|
+
globalOptions.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.2849.68";
|
1027
|
+
return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true })
|
1028
|
+
}
|
1029
|
+
else return res
|
1030
|
+
}
|
1031
|
+
})
|
1032
|
+
.then(res => Redirect(res, global.OnAutoLoginProcess))
|
1033
|
+
.then(res => CheckAndFixErr(res, global.OnAutoLoginProcess))
|
1034
|
+
// .then(res => {
|
1035
|
+
// return utils.get('https://www.facebook.com/', jar, null, globalOptions, {}).then(utils.saveCookies(jar));
|
1036
|
+
// })
|
1037
|
+
// .then(function(res) {
|
1038
|
+
// let reg_old_web = /Switch Default Site/gs;
|
1039
|
+
// if (reg_old_web.test(res.body)) {
|
1040
|
+
// let Data_Resp = JSON.stringify(res.body);
|
1041
|
+
// const link = Data_Resp.split('settings/site')[1].split("\"")[0].replace('\\', '')
|
1042
|
+
// const redirect_link2 = redirect[1] + "settings/site" + utils.cleanHTML(link)
|
1043
|
+
// console.log(redirect_link2)
|
1044
|
+
// return utils.get("https://www.facebook.com/", jar, null, globalOptions).then(utils.saveCookies(jar)); // try ag
|
1045
|
+
// }
|
1046
|
+
// else return res;
|
1047
|
+
// })
|
1048
|
+
// .then(function(res) {
|
1049
|
+
// var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
|
1050
|
+
// redirect = reg.exec(res.body);
|
1051
|
+
// if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
|
1052
|
+
// return res;
|
1053
|
+
// })
|
1054
|
+
.then(function(res){
|
1055
|
+
var html = res.body,Obj = buildAPI(globalOptions, html, jar,bypass_region_err);
|
1056
|
+
ctx = Obj.ctx;
|
1057
|
+
api = Obj.api;
|
1058
|
+
return res;
|
1059
|
+
});
|
1060
|
+
if (globalOptions.pageID) {
|
1061
|
+
mainPromise = mainPromise
|
1062
|
+
.then(function() {
|
1063
|
+
return utils.get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
|
1064
|
+
})
|
1065
|
+
.then(function(resData) {
|
1066
|
+
var url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
|
1067
|
+
url = url.substring(0, url.length - 1);
|
1068
|
+
return utils.get('https://www.facebook.com' + url, ctx.jar, null, globalOptions);
|
1069
|
+
});
|
1070
|
+
}
|
1071
|
+
mainPromise
|
1072
|
+
.then(async() => {
|
1073
|
+
logger.Normal(getText(Language.LocalVersion,global.Fca.Version));
|
1074
|
+
logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
|
1075
|
+
logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
|
1076
|
+
require('./Extra/ExtraUptimeRobot')();
|
1077
|
+
callback(null, api);
|
1078
|
+
}).catch(function(/** @type {{ error: any; }} */e) {
|
1079
|
+
log.error("login", e.error || e);
|
1080
|
+
callback(e);
|
1081
|
+
});
|
1082
|
+
}
|
1083
|
+
|
1049
1084
|
/**
|
1050
1085
|
* It asks the user for their account and password, and then saves it to the database.
|
1051
1086
|
*/
|
@@ -1077,7 +1112,7 @@ function setUserNameAndPassWord() {
|
|
1077
1112
|
}
|
1078
1113
|
if (global.Fca.Require.FastConfig.ResetDataLogin) {
|
1079
1114
|
global.Fca.Require.FastConfig.ResetDataLogin = false;
|
1080
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + '/
|
1115
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + '/main/json/configfca.json', JSON.stringify(global.Fca.Require.FastConfig, null, 4));
|
1081
1116
|
}
|
1082
1117
|
logger.Success(Language.SuccessSetData);
|
1083
1118
|
process.exit(1);
|
@@ -1139,9 +1174,10 @@ function login(loginData, options, callback) {
|
|
1139
1174
|
});
|
1140
1175
|
loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
|
1141
1176
|
}
|
1142
|
-
|
1177
|
+
else if (loginData.appState) {
|
1143
1178
|
setOptions(globalOptions, options);
|
1144
|
-
let All = (getAll()).filter(i => i.data
|
1179
|
+
let All = (getAll()).filter(i => i.data !== null);
|
1180
|
+
All = All.filter(i => i.data.messageCount !== undefined)
|
1145
1181
|
if (All.length >= 1) {
|
1146
1182
|
deleteAll(All.map(obj => obj.data.threadID));
|
1147
1183
|
}
|
@@ -1176,7 +1212,7 @@ function login(loginData, options, callback) {
|
|
1176
1212
|
if (!UserName || !PassWord) {
|
1177
1213
|
logger.Warning("Dangerous action detected! Proceeding to automatically disable websocket_extension.");
|
1178
1214
|
global.Fca.Require.FastConfig.Websocket_Extension.Status = false;
|
1179
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
1215
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
|
1180
1216
|
}
|
1181
1217
|
else {
|
1182
1218
|
try {
|
@@ -1189,7 +1225,7 @@ function login(loginData, options, callback) {
|
|
1189
1225
|
Database().set('Ws_2Fa', secret.base32);
|
1190
1226
|
if (global.Fca.Require.FastConfig.Websocket_Extension.ResetData) {
|
1191
1227
|
global.Fca.Require.FastConfig.Websocket_Extension.ResetData = false;
|
1192
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + '/
|
1228
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + '/main/json/configfca.json', JSON.stringify(global.Fca.Require.FastConfig, null, 4));
|
1193
1229
|
}
|
1194
1230
|
question("Enter To Continue!");
|
1195
1231
|
const ask = function() {
|
@@ -1213,7 +1249,7 @@ function login(loginData, options, callback) {
|
|
1213
1249
|
console.log(e)
|
1214
1250
|
logger.Warning("Error, auto turn off Websocket_extension");
|
1215
1251
|
global.Fca.Require.FastConfig.Websocket_Extension.Status = false;
|
1216
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
1252
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
|
1217
1253
|
process.exit(1);
|
1218
1254
|
}
|
1219
1255
|
}
|