meta-horizonn 1.3.2 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,49 @@
1
+ class APILoadBalancer {
2
+ constructor(APIV1, APIV2 , preferredRatio = 0.85, forceType2) {
3
+ this.APIV1 = APIV1;
4
+ this.APIV2 = APIV2;
5
+ this.preferredRatio = preferredRatio;
6
+ this.totalRequests = 0;
7
+ this.APIV2Requests = 0;
8
+ }
9
+
10
+ async makeRequest(requestData) {
11
+ try {
12
+ this.totalRequests++;
13
+ const currentRatio = this.APIV2Requests / this.totalRequests;
14
+
15
+ if (currentRatio < this.preferredRatio) {
16
+ this.APIV2Requests++;
17
+ return await this.APIV2(...requestData)
18
+ } else {
19
+ return await this.APIV1(...requestData);
20
+ }
21
+ } catch (error) {
22
+ return await this.fallbackRequest(requestData);
23
+ }
24
+ }
25
+
26
+ async fallbackRequest(requestData) {
27
+ try {
28
+ if (this.APIV2Requests / this.totalRequests >= this.preferredRatio) {
29
+ this.APIV2Requests++;
30
+ return await this.APIV2(...requestData);
31
+ } else {
32
+ return await this.APIV1(...requestData);
33
+ }
34
+ } catch (error) {
35
+ throw new Error('Balancer Error, contact fb.com/Lazic.Kanzu');
36
+ }
37
+ }
38
+
39
+ getStats() {
40
+ return {
41
+ totalRequests: this.totalRequests,
42
+ apiv2Requests: this.APIV2Requests,
43
+ apiv1Requests: this.totalRequests - this.APIV2Requests,
44
+ currentRatio: (this.APIV2Requests / this.totalRequests) * 100
45
+ };
46
+ }
47
+ }
48
+
49
+ module.exports = APILoadBalancer;
@@ -8,7 +8,7 @@
8
8
  "UID": "Đăng Nhập Tại ID: %1",
9
9
  "Area": "Vùng Của Tài Khoản Là: %1",
10
10
  "NoAreaData": "Không Thể Lấy Vùng Của Tài Khoản !",
11
- "NoAreaDataBypass": "Không Thể Lấy Vùng Của Tài Khoản Tuy FCA Đã Bypass 😔",
11
+ "NoAreaDataBypass": "Không Thể Lấy Vùng Của Tài Khoản Nhưng Đã Bỏ Qua Bước Đó 😔",
12
12
  "OnLogin": "Đang Đăng Nhập ...",
13
13
  "InvaildAccount": "Sai Mật Khẩu Hoặc Tài Khoản !",
14
14
  "TwoAuth": "Bạn Đang Bật 2 Bảo Mật !",
@@ -62,26 +62,29 @@
62
62
  "EnterSecurityCode": "Hãy Nhập Mã Xác Thực 2 Yếu Tố Của Bạn: ",
63
63
  "ErrThroughCookies": "Đã Xảy Ra Lỗi Khi Xuyên 2Fa, Hãy Nhập Mã 2Fa Lại !",
64
64
 
65
- "NodeVersionNotSupported": "Phiên Bản: %1 Không Được Hỗ Trợ, Tự Động Tải Phiên Bản Nodejs V14",
66
- "UsingNVM": "Bạn đang sử dụng nvm để control node version, hãy bấm 'nvm install 14.17.0' sau đó bấm 'nvm use 14.17.0' để chuyển sang phiên bản được hỗ trợ !",
67
- "DownloadingNode": "Đang tải phiên bản Node V14 Được Hỗ Trợ !",
68
- "NodeDownloadingComplete": "Tải Phiên Bản Node V14 Thành Công !",
65
+ "NodeVersionNotSupported": "Phiên Bản: %1 Không Được Hỗ Trợ, Tự Động Tải Phiên Bản Node.JS V14",
66
+ "UsingNVM": "Bạn Đang Sử Dụng NVM Để Control Node.JSVersion, Hãy Bấm 'nvm install 14.17.0' Sau Đó Bấm 'nvm use 14.17.0' Để Chuyển Sang Phiên Bản Được Hỗ Trợ !",
67
+ "DownloadingNode": "Đang Tải Phiên Bản Node.JS V14 Được Hỗ Trợ !",
68
+ "NodeDownloadingComplete": "Tải Phiên Bản Node.JS V14 Thành Công !",
69
69
  "RestartRequire": "Tải Thành Công, Yêu Cầu Người Dùng Restart Máy Để Có Tác Dụng!",
70
- "ErrNodeDownload": "Đã Xảy Ra Lỗi Trong Lúc Tự Động Tải Node Phiên Bản 14, Hãy Liên Hệ fb.com/kemsadboiz!",
70
+ "ErrNodeDownload": "Đã Xảy Ra Lỗi Trong Lúc Tự Động Tải Node.JS Phiên Bản 14, Hãy Liên Hệ fb.com/kemsadboiz!",
71
71
  "RestartingN": "Đang Khởi Động Lại Chương Trình!",
