fca-horidai-remastered 1.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CountTime.json +1 -0
- package/Extra/Balancer.js +49 -0
- 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/Language/index.json +10 -4
- package/Main.js +209 -29
- package/index.js +11 -11
- package/package.json +7 -7
- 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 +38 -18
- 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/unsendMessage.js +28 -20
- package/src/unsendMessageMqtt.js +59 -0
- package/src/unsendMqttMessage.js +66 -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 +45 -6
- package/.gitattributes +0 -2
- package/LICENSE +0 -21
- package/README.md +0 -152
- package/SECURITY.md +0 -18
package/Main.js
CHANGED
@@ -244,6 +244,89 @@ function setOptions(globalOptions, options) {
|
|
244
244
|
});
|
245
245
|
}
|
246
246
|
|
247
|
+
function BypassAutomationNotification(resp, jar, globalOptions, appstate,ID) {
|
248
|
+
global.Fca.BypassAutomationNotification = BypassAutomationNotification
|
249
|
+
try {
|
250
|
+
let UID;
|
251
|
+
if (ID) UID = ID
|
252
|
+
else {
|
253
|
+
UID = (appstate.find(i => i.key == 'c_user') || appstate.find(i => i.key == 'i_user'))
|
254
|
+
UID = UID.value;
|
255
|
+
}
|
256
|
+
if (resp !== undefined) {
|
257
|
+
if (resp.request.uri && resp.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
|
258
|
+
if (resp.request.uri.href.includes('601051028565049')) {
|
259
|
+
const fb_dtsg = utils.getFrom(resp.body, '["DTSGInitData",[],{"token":"', '","');
|
260
|
+
const jazoest = utils.getFrom(resp.body, 'jazoest=', '",');
|
261
|
+
const lsd = utils.getFrom(resp.body, "[\"LSD\",[],{\"token\":\"", "\"}");
|
262
|
+
|
263
|
+
const FormBypass = {
|
264
|
+
av: UID,
|
265
|
+
fb_dtsg, jazoest, lsd,
|
266
|
+
fb_api_caller_class: "RelayModern",
|
267
|
+
fb_api_req_friendly_name: "FBScrapingWarningMutation",
|
268
|
+
variables: JSON.stringify({}),
|
269
|
+
server_timestamps: true,
|
270
|
+
doc_id: 6339492849481770
|
271
|
+
}
|
272
|
+
return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions)
|
273
|
+
.then(utils.saveCookies(jar)).then(function(res) {
|
274
|
+
global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
|
275
|
+
return process.exit(1);
|
276
|
+
});
|
277
|
+
}
|
278
|
+
else {
|
279
|
+
return resp;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
else {
|
283
|
+
return resp
|
284
|
+
}
|
285
|
+
}
|
286
|
+
else {
|
287
|
+
return utils.get('https://www.facebook.com/', jar, null, globalOptions).then(function(res) {
|
288
|
+
if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
|
289
|
+
if (res.request.uri.href.includes('601051028565049')) return { Status: true, Body: res.body }
|
290
|
+
else return { Status: false, Body: res.body }
|
291
|
+
}
|
292
|
+
else return { Status: false, Body: res.body }
|
293
|
+
}).then(function(res) {
|
294
|
+
if (res.Status === true) {
|
295
|
+
const fb_dtsg = utils.getFrom(res.Body, '["DTSGInitData",[],{"token":"', '","');
|
296
|
+
const jazoest = utils.getFrom(res.Body, 'jazoest=', '",');
|
297
|
+
const lsd = utils.getFrom(res.Body, "[\"LSD\",[],{\"token\":\"", "\"}");
|
298
|
+
|
299
|
+
const FormBypass = {
|
300
|
+
av: UID,
|
301
|
+
fb_dtsg, jazoest, lsd,
|
302
|
+
fb_api_caller_class: "RelayModern",
|
303
|
+
fb_api_req_friendly_name: "FBScrapingWarningMutation",
|
304
|
+
variables: JSON.stringify({}),
|
305
|
+
server_timestamps: true,
|
306
|
+
doc_id: 6339492849481770
|
307
|
+
}
|
308
|
+
return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions).then(utils.saveCookies(jar))
|
309
|
+
.then(res => {
|
310
|
+
global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
|
311
|
+
return res
|
312
|
+
})
|
313
|
+
}
|
314
|
+
else return res;
|
315
|
+
|
316
|
+
})
|
317
|
+
.then(function(res) {
|
318
|
+
return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar))
|
319
|
+
})
|
320
|
+
.then(function(res) {
|
321
|
+
return process.exit(1)
|
322
|
+
})
|
323
|
+
}
|
324
|
+
}
|
325
|
+
catch (e) {
|
326
|
+
console.log(e)
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
247
330
|
//-[ Function BuildAPI ]-!/
|
248
331
|
|
249
332
|
/**
|
@@ -253,12 +336,15 @@ function setOptions(globalOptions, options) {
|
|
253
336
|
*/
|
254
337
|
|
255
338
|
function buildAPI(globalOptions, html, jar, bypass_region) {
|
339
|
+
//new feat
|
340
|
+
const fb_dtsg = utils.getFroms(html, '["DTSGInitData",[],{"token":"', '","')[0]; //nhăm nhăm nhăm nhăm
|
341
|
+
|
256
342
|
//check tiktik
|
257
343
|
var userID;
|
258
344
|
var cookie = jar.getCookies("https://www.facebook.com");
|
345
|
+
//.log(cookie)
|
259
346
|
var maybeUser = cookie.filter(function(val) { return val.cookieString().split("=")[0] === "c_user"; });
|
260
347
|
var maybeTiktik = cookie.filter(function(val) { return val.cookieString().split("=")[0] === "i_user"; });
|
261
|
-
|
262
348
|
if (maybeUser.length === 0 && maybeTiktik.length === 0) {
|
263
349
|
if (global.Fca.Require.FastConfig.AutoLogin) {
|
264
350
|
return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
|
@@ -290,18 +376,31 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
290
376
|
var CHECK_MQTT = {
|
291
377
|
oldFBMQTTMatch: html.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/),
|
292
378
|
newFBMQTTMatch: html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/),
|
293
|
-
legacyFBMQTTMatch: html.match(
|
379
|
+
legacyFBMQTTMatch: html.match(/\["MqttWebConfig",\[\],{"fbid":"(.*?)","appID":219994525426954,"endpoint":"(.*?)","pollingEndpoint":"(.*?)"/)
|
294
380
|
}
|
295
381
|
|
382
|
+
// tổng hợp danh sách region never die của Kanzu =))
|
383
|
+
/**
|
384
|
+
* PRN = Pacific Northwest Region (Khu vực Tây Bắc Thái Bình Dương)
|
385
|
+
* VLL = Valley Region
|
386
|
+
* ASH = Ashburn Region
|
387
|
+
* DFW = Dallas/Fort Worth Region
|
388
|
+
* LLA = Los Angeles Region
|
389
|
+
* FRA = Frankfurt
|
390
|
+
* SIN = Singapore
|
391
|
+
* NRT = Tokyo (Japan)
|
392
|
+
* HKG = Hong Kong
|
393
|
+
* SYD = Sydney
|
394
|
+
*/
|
395
|
+
|
296
396
|
let Slot = Object.keys(CHECK_MQTT);
|
297
|
-
|
298
397
|
var mqttEndpoint,region,irisSeqID;
|
299
398
|
Object.keys(CHECK_MQTT).map(function(MQTT) {
|
300
399
|
if (CHECK_MQTT[MQTT] && !region) {
|
301
400
|
switch (Slot.indexOf(MQTT)) {
|
302
401
|
case 0: {
|
303
402
|
irisSeqID = CHECK_MQTT[MQTT][1];
|
304
|
-
mqttEndpoint = CHECK_MQTT[MQTT][2];
|
403
|
+
mqttEndpoint = CHECK_MQTT[MQTT][2].replace(/\\\//g, "/");
|
305
404
|
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
306
405
|
return;
|
307
406
|
}
|
@@ -312,7 +411,7 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
312
411
|
return;
|
313
412
|
}
|
314
413
|
case 2: {
|
315
|
-
mqttEndpoint = CHECK_MQTT[MQTT][
|
414
|
+
mqttEndpoint = CHECK_MQTT[MQTT][2].replace(/\\\//g, "/"); //is important lmao f?
|
316
415
|
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
317
416
|
return;
|
318
417
|
}
|
@@ -320,6 +419,76 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
320
419
|
return;
|
321
420
|
}
|
322
421
|
});
|
422
|
+
|
423
|
+
const regions = [
|
424
|
+
{
|
425
|
+
code: "PRN",
|
426
|
+
name: "Pacific Northwest Region",
|
427
|
+
location: "Khu vực Tây Bắc Thái Bình Dương"
|
428
|
+
},
|
429
|
+
{
|
430
|
+
code: "VLL",
|
431
|
+
name: "Valley Region",
|
432
|
+
location: "Valley"
|
433
|
+
},
|
434
|
+
{
|
435
|
+
code: "ASH",
|
436
|
+
name: "Ashburn Region",
|
437
|
+
location: "Ashburn"
|
438
|
+
},
|
439
|
+
{
|
440
|
+
code: "DFW",
|
441
|
+
name: "Dallas/Fort Worth Region",
|
442
|
+
location: "Dallas/Fort Worth"
|
443
|
+
},
|
444
|
+
{
|
445
|
+
code: "LLA",
|
446
|
+
name: "Los Angeles Region",
|
447
|
+
location: "Los Angeles"
|
448
|
+
},
|
449
|
+
{
|
450
|
+
code: "FRA",
|
451
|
+
name: "Frankfurt",
|
452
|
+
location: "Frankfurt"
|
453
|
+
},
|
454
|
+
{
|
455
|
+
code: "SIN",
|
456
|
+
name: "Singapore",
|
457
|
+
location: "Singapore"
|
458
|
+
},
|
459
|
+
{
|
460
|
+
code: "NRT",
|
461
|
+
name: "Tokyo",
|
462
|
+
location: "Japan"
|
463
|
+
},
|
464
|
+
{
|
465
|
+
code: "HKG",
|
466
|
+
name: "Hong Kong",
|
467
|
+
location: "Hong Kong"
|
468
|
+
},
|
469
|
+
{
|
470
|
+
code: "SYD",
|
471
|
+
name: "Sydney",
|
472
|
+
location: "Sydney"
|
473
|
+
},
|
474
|
+
{
|
475
|
+
code: "PNB",
|
476
|
+
name: "Pacific Northwest - Beta",
|
477
|
+
location: "Pacific Northwest "
|
478
|
+
}
|
479
|
+
];
|
480
|
+
|
481
|
+
if (!region) {
|
482
|
+
region = ['prn',"pnb","vll","hkg","sin"][Math.random()*5|0];
|
483
|
+
|
484
|
+
}
|
485
|
+
if (!mqttEndpoint) {
|
486
|
+
mqttEndpoint = "wss://edge-chat.facebook.com/chat?region=" + region;
|
487
|
+
}
|
488
|
+
|
489
|
+
const Location = regions.find(r => r.code === region.toUpperCase());
|
490
|
+
logger.Normal(getText(Language.Area,(Location == undefined ? region.toUpperCase() : Location.name)));
|
491
|
+
|
323
492
|
var ctx = {
|
324
493
|
userID: userID,
|
325
494
|
jar: jar,
|
@@ -335,7 +504,8 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
335
504
|
region: region,
|
336
505
|
firstListen: true,
|
337
506
|
req_ID: 0,
|
338
|
-
callback_Task: {}
|
507
|
+
callback_Task: {},
|
508
|
+
fb_dtsg //i love u
|
339
509
|
};
|
340
510
|
|
341
511
|
var api = {
|
@@ -344,7 +514,6 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
344
514
|
return utils.getAppState(jar);
|
345
515
|
}
|
346
516
|
};
|
347
|
-
|
348
517
|
if (region && mqttEndpoint) {
|
349
518
|
//do sth
|
350
519
|
}
|
@@ -359,7 +528,9 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
|
|
359
528
|
}
|
360
529
|
|
361
530
|
var defaultFuncs = utils.makeDefaults(html, userID, ctx);
|
362
|
-
|
531
|
+
api.postFormData = function(url, body) {
|
532
|
+
return defaultFuncs.postFormData(url, ctx.jar, body);
|
533
|
+
};
|
363
534
|
fs.readdirSync(__dirname + "/src").filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => {
|
364
535
|
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)
|
365
536
|
else api[File.split('.').slice(0, -1).join('.')] = require('./src/' + File)(defaultFuncs, api, ctx)
|
@@ -944,7 +1115,7 @@ try {
|
|
944
1115
|
|
945
1116
|
else {
|
946
1117
|
mainPromise = utils
|
947
|
-
|
1118
|
+
.get("https://www.facebook.com/Lazic.Kanzu", null, null, globalOptions, { noRef: true }) // for fixing
|
948
1119
|
.then(utils.saveCookies(jar))
|
949
1120
|
.then(makeLogin(jar, email, password, globalOptions, callback, prCallback))
|
950
1121
|
.then(function() {
|
@@ -955,8 +1126,9 @@ try {
|
|
955
1126
|
console.log(e);
|
956
1127
|
}
|
957
1128
|
|
958
|
-
function CheckAndFixErr(res) {
|
959
|
-
|
1129
|
+
function CheckAndFixErr(res, fastSwitch) {
|
1130
|
+
if (fastSwitch) return res;
|
1131
|
+
let reg_antierr = /7431627028261359627/gs; // =))))))
|
960
1132
|
if (reg_antierr.test(res.body)) {
|
961
1133
|
const Data = JSON.stringify(res.body);
|
962
1134
|
const Dt_Check = Data.split('2Fhome.php&gfid=')[1];
|
@@ -972,10 +1144,11 @@ try {
|
|
972
1144
|
else return res
|
973
1145
|
}
|
974
1146
|
|
975
|
-
function Redirect(res) {
|
1147
|
+
function Redirect(res,fastSwitch) {
|
1148
|
+
if (fastSwitch) return res;
|
976
1149
|
var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
|
977
1150
|
redirect = reg.exec(res.body);
|
978
|
-
if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions)
|
1151
|
+
if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions)
|
979
1152
|
return res;
|
980
1153
|
}
|
981
1154
|
|
@@ -985,20 +1158,25 @@ try {
|
|
985
1158
|
mainPromise = mainPromise
|
986
1159
|
.then(res => Redirect(res))
|
987
1160
|
.then(res => CheckAndFixErr(res))
|
988
|
-
|
989
1161
|
//fix via login with defaut UA return WWW.facebook.com not m.facebook.com
|
990
|
-
|
991
1162
|
.then(function(res) {
|
992
|
-
|
993
|
-
|
994
|
-
//
|
995
|
-
|
996
|
-
|
1163
|
+
if (global.OnAutoLoginProcess) return res;
|
1164
|
+
else {
|
1165
|
+
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
|
1166
|
+
if (!Regex_Via.test(res.body)) {
|
1167
|
+
//www.facebook.com
|
1168
|
+
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";
|
1169
|
+
return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true })
|
1170
|
+
}
|
1171
|
+
else return res
|
997
1172
|
}
|
998
|
-
else return res
|
999
1173
|
})
|
1000
|
-
.then(res =>
|
1001
|
-
.then(res =>
|
1174
|
+
.then(res => BypassAutomationNotification(res, jar, globalOptions, appState))
|
1175
|
+
.then(res => Redirect(res, global.OnAutoLoginProcess))
|
1176
|
+
.then(res => CheckAndFixErr(res, global.OnAutoLoginProcess))
|
1177
|
+
// .then(res => {
|
1178
|
+
// return utils.get('https://www.facebook.com/', jar, null, globalOptions, {}).then(utils.saveCookies(jar));
|
1179
|
+
// })
|
1002
1180
|
// .then(function(res) {
|
1003
1181
|
// let reg_old_web = /Switch Default Site/gs;
|
1004
1182
|
// if (reg_old_web.test(res.body)) {
|
@@ -1046,6 +1224,7 @@ try {
|
|
1046
1224
|
});
|
1047
1225
|
}
|
1048
1226
|
|
1227
|
+
|
1049
1228
|
/**
|
1050
1229
|
* It asks the user for their account and password, and then saves it to the database.
|
1051
1230
|
*/
|
@@ -1077,7 +1256,7 @@ function setUserNameAndPassWord() {
|
|
1077
1256
|
}
|
1078
1257
|
if (global.Fca.Require.FastConfig.ResetDataLogin) {
|
1079
1258
|
global.Fca.Require.FastConfig.ResetDataLogin = false;
|
1080
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + '/
|
1259
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + '/main/json/configfca.json', JSON.stringify(global.Fca.Require.FastConfig, null, 4));
|
1081
1260
|
}
|
1082
1261
|
logger.Success(Language.SuccessSetData);
|
1083
1262
|
process.exit(1);
|
@@ -1139,9 +1318,10 @@ function login(loginData, options, callback) {
|
|
1139
1318
|
});
|
1140
1319
|
loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
|
1141
1320
|
}
|
1142
|
-
|
1321
|
+
else if (loginData.appState) {
|
1143
1322
|
setOptions(globalOptions, options);
|
1144
|
-
let All = (getAll()).filter(i => i.data
|
1323
|
+
let All = (getAll()).filter(i => i.data !== null);
|
1324
|
+
All = All.filter(i => i.data.messageCount !== undefined)
|
1145
1325
|
if (All.length >= 1) {
|
1146
1326
|
deleteAll(All.map(obj => obj.data.threadID));
|
1147
1327
|
}
|
@@ -1176,7 +1356,7 @@ function login(loginData, options, callback) {
|
|
1176
1356
|
if (!UserName || !PassWord) {
|
1177
1357
|
logger.Warning("Dangerous action detected! Proceeding to automatically disable websocket_extension.");
|
1178
1358
|
global.Fca.Require.FastConfig.Websocket_Extension.Status = false;
|
1179
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
1359
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
|
1180
1360
|
}
|
1181
1361
|
else {
|
1182
1362
|
try {
|
@@ -1189,7 +1369,7 @@ function login(loginData, options, callback) {
|
|
1189
1369
|
Database().set('Ws_2Fa', secret.base32);
|
1190
1370
|
if (global.Fca.Require.FastConfig.Websocket_Extension.ResetData) {
|
1191
1371
|
global.Fca.Require.FastConfig.Websocket_Extension.ResetData = false;
|
1192
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + '/
|
1372
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + '/main/json/configfca.json', JSON.stringify(global.Fca.Require.FastConfig, null, 4));
|
1193
1373
|
}
|
1194
1374
|
question("Enter To Continue!");
|
1195
1375
|
const ask = function() {
|
@@ -1213,7 +1393,7 @@ function login(loginData, options, callback) {
|
|
1213
1393
|
console.log(e)
|
1214
1394
|
logger.Warning("Error, auto turn off Websocket_extension");
|
1215
1395
|
global.Fca.Require.FastConfig.Websocket_Extension.Status = false;
|
1216
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
1396
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
|
1217
1397
|
process.exit(1);
|
1218
1398
|
}
|
1219
1399
|
}
|
package/index.js
CHANGED
@@ -74,7 +74,7 @@ global.Fca = new Object({
|
|
74
74
|
},
|
75
75
|
"LogFile": {
|
76
76
|
"Use": false,
|
77
|
-
"Explain": "Record memory usage logs to fix errors. Default location:
|
77
|
+
"Explain": "Record memory usage logs to fix errors. Default location: main/database_fca/memory.logs"
|
78
78
|
}
|
79
79
|
}
|
80
80
|
},
|
@@ -166,25 +166,25 @@ try {
|
|
166
166
|
let All_Variable = Boolean_Fca.concat(String_Fca,Number_Fca,Object_Fca);
|
167
167
|
|
168
168
|
|
169
|
-
if (!global.Fca.Require.fs.existsSync(process.cwd() + '/
|
170
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
169
|
+
if (!global.Fca.Require.fs.existsSync(process.cwd() + '/main/json/configfca.json')) {
|
170
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
|
171
171
|
process.exit(1);
|
172
172
|
}
|
173
173
|
|
174
174
|
try {
|
175
|
-
var Data_Setting = require(process.cwd() + "/
|
175
|
+
var Data_Setting = require(process.cwd() + "/main/json/configfca.json");
|
176
176
|
}
|
177
177
|
catch (e) {
|
178
178
|
global.Fca.Require.logger.Error('Detect Your FastConfigFca Settings Invalid!, Carry out default restoration');
|
179
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
179
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
|
180
180
|
process.exit(1)
|
181
181
|
}
|
182
|
-
if (global.Fca.Require.fs.existsSync(process.cwd() + '/
|
182
|
+
if (global.Fca.Require.fs.existsSync(process.cwd() + '/main/json/configfca.json')) {
|
183
183
|
|
184
184
|
for (let i of All_Variable) {
|
185
185
|
if (Data_Setting[i] == undefined) {
|
186
186
|
Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
|
187
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
187
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
|
188
188
|
}
|
189
189
|
else continue;
|
190
190
|
} //Check Variable
|
@@ -205,7 +205,7 @@ catch (e) {
|
|
205
205
|
else if (Object_Fca.includes(i)) {
|
206
206
|
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Object") {
|
207
207
|
Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
|
208
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
208
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
|
209
209
|
}
|
210
210
|
else continue;
|
211
211
|
}
|
@@ -217,7 +217,7 @@ catch (e) {
|
|
217
217
|
for (let i of Mission.Data_Path) {
|
218
218
|
if (Data_Setting[Mission.Main_Path] == undefined) {
|
219
219
|
Data_Setting[Mission.Main_Path] = global.Fca.Data.ObjFastConfig[Mission.Main_Path];
|
220
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
220
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
|
221
221
|
}
|
222
222
|
const User_Data = (utils.getData_Path(Data_Setting[Mission.Main_Path], i, 0))
|
223
223
|
const User_Data_Type = utils.getType(User_Data);
|
@@ -225,7 +225,7 @@ catch (e) {
|
|
225
225
|
const Mission_Path = User_Data == 0 ? i : i.slice(0, User_Data);
|
226
226
|
const Mission_Obj = utils.getData_Path(global.Fca.Data.ObjFastConfig[Mission.Main_Path], Mission_Path, 0);
|
227
227
|
Data_Setting[Mission.Main_Path] = utils.setData_Path(Data_Setting[Mission.Main_Path], Mission_Path, Mission_Obj)
|
228
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
228
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
|
229
229
|
}
|
230
230
|
}
|
231
231
|
}
|
@@ -410,7 +410,7 @@ module.exports = function(loginData, options, callback) {
|
|
410
410
|
else {
|
411
411
|
log.warn("[ FCA-UPDATE ] •", "Error Stable Version, Please Check Your Stable Version in FastConfig.json, Automatically turn off Stable Version!");
|
412
412
|
global.Fca.Require.FastConfig.Stable_Version.Accept = false;
|
413
|
-
global.Fca.Require.fs.writeFileSync(process.cwd() + "/
|
413
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
|
414
414
|
process.exit(1);
|
415
415
|
}
|
416
416
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "fca-horidai-remastered",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.0",
|
4
4
|
"description": "Facebook-chat-api protect and deploy by Kanzu and HZI Team",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -20,15 +20,16 @@
|
|
20
20
|
"aes-js": "latest",
|
21
21
|
"ansi-to-html": "latest",
|
22
22
|
"assert": "latest",
|
23
|
-
"better-sqlite3": "7.6.2",
|
24
23
|
"bluebird": "latest",
|
25
24
|
"chalk": "4.1.2",
|
26
|
-
"cheerio": "
|
25
|
+
"cheerio": "1.0.0-rc.12",
|
27
26
|
"crypto-js": "latest",
|
28
27
|
"deasync": "^0.1.28",
|
29
28
|
"duplexify": "^4.1.2",
|
29
|
+
"better-sqlite3": "7.6.2",
|
30
30
|
"encode32": "latest",
|
31
31
|
"express": "latest",
|
32
|
+
"figlet": "latest",
|
32
33
|
"file-url": "^3.0.0",
|
33
34
|
"got": "^11.8.6",
|
34
35
|
"https-proxy-agent": "latest",
|
@@ -44,12 +45,11 @@
|
|
44
45
|
"readline": "latest",
|
45
46
|
"request": "latest",
|
46
47
|
"speakeasy": "latest",
|
47
|
-
"
|
48
|
+
"sqlite3": "^5.0.2",
|
49
|
+
"totp-generator": "^0.0.14",
|
48
50
|
"tough-cookie": "^4.1.2",
|
49
51
|
"uuid": "latest",
|
50
|
-
"ws": "^8.13.0"
|
51
|
-
"sqlite3": "^5.0.2",
|
52
|
-
"figlet": "latest"
|
52
|
+
"ws": "^8.13.0"
|
53
53
|
},
|
54
54
|
"engines": {
|
55
55
|
"node": ">=14.x"
|
package/src/acpUsers.js
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require('../utils');
|
4
|
+
var log = require('npmlog');
|
5
|
+
|
6
|
+
module.exports = function (http, api, ctx) {
|
7
|
+
return function acpUsers(userID, callback) {
|
8
|
+
var form = {
|
9
|
+
av: ctx.userID,
|
10
|
+
fb_api_caller_class: "RelayModern",
|
11
|
+
fb_api_req_friendly_name: "FriendingCometFriendRequestConfirmMutation",
|
12
|
+
variables: JSON.stringify({
|
13
|
+
input: {
|
14
|
+
attribution_id_v2: `FriendingCometFriendRequestsRoot.react,comet.friending.friendrequests,unexpected,${Date.now()},609381,2356318349,,;FriendingCometRoot.react,comet.friending,tap_tabbar,${Date.now()},496978,2356318349,,`,
|
15
|
+
friend_requester_id: userID,
|
16
|
+
friending_channel: "FRIENDS_HOME_MAIN",
|
17
|
+
actor_id: ctx.globalOptions.pageID || ctx.userID,
|
18
|
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
19
|
+
},
|
20
|
+
scale: 1,
|
21
|
+
refresh_num: 0
|
22
|
+
}),
|
23
|
+
server_timestamps: true,
|
24
|
+
doc_id: "26226851996930142"
|
25
|
+
};
|
26
|
+
|
27
|
+
http.post('https://www.facebook.com/api/graphql/', ctx.jar, form, null, null)
|
28
|
+
.then(utils.parseAndCheckLogin(ctx, http))
|
29
|
+
.then(function (res) {
|
30
|
+
if (res.errors) {
|
31
|
+
return callback(JSON.stringify(res.errors, null, 2));
|
32
|
+
}
|
33
|
+
return callback(JSON.stringify(res.data, null, 2));
|
34
|
+
})
|
35
|
+
.catch(function (err) {
|
36
|
+
log.error('addFriends', err);
|
37
|
+
return callback(err);
|
38
|
+
});
|
39
|
+
};
|
40
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require('../utils');
|
4
|
+
var log = require('npmlog');
|
5
|
+
|
6
|
+
module.exports = function (http, api, ctx) {
|
7
|
+
return async function addFriends(userID, callback) {
|
8
|
+
var form = {
|
9
|
+
"__av": ctx.userID,
|
10
|
+
"fb_api_caller_class": "RelayModern",
|
11
|
+
"fb_api_req_friendly_name": "FriendingCometFriendRequestSendMutation",
|
12
|
+
"variables": JSON.stringify({
|
13
|
+
"input": {
|
14
|
+
"attribution_id_v2": "ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,unexpected,"+Date.now()+",510030,190055527696468,,;SearchCometGlobalSearchDefaultTabRoot.react,comet.search_results.default_tab,tap_search_bar," + Date.now() + ",830835,391724414624676,,",
|
15
|
+
"friend_requestee_ids": [userID],
|
16
|
+
"friending_channel": "PROFILE_BUTTON",
|
17
|
+
"warn_ack_for_ids": [],
|
18
|
+
"actor_id": ctx.userID,
|
19
|
+
"client_mutation_id": "3"
|
20
|
+
},
|
21
|
+
"scale": "1"
|
22
|
+
}),
|
23
|
+
"server_timestamps": true,
|
24
|
+
"doc_id": "7607575099364225"
|
25
|
+
};
|
26
|
+
|
27
|
+
http.post('https://www.facebook.com/api/graphql/', ctx.jar, form, null, null)
|
28
|
+
.then(utils.parseAndCheckLogin(ctx, http))
|
29
|
+
.then(function (res) {
|
30
|
+
return callback((JSON.stringify(res.data?.friend_request_send?.friend_requestees?.[0], null, 2)) || { error: "Không thể gửi lời mời kết bạn"});
|
31
|
+
})
|
32
|
+
.catch(function (err) {
|
33
|
+
log.error('addFriends', err);
|
34
|
+
return callback(err);
|
35
|
+
});
|
36
|
+
}
|
37
|
+
};
|
@@ -0,0 +1,93 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var utils = require('../utils');
|
4
|
+
var log = require('npmlog');
|
5
|
+
|
6
|
+
module.exports = function (http, api, ctx) {
|
7
|
+
return function changeAvatar(image, caption = '', timestamp = null, callback) {
|
8
|
+
var cb;
|
9
|
+
var rt = new Promise(function (resolve, reject) {
|
10
|
+
cb = (error, url) => error ? reject(error) : resolve(url);
|
11
|
+
});
|
12
|
+
|
13
|
+
if (typeof image == 'function') {
|
14
|
+
callback = image;
|
15
|
+
image = null;
|
16
|
+
}
|
17
|
+
if (typeof caption == 'function') {
|
18
|
+
callback = caption;
|
19
|
+
caption = '';
|
20
|
+
}
|
21
|
+
if (typeof caption == 'number') {
|
22
|
+
timestamp = caption;
|
23
|
+
caption = '';
|
24
|
+
}
|
25
|
+
if (typeof timestamp == 'function') {
|
26
|
+
callback = timestamp;
|
27
|
+
timestamp = null;
|
28
|
+
}
|
29
|
+
if (typeof callback == 'function') cb = callback;
|
30
|
+
|
31
|
+
if (!utils.isReadableStream(image)) {
|
32
|
+
var error = 'image should be a readable stream, not ' + utils.getType(image);
|
33
|
+
log.error('changeAvatar', error);
|
34
|
+
cb(error);
|
35
|
+
} else {
|
36
|
+
http
|
37
|
+
.postFormData('https://www.facebook.com/profile/picture/upload/', ctx.jar, {
|
38
|
+
profile_id: ctx.userID,
|
39
|
+
photo_source: 57,
|
40
|
+
av: ctx.userID,
|
41
|
+
file: image
|
42
|
+
})
|
43
|
+
.then(utils.parseAndCheckLogin(ctx, http))
|
44
|
+
.then(function (res) {
|
45
|
+
if (res.error || res.errors || !res.payload)
|
46
|
+
throw res;
|
47
|
+
|
48
|
+
var vari = {
|
49
|
+
input: {
|
50
|
+
caption,
|
51
|
+
existing_photo_id: res.payload.fbid,
|
52
|
+
expiration_time: timestamp,
|
53
|
+
profile_id: ctx.userID,
|
54
|
+
profile_pic_method: "EXISTING",
|
55
|
+
profile_pic_source: "TIMELINE",
|
56
|
+
scaled_crop_rect: {
|
57
|
+
height: 1,
|
58
|
+
width: 1,
|
59
|
+
x: 0,
|
60
|
+
y: 0
|
61
|
+
},
|
62
|
+
skip_cropping: true,
|
63
|
+
actor_id: ctx.userID,
|
64
|
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
65
|
+
},
|
66
|
+
isPage: false,
|
67
|
+
isProfile: true,
|
68
|
+
scale: 3
|
69
|
+
}
|
70
|
+
return http
|
71
|
+
.post('https://www.facebook.com/api/graphql', ctx.jar, {
|
72
|
+
doc_id: 5066134240065849,
|
73
|
+
server_timestamps: true,
|
74
|
+
fb_api_req_friendly_name: 'ProfileCometProfilePictureSetMutation',
|
75
|
+
variables: JSON.stringify(vari)
|
76
|
+
})
|
77
|
+
.then(utils.parseAndCheckLogin(ctx, http));
|
78
|
+
})
|
79
|
+
.then(function (res) {
|
80
|
+
if (res.errors)
|
81
|
+
throw res;
|
82
|
+
|
83
|
+
return cb(null, (res[0] || res).data.profile_picture_set.profile);
|
84
|
+
})
|
85
|
+
.catch(function (err) {
|
86
|
+
log.error('changeAvatar', err);
|
87
|
+
return cb(err);
|
88
|
+
});
|
89
|
+
}
|
90
|
+
|
91
|
+
return rt;
|
92
|
+
}
|
93
|
+
}
|