72
72
  "Rebuilding": "Đang Rebuild Lại Package NPM tránh lỗi !",
73
73
  "ErrRebuilding": "Đã Xảy Ra Lỗi Tại Khu Vực Rebuilding - npm install",
74
74
  "SuccessRebuilding": "Rebuilding Thành Công !",
75
75
  "UnableToConnect": "Đã Sảy Ra Lỗi Trong Lúc Kết Nối Tới Máy Chủ Instant Action, Hãy Kiểm Tra Lại Wifi!",
76
- "EVMChange": "Đang Thay Đổi Replit.nix Để Hỗ Trợ Node V14!",
76
+ "EVMChange": "Đang Thay Đổi Replit.nix Để Hỗ Trợ Node.JS V14!",
77
77
  "EVMChangeSuccess": "Thay Đổi Replit.nix Thành Công, Tiến Hành Restarting!",
78
78
 
79
- "Ws_TypeUserName": "Hãy Nhập Một UserName Cho Tài Khoản Websocket Extension của bạn: ",
80
- "Ws_TypePassWord": "Hãy Nhập Một Mật Khẩu Cho Tài Khoản WebSocket Extension của bạn : ",
79
+ "Ws_TypeUserName": "Hãy Nhập Một UserName Cho Tài Khoản Websocket Extension Của Bạn: ",
80
+ "Ws_TypePassWord": "Hãy Nhập Một Mật Khẩu Cho Tài Khoản WebSocket Extension Của Bạn: ",
81
81
  "Ws_Success": "Đặt Dữ Liệu Cho Websocket Extension Thành Công !",
82
- "Ws_2Fa": "Đây xác thực 2 yếu tố(2FA) của bạn cho Horizon_Extension, hãy sử dụng Google Authenticator để lấy phòng trường hợp quên mật khẩu hoặc yêu cầu xác minh !\n\n➣ Đây: %1",
83
- "Ws_2Fa_Check": "Hãy nhập 2Fa của bạn từ ứng dụng xác thực: ",
84
- "Bypass_956": "Đang thử nghiệm coi bạn có dính checkpoint 956 hay không!",
82
+ "Ws_2Fa": "Đây Xác Thực 2 Yếu Tố (2FA) Của Bạn Cho Horizon_Extension, Hãy Sử Dụng Google Authenticator Để Lấy Phòng Trường Hợp Quên Mật Khẩu Hoặc Yêu Cầu Xác Minh !\n\n➣ Đây: %1",
83
+ "Ws_2Fa_Check": "Hãy Nhập 2FA Của Bạn Từ Ứng Dụng Xác Thực: ",
84
+
85
+ "2FaBypassCheckpoint": "Tài Khoản Bạn Đang Cố Gắng Đăng Nhập Qua 2FA Đã Bị Dính 1 Dạng Checkpoint Nào Đấy, Hiện Tại Chưa Có Bản Fix Cho Checkpoint Ở 2FA, Hãy Liên Hệ Đến https://www.facebook.com/Lazic.Kanzu (Nguyễn Thái Hảo) Để Biết Chi Tiết Cách Sửa Lỗi !\n\n MÃ LỖI: %1",
86
+ "Bypass_956": "Đang Thử Nghiệm Coi Bạn Có Dính Checkpoint 956 Hay Không!",
87
+ "Bypass_AutoNoti": "Đã Vượt Qua Cảnh Báo Hành Vi Thành Công!",
85
88
 
86
89
  "WishMessage": [
87
90
  "Chúc Bạn Một Ngày Tốt Lành Nhé !!!",
@@ -123,7 +126,7 @@
123
126
  "UID": "Login as ID: %1",
124
127
  "Area": "Area Of Account Is: %1",
125
128
  "NoAreaData": "Can't Get Area Of Account !",
126
- "NoAreaDataBypass": "Can't Get The Area Of The Account But FCA Bypass 😔",
129
+ "NoAreaDataBypass": "Can't Get Account Area, But FCA Ignores It 😔",
127
130
  "OnLogin": "Currently logged ...",
128
131
  "InvaildAccount": "Wrong Password Or Account !",
129
132
  "TwoAuth": "You Currently On 2 Factor Security !",
@@ -168,33 +171,36 @@
168
171
  "AutoLogin": "AutoLogin Is On, Proceed to Log Back in!",
169
172
  "TypeAccount": "Enter Account: ",
170
173
  "TypePassword": "Enter a Password: ",
171
- "TypeAccountError": "The account needs to be an ID or Phone number or Gmail!",
174
+ "TypeAccountError": "The Account Needs To Be an ID or Phone Number or Gmail!",
172
175
  "ErrDataBase": "Error When Setting Auto Login Data !",
173
176
  "SuccessSetData": "Auto Login Data Set Successfully !",
174
- "Missing": "Please Code 2Fa According to the Photo's Guide in FastConfigFca.json Series AuthString!",
177
+ "Missing": "Please Code 2FA According to the Photo's Guide in FastConfigFca.json Series AuthString!",
175
178
  "EnterSecurityCode": "Enter your 2-Factor Authentication Code: ",
176
- "ErrThroughCookies": "2Fa Piercing Error Occurred, Enter Code 2Fa Again! ",
179
+ "ErrThroughCookies": "2FA Piercing Error Occurred, Enter Code 2FA Again! ",
177
180
 
178
- "NodeVersionNotSupported": "Version: %1 is not supported, automatically download nodejs version V14",
179
- "UsingNVM": "You are using nvm to control node version, please type 'nvm install 14.17.0' then type 'nvm use 14.17.0' to switch to the supported version!",
180
- "DownloadingNode": "Downloading node version V14 which is supported!",
181
- "NodeDownloadingComplete": "Successfully downloaded node version V14!",
182
- "RestartRequire": "Download successful, user needs to restart the computer to take effect!",
183
- "ErrNodeDownload": "An error occurred while automatically downloading node version 14, please contact fb.com/kemsadboiz!",
181
+ "NodeVersionNotSupported": "Version: %1 Is Not Supported, Automatically Download Node.JS Version V14",
182
+ "UsingNVM": "You Are Using NVM To Control Node.JS Version, Please Type 'nvm install 14.17.0' Then Type 'nvm use 14.17.0' To Switch To The Supported Version!",
183
+ "DownloadingNode": "Downloading Node.JS Version V14 Which Is Supported!",
184
+ "NodeDownloadingComplete": "Successfully Downloaded Node.JS Version V14!",
185
+ "RestartRequire": "Download Successful, User Needs To Restart The Computer To Take Effect!",
186
+ "ErrNodeDownload": "An error occurred while automatically downloading Node.JS version 14, please contact fb.com/kemsadboiz!",
184
187
  "RestartingN": "Restarting the program!",
185
188
  "Rebuilding": "Rebuilding npm package to avoid errors !",
186
189
  "ErrRebuilding": "An error occurred in the rebuilding area - npm install",
187
190
  "SuccessRebuilding": "Successfully rebuilt !",
188
191
  "UnableToConnect": "An error occurred while connecting to the instant action server, please check your wifi connection!",
189
- "EVMChange": "Changing replit.nix to support node V14!",
190
- "EVMChangeSuccess": "Successfully changed replit.nix, go ahead and restart!",
192
+ "EVMChange": "Changing replit.nix To Support Node.JS V14!",
193
+ "EVMChangeSuccess": "Successfully Changed replit.nix, Go Ahead and Restart!",
194
+
195
+ "Ws_TypeUserName": "Please enter a username for your Websocket Extension account: ",
196
+ "Ws_TypePassWord": "Please enter a password for your Websocket Extension account: ",
197
+ "Ws_Success": "Successfully Set Data For Websocket Extension!",
198
+ "Ws_2Fa": "This is your two-factor authentication (2FA) code for Horizon_Extension. Please use Google Authenticator to retrieve the backup code in case you forget your password or require verification.\n\n ➣ Here: %1",
199
+ "Ws_2Fa_Check": "Please enter your 2FA code from The Authentication App: ",
191
200
 
192
- "Ws_TypeUserName": "Please enter a username for your websocket extension account: ",
193
- "Ws_TypePassWord": "Please enter a password for your websocket extension account: ",
194
- "Ws_Success": "Successfully set data for websocket extension!",
195
- "Ws_2Fa": "This is your two-factor authentication (2FA) code for horizon_extension. Please use Google Authenticator to retrieve the backup code in case you forget your password or require verification.\n\n ➣ Here: %1",
196
- "Ws_2Fa_Check": "Please enter your 2FA code from the authentication app: ",
197
- "Bypass_956": "Testing to see if you get checkpoint 956 or not!",
201
+ "2FaBypassCheckpoint": "The Account You Are Trying To Login To With 2FA Has Encountered a Checkpoint Error. There Is Currently No Fix For 2FA Checkpoints. Please Contact https://www.facebook.com/Lazic.Kanzu (Nguyễn Thái Hảo) For Detailed Troubleshooting Instructions.\n\n ERROR CODE: %1",
202
+ "Bypass_956": "Testing To See If You Get Checkpoint 956 or Not!",
203
+ "Bypass_AutoNoti": "Successfully Passed The Behavior Warning!",
198
204
 
199
205
  "WishMessage": [
200
206
  "Have a Nice Day !",
package/Main.js CHANGED
@@ -156,7 +156,7 @@ if (global.Fca.Require.FastConfig.HTML.HTML) Server= express.listen(express.get(
156
156
  // WSS.handleUpgrade(escapedReq, escapedSocket, escapedHead, (wss) => {
157
157
  // const escapedWss = escapeHTML(wss);
158
158
  // const escapedReq = escapeHTML(req);
159
-
159
+
160
160
  // escapedWss.emit('connection', escapedWss, escapedReq);
161
161
  // });
162
162
  // });
@@ -207,7 +207,7 @@ if (global.Fca.Require.FastConfig.HTML.HTML) Server= express.listen(express.get(
207
207
  // }
208
208
  // }
209
209
  // }
210
-
210
+
211
211
  // }
212
212
 
213
213
  /!-[ Function setOptions ]-!/
@@ -280,6 +280,86 @@ function setOptions(globalOptions, options) {
280
280
  });
281
281
  }
282
282
 
283
+ function BypassAutomationNotification(response, jar, globalOptions, appstate,ID) {
284
+ global.Fca.BypassAutomationNotification = BypassAutomationNotification
285
+ try {
286
+ let UID;
287
+ if (ID) UID = ID
288
+ else {
289
+ UID = (appstate.find(i => i.key == 'c_user') || appstate.find(i => i.key == 'i_user'))
290
+ UID = UID.value;
291
+ }
292
+ if (response !== undefined) {
293
+ if (response.request.uri && response.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
294
+ if (response.request.uri.href.includes('601051028565049')) {
295
+ const fb_dtsg = utils.getFrom(response.body, '["DTSGInitData",[],{"token":"', '","');
296
+ const jazoest = utils.getFrom(response.body, 'jazoest=', '",');
297
+ const lsd = utils.getFrom(response.body, "[\"LSD\",[],{\"token\":\"", "\"}");
298
+ const FormBypass = {
299
+ av: UID,
300
+ fb_dtsg, jazoest, lsd,
301
+ fb_api_caller_class: "RelayModern",
302
+ fb_api_req_friendly_name: "FBScrapingWarningMutation",
303
+ variables: JSON.stringify({}),
304
+ server_timestamps: true,
305
+ doc_id: 6339492849481770
306
+ }
307
+ return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions)
308
+ .then(utils.saveCookies(jar)).then(function(res) {
309
+ global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
310
+ return process.exit(1);
311
+ });
312
+ }
313
+ else {
314
+ return response;
315
+ }
316
+ }
317
+ else {
318
+ return response;
319
+ }
320
+ }
321
+ else {
322
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions).then(function(res) {
323
+ if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
324
+ if (res.request.uri.href.includes('601051028565049')) return { Status: true, Body: res.body }
325
+ else return { Status: false, Body: res.body }
326
+ }
327
+ else return { Status: false, Body: res.body }
328
+ }).then(function(res) {
329
+ if (res.Status === true) {
330
+ const fb_dtsg = utils.getFrom(res.Body, '["DTSGInitData",[],{"token":"', '","');
331
+ const jazoest = utils.getFrom(res.Body, 'jazoest=', '",');
332
+ const lsd = utils.getFrom(res.Body, "[\"LSD\",[],{\"token\":\"", "\"}");
333
+ const FormBypass = {
334
+ av: UID,
335
+ fb_dtsg, jazoest, lsd,
336
+ fb_api_caller_class: "RelayModern",
337
+ fb_api_req_friendly_name: "FBScrapingWarningMutation",
338
+ variables: JSON.stringify({}),
339
+ server_timestamps: true,
340
+ doc_id: 6339492849481770
341
+ }
342
+ return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions).then(utils.saveCookies(jar))
343
+ .then(res => {
344
+ global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
345
+ return res;
346
+ })
347
+ }
348
+ else return res;
349
+ })
350
+ .then(function() {
351
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar))
352
+ })
353
+ .then(function() {
354
+ return process.exit(1);
355
+ })
356
+ }
357
+ }
358
+ catch (e) {
359
+ console.log(e);
360
+ }
361
+ }
362
+
283
363
  /!-[ Function BuildAPI ]-!/
284
364
 
285
365
  /**
@@ -289,6 +369,8 @@ function setOptions(globalOptions, options) {
289
369
  */
290
370
 
291
371
  function buildAPI(globalOptions, html, jar, bypass_region) {
372
+ const fb_dtsg = utils.getFroms(html, '["DTSGInitData",[],{"token":"', '","')[0];
373
+
292
374
  // var maybeCookie = jar.getCookies("https://www.facebook.com").filter(function(/** @type {{ cookieString: () => string; }} */val) { return val.cookieString().split("=")[0] === "c_user"; });
293
375
  //check tiktik
294
376
  var userID;
@@ -300,7 +382,7 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
300
382
  if (maybeUser.length === 0 && maybeTiktik.length === 0) {
301
383
  if (global.Fca.Require.FastConfig.AutoLogin) {
302
384
  return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
303
- global.Fca.Action('AutoLogin')
385
+ global.Fca.Action('AutoLogin');
304
386
  });
305
387
  }
306
388
  else if (!global.Fca.Require.FastConfig.AutoLogin) {
@@ -334,11 +416,25 @@ else userID = maybeUser[0].cookieString().split("=")[1].toString();
334
416
  var CHECK_MQTT = {
335
417
  oldFBMQTTMatch: html.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/),
336
418
  newFBMQTTMatch: html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/),
337
- legacyFBMQTTMatch: html.match(/(\["MqttWebConfig",\[\],{fbid:")(.+?)(",appID:219994525426954,endpoint:")(.+?)(",pollingEndpoint:")(.+?)(3790])/)
419
+ legacyFBMQTTMatch: html.match(/\["MqttWebConfig",\[\],{"fbid":"(.*?)","appID":219994525426954,"endpoint":"(.*?)","pollingEndpoint":"(.*?)"/)
338
420
  }
339
421
 
422
+ // List of region
423
+ /**
424
+ * PRN = Pacific Northwest Region (Khu vực Tây Bắc Thái Bình Dương)
425
+ * VLL = Valley Region
426
+ * ASH = Ashburn Region
427
+ * DFW = Dallas/Fort Worth Region
428
+ * LLA = Los Angeles Region
429
+ * FRA = Frankfurt
430
+ * SIN = Singapore
431
+ * NRT = Tokyo (Japan)
432
+ * HKG = Hong Kong
433
+ * SYD = Sydney
434
+ */
435
+
340
436
  let Slot = Object.keys(CHECK_MQTT);
341
-
437
+
342
438
  var mqttEndpoint, region, irisSeqID;
343
439
  Object.keys(CHECK_MQTT).map(function(MQTT) {
344
440
  if (CHECK_MQTT[MQTT] && !region) {
@@ -363,7 +459,75 @@ else userID = maybeUser[0].cookieString().split("=")[1].toString();
363
459
  }
364
460
  return;
365
461
  }
366
- });
462
+ });
463
+
464
+ const regions = [
465
+ {
466
+ code: "PRN",
467
+ name: "Pacific Northwest Region",
468
+ location: "Khu vực Tây Bắc Thái Bình Dương"
469
+ },
470
+ {
471
+ code: "VLL",
472
+ name: "Valley Region",
473
+ location: "Valley"
474
+ },
475
+ {
476
+ code: "ASH",
477
+ name: "Ashburn Region",
478
+ location: "Ashburn"
479
+ },
480
+ {
481
+ code: "DFW",
482
+ name: "Dallas/Fort Worth Region",
483
+ location: "Dallas/Fort Worth"
484
+ },
485
+ {
486
+ code: "LLA",
487
+ name: "Los Angeles Region",
488
+ location: "Los Angeles"
489
+ },
490
+ {
491
+ code: "FRA",
492
+ name: "Frankfurt",
493
+ location: "Frankfurt"
494
+ },
495
+ {
496
+ code: "SIN",
497
+ name: "Singapore",
498
+ location: "Singapore"
499
+ },
500
+ {
501
+ code: "NRT",
502
+ name: "Tokyo",
503
+ location: "Japan"
504
+ },
505
+ {
506
+ code: "HKG",
507
+ name: "Hong Kong",
508
+ location: "Hong Kong"
509
+ },
510
+ {
511
+ code: "SYD",
512
+ name: "Sydney",
513
+ location: "Sydney"
514
+ },
515
+ {
516
+ code: "PNB",
517
+ name: "Pacific Northwest - Beta",
518
+ location: "Pacific Northwest "
519
+ }
520
+ ];
521
+
522
+ if (!region) {
523
+ region = ['prn', "pnb", "vll", "hkg", "sin"][Math.random() * 5 | 0];
524
+ }
525
+ if (!mqttEndpoint) {
526
+ mqttEndpoint = "wss://edge-chat.facebook.com/chat?region=" + region;
527
+ }
528
+
529
+ const Location = regions.find(r => r.code === region.toUpperCase());
530
+ logger.Normal(getText(Language.Area, (Location == undefined ? region.toUpperCase() : Location.name)));
367
531
 
368
532
  var ctx = {
369
533
  userID: userID,
@@ -380,7 +544,8 @@ else userID = maybeUser[0].cookieString().split("=")[1].toString();
380
544
  region: region,
381
545
  firstListen: true,
382
546
  req_ID: 0,
383
- callback_Task: {}
547
+ callback_Task: {},
548
+ fb_dtsg
384
549
  };
385
550
 
386
551
  var api = {
@@ -863,7 +1028,6 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
863
1028
 
864
1029
  try {
865
1030
  if (appState) {
866
- if (Array.isArray(appState) && appState.length > 0 && appState[0].hasOwnProperty('key')) {
867
1031
  // console.log(gradient('purple', 'orange').multiline(["H", "O", "R", "I", "Z", "O", "N"].join('\n')));
868
1032
  logger.Normal(Language.OnProcess);
869
1033
  switch (Database().has("FBKEY")) {
@@ -883,7 +1047,6 @@ try {
883
1047
  Database().set('FBKEY', SecurityKey);
884
1048
  }
885
1049
  }
886
- }
887
1050
  try {
888
1051
  switch (global.Fca.Require.FastConfig.EncryptFeature) {
889
1052
  case true: {
@@ -971,8 +1134,7 @@ try {
971
1134
  });
972
1135
  Database().set('Backup', appState);
973
1136
  mainPromise = utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
974
- }
975
- // }
1137
+ }
976
1138
  catch (e) {
977
1139
  try {
978
1140
  if (Database().has('Backup')) {
@@ -992,7 +1154,7 @@ try {
992
1154
 
993
1155
  else {
994
1156
  mainPromise = utils
995
- .get("https://www.facebook.com/", null, null, globalOptions, { noRef: true })
1157
+ .get("https://www.facebook.com/kemsadboiz", null, null, globalOptions, { noRef: true }) // for fixing
996
1158
  .then(utils.saveCookies(jar))
997
1159
  .then(makeLogin(jar, email, password, globalOptions, callback, prCallback))
998
1160
  .then(function() {
@@ -1003,50 +1165,54 @@ try {
1003
1165
  console.log(e);
1004
1166
  }
1005
1167
 
1006
- function CheckAndFixErr(res) {
1007
- let reg_antierr = /This browser is not supported/gs; // =))))))
1008
- if (reg_antierr.test(res.body)) {
1009
- const Data = JSON.stringify(res.body);
1010
- const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
1011
- if (Dt_Check == undefined) return res
1012
- const fid = Dt_Check.split("\\\\")[0];//fix sau
1013
- if (Dt_Check == undefined || Dt_Check == "") return res
1014
- const final_fid = fid.split(`\\`)[0];
1015
- if (final_fid == undefined || final_fid == '') return res;
1016
- const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1017
- bypass_region_err = true;
1018
- return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1168
+ function CheckAndFixErr(res, fastSwitch) {
1169
+ if (fastSwitch) return res;
1170
+ let reg_antierr = /7431627028261359627/gs; // =))))))
1171
+ if (reg_antierr.test(res.body)) {
1172
+ const Data = JSON.stringify(res.body);
1173
+ const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
1174
+ if (Dt_Check == undefined) return res;
1175
+ const fid = Dt_Check.split("\\\\")[0]; //fix sau
1176
+ if (Dt_Check == undefined || Dt_Check == "") return res;
1177
+ const final_fid = fid.split(`\\`)[0];
1178
+ if (final_fid == undefined || final_fid == '') return res;
1179
+ const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1180
+ bypass_region_err = true;
1181
+ return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1182
+ }
1183
+ else return res;
1019
1184
  }
1020
- else return res
1021
- };
1022
-
1023
- function Redirect(res) {
1024
- var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1025
- redirect = reg.exec(res.body);
1026
- if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1027
- return res;
1028
- };
1029
1185
 
1030
- let redirect = [1, "https://m.facebook.com/"];
1031
- let bypass_region_err = false;
1032
- var ctx, api;
1033
- mainPromise = mainPromise
1034
- .then(res => Redirect(res))
1035
- .then(res => CheckAndFixErr(res))
1036
-
1037
- //fix via login with defaut UA return WWW.facebook.com not m.facebook.com
1038
-
1039
- .then(function(res) {
1040
- 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
1041
- if (!Regex_Via.test(res.body)) {
1042
- //www.facebook.com
1043
- globalOptions.userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1";
1044
- return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
1045
- }
1046
- else return res
1047
- })
1048
- .then(res => Redirect(res))
1049
- .then(res => CheckAndFixErr(res))
1186
+ function Redirect(res, fastSwitch) {
1187
+ if (fastSwitch) return res;
1188
+ var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1189
+ redirect = reg.exec(res.body);
1190
+ if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions)
1191
+ return res;
1192
+ }
1193
+
1194
+ let redirect = [1, "https://m.facebook.com/"];
1195
+ let bypass_region_err = false;
1196
+ var ctx, api;
1197
+ mainPromise = mainPromise
1198
+ .then(res => Redirect(res))
1199
+ .then(res => CheckAndFixErr(res))
1200
+ //fix via login with defaut UA return WWW.facebook.com not m.facebook.com
1201
+ .then(function(res) {
1202
+ if (global.OnAutoLoginProcess) return res;
1203
+ else {
1204
+ 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
1205
+ if (!Regex_Via.test(res.body)) {
1206
+ //www.facebook.com
1207
+ 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";
1208
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true })
1209
+ }
1210
+ else return res;
1211
+ }
1212
+ })
1213
+ .then(res => BypassAutomationNotification(res, jar, globalOptions, appState))
1214
+ .then(res => Redirect(res, global.OnAutoLoginProcess))
1215
+ .then(res => CheckAndFixErr(res, global.OnAutoLoginProcess))
1050
1216
 
1051
1217
  // .then(function(res) {
1052
1218
  // var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
@@ -1194,7 +1360,7 @@ function login(loginData, options, callback) {
1194
1360
  emitReady: false,
1195
1361
  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"
1196
1362
  };
1197
-
1363
+
1198
1364
  var prCallback = null;
1199
1365
  if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
1200
1366
  var rejectFunc = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meta-horizonn",
3
- "version": "1.3.2",
3
+ "version": "1.3.5",
4
4
  "description": "Facebook-Chat-API Protect and Deploy by Kanzu and HZI Team. Kem is redeveloped. Rename package is Meta Horizonn and package supported ChatBot Messenger.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,37 +20,33 @@
20
20
  "aes-js": "latest",
21
21
  "ansi-to-html": "latest",
22
22
  "assert": "latest",
23
- "axios": "^1.5.0",
24
23
  "better-sqlite3": "7.6.2",
25
24
  "bluebird": "latest",
26
25
  "chalk": "4.1.2",
27
- "cheerio": "latest",
26
+ "cheerio": "1.0.0-rc.12",
28
27
  "crypto-js": "latest",
29
28
  "deasync": "^0.1.28",
30
29
  "duplexify": "^4.1.2",
31
30
  "encode32": "latest",
32
31
  "express": "latest",
33
- "figlet": "^1.6.0",
32
+ "figlet": "latest",
34
33
  "file-url": "^3.0.0",
35
- "form-data": "^4.0.0",
36
- "fs-extra": "^11.1.1",
37
34
  "got": "^11.8.6",
38
35
  "https-proxy-agent": "latest",
39
36
  "is-hexcolor": "^1.0.0",
40
37
  "lodash": "latest",
41
38
  "moment": "^2.29.4",
42
- "mqtt": "latest",
39
+ "mqtt": "^4.3.7",
43
40
  "npmlog": "latest",
44
41
  "os": "latest",
45
42
  "path": "latest",
46
43
  "pretty-ms": "7.0.1",
47
- "puppeteer": "^21.1.1",
48
44
  "readable-stream": "^4.4.0",
49
45
  "readline": "latest",
50
46
  "request": "latest",
51
47
  "speakeasy": "latest",
52
48
  "sqlite3": "^5.0.2",
53
- "totp-generator": "latest",
49
+ "totp-generator": "^0.0.14",
54
50
  "tough-cookie": "^4.1.2",
55
51
  "uuid": "latest",
56
52
  "ws": "^8.13.0"
@@ -61,7 +57,7 @@
61
57
  "devDependencies": {
62
58
  "eslint": "^8.40.0",
63
59
  "mocha": "latest",
64
- "prettier": "latest"
60
+ "prettier": "^3.3.3"
65
61
  },
66
62
  "eslintConfig": {
67
63
  "env": {
package/src/listenMqtt.js CHANGED
@@ -322,7 +322,7 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
322
322
  var presence = {
323
323
  type: "presence",
324
324
  userID: userID.toString(),
325
- // Convert to ms
325
+ //Convert to ms
326
326
  timestamp: data["l"] * 1000,
327
327
  statuses: data["p"]
328
328
  };
@@ -341,6 +341,7 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
341
341
  LogUptime();
342
342
  process.kill(process.pid);
343
343
  });
344
+
344
345
  process.on('exit', LogUptime);
345
346
  }
346
347
 
@@ -799,7 +800,7 @@ function parseDelta(defaultFuncs, api, ctx, globalCallback, {
799
800
  break;
800
801
  }
801
802
  case 'NewMessage': {
802
- const hasLiveLocation = (delta) => {
803
+ const hasLiveLocation = (delta) => {
803
804
  const attachment = delta.attachments?.[0]?.mercury?.extensible_attachment;
804
805
  const storyAttachment = attachment?.story_attachment;
805
806
  return storyAttachment?.style_list?.includes('message_live_location');
@@ -840,13 +841,23 @@ function markDelivery(ctx, api, threadID, messageID) {
840
841
 
841
842
  module.exports = function(defaultFuncs, api, ctx) {
842
843
  var globalCallback = identity;
844
+ var okeoke;
843
845
  getSeqID = function getSeqID() {
844
846
  ctx.t_mqttCalled = false;
845
847
  defaultFuncs
846
848
  .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
849
+ .then(res => {
850
+ okeoke = res;
851
+ return res;
852
+ })
847
853
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
848
854
  .then((resData) => {
849
855
  if (utils.getType(resData) != "Array") {
856
+ if (resData.request.uri && resData.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
857
+ if (resData.request.uri.href.includes('601051028565049')) {
858
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
859
+ }
860
+ }
850
861
  if (global.Fca.Require.FastConfig.AutoLogin) {
851
862
  return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
852
863
  return global.Fca.Action('AutoLogin');
@@ -872,6 +883,11 @@ module.exports = function(defaultFuncs, api, ctx) {
872
883
  })
873
884
  .catch((err) => {
874
885
  log.error("getSeqId", err);
886
+ if (okeoke.request.uri && okeoke.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
887
+ if (okeoke.request.uri.href.includes('601051028565049')) {
888
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
889
+ }
890
+ }
875
891
  if (utils.getType(err) == "Object" && err.error === global.Fca.Require.Language.Index.ErrAppState) ctx.loggedIn = false;
876
892
  return globalCallback(err);
877
893
  });
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
2
 
3
+ const Balancer = require('../Extra/Balancer.js');
3
4
  var utils = require("../utils");
4
5
  var log = require("npmlog");
5
6
 
6
7
  module.exports = function (defaultFuncs, api, ctx) {
7
- return function unsendMessage(messageID, callback) {
8
+ //const BalancerInstance = new Balancer(api.unsendMessage, unsendMessage, 0.85);
9
+
10
+ function unsendMessage(messageID, threadID, callback) {
8
11
  var resolveFunc = function () {};
9
12
  var rejectFunc = function () {};
10
13
  var returnPromise = new Promise(function (resolve, reject) {
11
14
  resolveFunc = resolve;
12
15
  rejectFunc = reject;
13
16
  });
14
-
17
+
15
18
  if (!callback) {
16
19
  callback = function (err, friendList) {
17
20
  if (err) return rejectFunc(err);
@@ -19,21 +22,27 @@ module.exports = function (defaultFuncs, api, ctx) {
19
22
  };
20
23
  }
21
24
 
22
- var form = {
23
- message_id: messageID
24
- };
25
+ if (threadID) return api.unsendMqttMessage(threadID, messageID, callback);
26
+ else {
27
+ var form = {
28
+ message_id: messageID
29
+ };
30
+
31
+ defaultFuncs
32
+ .post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
33
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
+ .then(function (resData) {
35
+ if (resData.error) throw resData;
36
+ return callback();
37
+ })
38
+ .catch(function (err) {
39
+ log.error("unsendMessage", err);
40
+ return callback(err);
41
+ });
42
+
43
+ return returnPromise;
44
+ }
45
+ }
25
46
 
26
- defaultFuncs
27
- .post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
28
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
29
- .then(function (resData) {
30
- if (resData.error) throw resData;
31
- return callback();
32
- })
33
- .catch(function (err) {
34
- log.error("unsendMessage", err);
35
- return callback(err);
36
- });
37
- return returnPromise;
38
- };
39
- };
47
+ return unsendMessage;
48
+ };
@@ -0,0 +1,66 @@
1
+ /* eslint-disable linebreak-style */
2
+ "use strict";
3
+
4
+ var utils = require("../utils");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function(threadID, messageID ,callback) {
8
+ var resolveFunc = function () {};
9
+ var rejectFunc = function () {};
10
+
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (!callback && utils.getType(messageID) === "AsyncFunction" || !callback && utils.getType(messageID) === "Function") messageID = callback;
17
+
18
+ if (!callback) {
19
+ callback = function (err, data) {
20
+ if (err) return rejectFunc(err);
21
+ resolveFunc(data);
22
+ };
23
+ }
24
+
25
+ const Payload = {
26
+ message_id:messageID,
27
+ thread_key:threadID,
28
+ sync_group: 1
29
+ };
30
+
31
+ if (messageID != undefined || messageID != null) Payload.reply_metadata = {
32
+ reply_source_id: messageID,
33
+ reply_source_type: 1,
34
+ reply_type: 0
35
+ };
36
+
37
+ const Form = JSON.stringify({
38
+ app_id: "2220391788200892",
39
+ payload: JSON.stringify({
40
+ tasks: [{
41
+ label: 33,
42
+ payload: JSON.stringify(Payload),
43
+ queue_name: "unsend_message",
44
+ task_id: Math.random() * 1001 << 0,
45
+ failure_count: null,
46
+ }],
47
+ epoch_id: utils.generateOfflineThreadingID(),
48
+ version_id: '9094446350588544',
49
+
50
+ }),
51
+ request_id: ++ctx.req_ID,
52
+ type: 3
53
+ });
54
+
55
+ ctx.mqttClient.publish('/ls_req', Form,{
56
+ qos: 1,
57
+ retain: false,
58
+ });
59
+ ctx.callback_Task[ctx.req_ID] = new Object({
60
+ callback,
61
+ type: "unsendMqttMessage",
62
+ });
63
+
64
+ return returnPromise;
65
+ };
66
+ };
package/utils.js CHANGED
@@ -2677,7 +2677,12 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
2677
2677
  const Check = () => new Promise((re) => {
2678
2678
  defaultFuncs.get('https://facebook.com', ctx.jar).then(function(res) {
2679
2679
  if (res.headers.location && res.headers.location.includes('https://www.facebook.com/checkpoint/')) {
2680
- if (res.headers.includes('828281030927956')) return global.Fca.Action('Bypass', ctx, "956", defaultFuncs)
2680
+ if (res.headers.location.includes('828281030927956')) return global.Fca.Action('Bypass', ctx, "956", defaultFuncs)
2681
+ else if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
2682
+ if (res.request.uri.href.includes('601051028565049')) {
2683
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
2684
+ }
2685
+ }
2681
2686
  else return global.Fca.Require.logger.Error(global.Fca.Require.Language.Index.ErrAppState);
2682
2687
  }
2683
2688
  else return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
@@ -2688,6 +2693,11 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
2688
2693
  await Check();
2689
2694
  });
2690
2695
  }
2696
+ if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
2697
+ if (res.request.uri.href.includes('601051028565049')) {
2698
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
2699
+ }
2700
+ }
2691
2701
  if (global.Fca.Require.FastConfig.AutoLogin) {
2692
2702
  return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
2693
2703
  return global.Fca.Action('AutoLogin');