chatbot-nvt 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/.gitattributes +2 -0
  2. package/Extra/Bypass/956/index.js +234 -0
  3. package/Extra/Bypass/test/aaaa.json +170 -0
  4. package/Extra/Bypass/test/index.js +188 -0
  5. package/Extra/Database/index.js +469 -0
  6. package/Extra/ExtraAddons.js +82 -0
  7. package/Extra/ExtraFindUID.js +62 -0
  8. package/Extra/ExtraGetThread.js +365 -0
  9. package/Extra/ExtraScreenShot.js +430 -0
  10. package/Extra/ExtraUptimeRobot.js +38 -0
  11. package/Extra/Html/Classic/script.js +119 -0
  12. package/Extra/Html/Classic/style.css +8 -0
  13. package/Extra/Security/AES_256_GCM/index.js +0 -0
  14. package/Extra/Security/Base/Step_1.js +6 -0
  15. package/Extra/Security/Base/Step_2.js +22 -0
  16. package/Extra/Security/Base/Step_3.js +22 -0
  17. package/Extra/Security/Base/index.js +191 -0
  18. package/Extra/Security/Index.js +5 -0
  19. package/Extra/Security/Step_1.js +6 -0
  20. package/Extra/Security/Step_2.js +22 -0
  21. package/Extra/Security/Step_3.js +22 -0
  22. package/Extra/Src/Change_Environment.js +24 -0
  23. package/Extra/Src/Check_Update.js +67 -0
  24. package/Extra/Src/History.js +115 -0
  25. package/Extra/Src/Instant_Update.js +65 -0
  26. package/Extra/Src/Last-Run.js +65 -0
  27. package/Extra/Src/Premium.js +81 -0
  28. package/Extra/Src/Release_Memory.js +160 -0
  29. package/Extra/Src/Websocket.js +213 -0
  30. package/Extra/Src/image/checkmate.jpg +0 -0
  31. package/Extra/Src/test.js +28 -0
  32. package/Extra/Src/uuid.js +137 -0
  33. package/Func/AcceptAgreement.js +31 -0
  34. package/Func/ClearCache.js +64 -0
  35. package/Func/ReportV1.js +54 -0
  36. package/LICENSE +21 -0
  37. package/Language/index.json +222 -0
  38. package/Main.js +1266 -0
  39. package/README.md +152 -0
  40. package/SECURITY.md +18 -0
  41. package/broadcast.js +44 -0
  42. package/index.js +448 -0
  43. package/logger.js +66 -0
  44. package/package.json +94 -0
  45. package/src/Dev_Horizon_Data.js +125 -0
  46. package/src/Dev_getThreadInfoOLD.js +422 -0
  47. package/src/Dev_shareTest2.js +68 -0
  48. package/src/Dev_shareTest3.js +71 -0
  49. package/src/Premium.js +25 -0
  50. package/src/Screenshot.js +83 -0
  51. package/src/addExternalModule.js +16 -0
  52. package/src/addUserToGroup.js +79 -0
  53. package/src/changeAdminStatus.js +79 -0
  54. package/src/changeArchivedStatus.js +41 -0
  55. package/src/changeAvt.js +85 -0
  56. package/src/changeBio.js +65 -0
  57. package/src/changeBlockedStatus.js +36 -0
  58. package/src/changeGroupImage.js +106 -0
  59. package/src/changeNickname.js +45 -0
  60. package/src/changeThreadColor.js +62 -0
  61. package/src/changeThreadEmoji.js +42 -0
  62. package/src/createNewGroup.js +70 -0
  63. package/src/createPoll.js +60 -0
  64. package/src/deleteMessage.js +45 -0
  65. package/src/deleteThread.js +43 -0
  66. package/src/editMessage.js +53 -0
  67. package/src/forwardAttachment.js +48 -0
  68. package/src/getAccessToken.js +28 -0
  69. package/src/getCurrentUserID.js +7 -0
  70. package/src/getEmojiUrl.js +27 -0
  71. package/src/getFriendsList.js +73 -0
  72. package/src/getMessage.js +103 -0
  73. package/src/getThreadHistory.js +537 -0
  74. package/src/getThreadInfo.js +424 -0
  75. package/src/getThreadInfoOLD.js +422 -0
  76. package/src/getThreadList.js +213 -0
  77. package/src/getThreadMain.js +220 -0
  78. package/src/getThreadPictures.js +59 -0
  79. package/src/getUID.js +59 -0
  80. package/src/getUserID.js +62 -0
  81. package/src/getUserInfo.js +112 -0
  82. package/src/getUserInfoMain.js +65 -0
  83. package/src/getUserInfoV2.js +32 -0
  84. package/src/getUserInfoV3.js +63 -0
  85. package/src/getUserInfoV4.js +55 -0
  86. package/src/getUserInfoV5.js +61 -0
  87. package/src/handleFriendRequest.js +46 -0
  88. package/src/handleMessageRequest.js +49 -0
  89. package/src/httpGet.js +49 -0
  90. package/src/httpPost.js +48 -0
  91. package/src/httpPostFormData.js +41 -0
  92. package/src/listenMqtt.js +936 -0
  93. package/src/listenMqttV1.js +846 -0
  94. package/src/logout.js +68 -0
  95. package/src/markAsDelivered.js +48 -0
  96. package/src/markAsRead.js +70 -0
  97. package/src/markAsReadAll.js +43 -0
  98. package/src/markAsSeen.js +51 -0
  99. package/src/muteThread.js +47 -0
  100. package/src/removeUserFromGroup.js +49 -0
  101. package/src/resolvePhotoUrl.js +37 -0
  102. package/src/searchForThread.js +43 -0
  103. package/src/sendMessage.js +386 -0
  104. package/src/sendMqttMessage.js +71 -0
  105. package/src/sendTypingIndicator.js +80 -0
  106. package/src/setMessageReaction.js +109 -0
  107. package/src/setPostReaction.js +102 -0
  108. package/src/setTitle.js +74 -0
  109. package/src/shareContact.js +55 -0
  110. package/src/shareLink.js +58 -0
  111. package/src/threadColors.js +39 -0
  112. package/src/unfriend.js +43 -0
  113. package/src/unsendMessage.js +40 -0
  114. package/test/Database_Test.js +4 -0
  115. package/test/Db2.js +530 -0
  116. package/test/Horizon_Database/A_README.md +1 -0
  117. package/test/Horizon_Database/Database.db +0 -0
  118. package/test/data/shareAttach.js +146 -0
  119. package/test/data/something.mov +0 -0
  120. package/test/data/test.png +0 -0
  121. package/test/data/test.txt +7 -0
  122. package/test/env/.env +0 -0
  123. package/test/example-config.json +18 -0
  124. package/test/example-db.db +0 -0
  125. package/test/memoryleak.js +18 -0
  126. package/test/test-page.js +140 -0
  127. package/test/test.js +385 -0
  128. package/test/testname.js +1342 -0
  129. package/test/testv2.js +3 -0
  130. package/utils.js +3038 -0
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ [![Socket Badge](https://socket.dev/api/badge/npm/package/fca-horizon-remastered)](https://socket.dev/npm/package/fca-horizon-remastered)
2
+
3
+ # The following are not allowed here and a little note:
4
+
5
+ 🎆
6
+
7
+ ## Important !
8
+
9
+ <img width="517" alt="Reason" src="https://i.imgur.com/rD3ujmL.png">
10
+ This project is no longer being developed because the project owner lacks high security capabilities, leading to potential security vulnerabilities. Therefore, the project will be permanently suspended.
11
+
12
+ Special Thanks:
13
+ ![image](https://github.com/KanzuXHorizon/Fca-Horizon-Remastered/assets/125113101/0a455054-b7f4-499d-b4b6-c91fd0569ce4)
14
+
15
+ ## Important !
16
+
17
+ This package require NodeJS 14.17.0 to work properly.
18
+
19
+ ## Notification !
20
+
21
+ + We will have Example Video on Channel "Nguyễn Thái Hảo Official"
22
+
23
+ Original Project(Deprecated): https://github.com/Schmavery/facebook-chat-api
24
+
25
+ Chúc các bạn một ngày tốt lành!, cảm ơn vì đã sài Sản phẩm của HZI, thân ái
26
+
27
+ KANZUWAKAZAKI(15/04/2023)
28
+
29
+ ## Support For :
30
+
31
+ + Support English, VietNamese !,
32
+ + All bot if using listenMqtt first.
33
+
34
+ # Api Cho ChatBot Messenger
35
+
36
+ Facebook Đã Có Và Cho Người Dùng Tạo Api Cho Chatbots 😪 Tại Đey => [Đây Nè](https://developers.facebook.com/docs/messenger-platform).
37
+
38
+ ### Api Này Có Thể Khiến Cho Bạn Payy Acc Như Cách Acc Bạn Chưa Từng Có, Hãy Chú Ý Nhé =))
39
+
40
+ Lưu Ý ! Nếu Bạn Muốn Sài Api Này Hãy Xem Document Tại [Đây Nè](https://github.com/Schmavery/facebook-chat-api).
41
+
42
+ ## Tải Về
43
+
44
+ Nếu Bạn Muốn Sử Dụng, Hãy Tải Nó Bằng Cách:
45
+ ```bash
46
+ npm i fca-horizon-remastered
47
+ ```
48
+ or
49
+ ```bash
50
+ npm install fca-horizon-remastered
51
+ ```
52
+
53
+ Nó Sẽ Tải Vô node_modules (Lib Của Bạn) - Lưu Ý Replit Sẽ Không Hiện Đâu Mà Tìm 😪
54
+
55
+ ### Tải Bản Mới Nhất Hoặc Update
56
+
57
+ Nếu Bạn Muốn Sử Dụng Phiên Bản Mới Nhất Hay Cập Nhật Thì Hãy Vô Terminal Hoặc Command Promt Nhập :
58
+ ```bash
59
+ npm install fca-horizon-remastered@latest
60
+ ```
61
+ Hoặc
62
+ ```bash
63
+ npm i fca-horizon-remastered@latest
64
+ ```
65
+
66
+ ## Nếu Bạn Muốn Test Api
67
+
68
+ Lợi Ích Cho Việc Này Thì Bạn Sẽ Không Tốn Thời Gian Pay Acc Và Có Acc 😪
69
+ Hãy Sử Dụng Với Tài Khoản Thử Nghiệm => [Facebook Whitehat Accounts](https://www.facebook.com/whitehat/accounts/).
70
+
71
+ ## Cách Sử Dụng
72
+
73
+ ```javascript
74
+ const login = require("fca-horizon-remastered"); // lấy từ lib ra
75
+
76
+ // đăng nhập
77
+ login({email: "Gmail Account", password: "Mật Khẩu Facebook Của Bạn"}, (err, api) => {
78
+
79
+ if(err) return console.error(err); // trường hợp lỗi
80
+
81
+ // tạo bot tự động nhái theo bạn:
82
+ api.listenMqtt((err, message) => {
83
+ api.sendMessage(message.body, message.threadID);
84
+ });
85
+
86
+ });
87
+ ```
88
+
89
+ Kết Quả Là Nó Sẽ Nhái Bạn Như Hình Dưới:
90
+ <img width="517" alt="screen shot 2016-11-04 at 14 36 00" src="https://cloud.githubusercontent.com/assets/4534692/20023545/f8c24130-a29d-11e6-9ef7-47568bdbc1f2.png">
91
+
92
+ Nếu Bạn Muốn Sử Dụng Nâng Cao Thì Hãy Sử Dụng Các Loại Bot Được Liệt Kê Ở Trên !
93
+
94
+ ## Danh Sách
95
+
96
+ Bạn Có Thể Đọc Full Api Tại => [here](DOCS.md).
97
+
98
+ ## Cài Đặt Cho Mirai:
99
+
100
+ Bạn Cần Vô File Mirai.js,Sau Đó Tìm Đến Dòng
101
+ ```js
102
+ var login = require('tùy bot');
103
+ /* Có thể là :
104
+ var login = require('@maihuybao/fca-Unofficial');
105
+ var login = require('fca-xuyen-get');
106
+ var login = require('fca-unofficial-force');
107
+ ...
108
+ */
109
+ ```
110
+
111
+ Và Thay Nó Bằng:
112
+
113
+ ```js
114
+ var login = require('fca-horizon-remastered')
115
+ ```
116
+
117
+ Sau Đó Thì Chạy Bình Thường Thôi !
118
+
119
+ ## Tự Nghiên Cứu
120
+
121
+ Nếu Bạn Muốn Tự Nghiên Cứu Hoặc Tạo Bot Cho Riêng Bạn Thì Bạn Hãy Vô Cái Này Đọc Chức Năng Của Nó Và Cách Sử Dụng => [Link](https://github.com/Schmavery/facebook-chat-api#Unofficial%20Facebook%20Chat%20API)
122
+
123
+ ------------------------------------
124
+
125
+ ### Lưu Lại Thông Tin Đăng Nhập.
126
+
127
+ Để Lưu Lại Thì Bạn Cần 1 Apstate Kiểu (Cookie, etc,..) Để Lưu Lại Hoặc Là Sử Dụng Mã Login Như Trên Để Đăng Nhập !
128
+
129
+ Và Chế Độ Này Đã Có Sẵn Trong 1 Số Bot Việt Nam Nên Bạn Cứ Yên Tâm Nhé !
130
+
131
+ __Hướng Dẫn Với Appstate__
132
+
133
+ ```js
134
+ const fs = require("fs");
135
+ const login = require("fca-horizon-remastered");
136
+
137
+ var credentials = {email: "FB_EMAIL", password: "FB_PASSWORD"}; // thông tin tk
138
+
139
+ login(credentials, (err, api) => {
140
+ if(err) return console.error(err);
141
+ // đăng nhập
142
+ fs.writeFileSync('appstate.json', JSON.stringify(api.getAppState(), null,'\t')); //tạo appstate
143
+ });
144
+ ```
145
+
146
+ Hoặc Dễ Dàng Hơn ( Chuyên Nghiệp ) Bạn Có Thể Dùng => [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate) Để Lấy Fbstate And Rename Lại Thành Apstate Cũng Được ! (appstate.json)
147
+
148
+ ------------------------------------
149
+
150
+ ## FAQS
151
+
152
+ FAQS => [Link](https://github.com/Schmavery/facebook-chat-api#FAQS)
package/SECURITY.md ADDED
@@ -0,0 +1,18 @@
1
+ # Security Policy
2
+
3
+ + if have any Vulnerability finded contact: Author(KanzuWakazaki.Main@proton.me) or (Facebook.com/Lazic.Kanzu). Thanks!
4
+
5
+ ## Supported Versions
6
+
7
+ Use this section to tell people about which versions of your project are
8
+ currently being supported with security updates.
9
+
10
+ | Version | Supported |
11
+ | ------- | ------------------ |
12
+ | StableVersion | :white_check_mark: |
13
+ | AutoUpdate | :white_check_mark:|
14
+ | Modified | :x:
15
+
16
+ ## Reporting a Vulnerability
17
+
18
+ Contact Author or create pull!
package/broadcast.js ADDED
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ const logger = require('./logger');
4
+ const Fetch = require('got');
5
+
6
+ const broadcastConfig = {
7
+ enabled: false,
8
+ data: [],
9
+ };
10
+
11
+ const fetchBroadcastData = async () => {
12
+ try {
13
+ const response = await Fetch.get('https://raw.githubusercontent.com/KanzuXHorizon/Global_Horizon/main/Fca_BroadCast.json');
14
+ broadcastConfig.data = JSON.parse(response.body.toString());
15
+ return broadcastConfig.data;
16
+ } catch (error) {
17
+ logger.Error(`Failed to fetch broadcast data: ${error.message}`);
18
+ broadcastConfig.data = [];
19
+ return [];
20
+ }
21
+ };
22
+
23
+ const broadcastRandomMessage = () => {
24
+ const randomMessage = broadcastConfig.data.length > 0 ? broadcastConfig.data[Math.floor(Math.random() * broadcastConfig.data.length)] : 'Ae Zui Zẻ Nhé !';
25
+ logger.Normal(randomMessage);
26
+ };
27
+
28
+ const startBroadcasting = async (enabled) => {
29
+ enabled = global.Fca.Require.FastConfig.BroadCast
30
+
31
+ if (enabled) {
32
+ try {
33
+ await fetchBroadcastData();
34
+ broadcastRandomMessage();
35
+ setInterval(broadcastRandomMessage, 3600 * 1000);
36
+ } catch (error) {
37
+ logger.Error(`Failed to start broadcasting: ${error.message}`);
38
+ }
39
+ }
40
+ };
41
+
42
+ module.exports = {
43
+ startBroadcasting,
44
+ };
package/index.js ADDED
@@ -0,0 +1,448 @@
1
+ 'use strict';
2
+ /* eslint-disable linebreak-style */
3
+ const utils = require('./utils');
4
+ global.Fca = new Object({
5
+ isThread: new Array(),
6
+ isUser: new Array(),
7
+ startTime: Date.now(),
8
+ Setting: new Map(),
9
+ Version: require('./package.json').version,
10
+ Require: new Object({
11
+ fs: require("fs"),
12
+ Fetch: require('got'),
13
+ log: require("npmlog"),
14
+ utils: require("./utils.js"),
15
+ logger: require('./logger.js'),
16
+ languageFile: require('./Language/index.json'),
17
+ Security: require('./Extra/Src/uuid.js')
18
+ }),
19
+ getText: function(/** @type {any[]} */...Data) {
20
+ var Main = (Data.splice(0,1)).toString();
21
+ for (let i = 0; i < Data.length; i++) Main = Main.replace(RegExp(`%${i + 1}`, 'g'), Data[i]);
22
+ return Main;
23
+ },
24
+ Data: new Object({
25
+ ObjFastConfig: {
26
+ "Language": "vi",
27
+ "PreKey": "",
28
+ "AutoUpdate": true,
29
+ "MainColor": "#9900FF",
30
+ "MainName": "[ FCA-HZI ]",
31
+ "Uptime": false,
32
+ "Config": "default",
33
+ "DevMode": false,
34
+ "Login2Fa": false,
35
+ "AutoLogin": false,
36
+ "BroadCast": true,
37
+ "AuthString": "SD4S XQ32 O2JA WXB3 FUX2 OPJ7 Q7JZ 4R6Z | https://i.imgur.com/RAg3rvw.png Please remove this !, Recommend If You Using getUserInfoV2",
38
+ "EncryptFeature": true,
39
+ "ResetDataLogin": false,
40
+ "AutoInstallNode": false,
41
+ "AntiSendAppState": true,
42
+ "AutoRestartMinutes": 0,
43
+ "RestartMQTT_Minutes": 0,
44
+ "Websocket_Extension": {
45
+ "Status": false,
46
+ "ResetData": false,
47
+ "AppState_Path": "appstate.json"
48
+ },
49
+ "HTML": {
50
+ "HTML": true,
51
+ "UserName": "Guest",
52
+ "MusicLink": "https://drive.google.com/uc?id=1zlAALlxk1TnO7jXtEP_O6yvemtzA2ukA&export=download"
53
+ },
54
+ "AntiGetInfo": {
55
+ "Database_Type": "default", //json or default
56
+ "AntiGetThreadInfo": true,
57
+ "AntiGetUserInfo": true
58
+ },
59
+ "Stable_Version": {
60
+ "Accept": false,
61
+ "Version": ""
62
+ },
63
+ "CheckPointBypass": {
64
+ "956": {
65
+ "Allow": false,
66
+ "Difficult": "Easy",
67
+ "Notification": "Turn on with AutoLogin!"
68
+ }
69
+ },
70
+ "AntiStuckAndMemoryLeak": {
71
+ "AutoRestart": {
72
+ "Use": true,
73
+ "Explain": "When this feature is turned on, the system will continuously check and confirm that if memory usage reaches 90%, it will automatically restart to avoid freezing or stopping."
74
+ },
75
+ "LogFile": {
76
+ "Use": false,
77
+ "Explain": "Record memory usage logs to fix errors. Default location: Horizon_Database/memory.logs"
78
+ }
79
+ }
80
+ },
81
+ CountTime: function() {
82
+ var fs = global.Fca.Require.fs;
83
+ if (fs.existsSync(__dirname + '/CountTime.json')) {
84
+ try {
85
+ var data = Number(fs.readFileSync(__dirname + '/CountTime.json', 'utf8')),
86
+ hours = Math.floor(data / (60 * 60));
87
+ }
88
+ catch (e) {
89
+ fs.writeFileSync(__dirname + '/CountTime.json', 0);
90
+ hours = 0;
91
+ }
92
+ }
93
+ else {
94
+ hours = 0;
95
+ }
96
+ return `${hours} Hours`;
97
+ }
98
+ }),
99
+ Action: async function(Type, ctx, Code, defaultFuncs) {
100
+ switch (Type) {
101
+ case "AutoLogin": {
102
+ var Database = require('./Extra/Database');
103
+ var logger = global.Fca.Require.logger;
104
+ var Email = (Database().get('Account')).replace(RegExp('"', 'g'), ''); //hmm IDK
105
+ var PassWord = (Database().get('Password')).replace(RegExp('"', 'g'), '');
106
+ require('./Main')({ email: Email, password: PassWord},async (error, api) => {
107
+ if (error) {
108
+ logger.Error(JSON.stringify(error,null,2), function() { logger.Error("AutoLogin Failed!", function() { process.exit(0); }) });
109
+ }
110
+ try {
111
+ Database().set("TempState", Database().get('Through2Fa'));
112
+ }
113
+ catch(e) {
114
+ logger.Warning(global.Fca.Require.Language.Index.ErrDatabase);
115
+ logger.Error();
116
+ process.exit(0);
117
+ }
118
+ process.exit(1);
119
+ });
120
+ }
121
+ break;
122
+ case "Bypass": {
123
+ const Bypass_Module = require(`./Extra/Bypass/${Code}`);
124
+ const logger = global.Fca.Require.logger;
125
+ switch (Code) {
126
+ case 956: {
127
+ async function P1() {
128
+ return new Promise((resolve, reject) => {
129
+ try {
130
+ utils.get('https://www.facebook.com/checkpoint/828281030927956/?next=https%3A%2F%2Faccountscenter.facebook.com%2Fpassword_and_security', ctx.jar, null, ctx.globalOptions).then(function(data) {
131
+ resolve(Bypass_Module.Check(data.body));
132
+ })
133
+ }
134
+ catch (error) {
135
+ reject(error);
136
+ }
137
+ })
138
+ }
139
+ try {
140
+ const test = await P1();
141
+ if (test != null && test != '' && test != undefined) {
142
+ const resp = await Bypass_Module.Cook_And_Work(ctx, defaultFuncs)
143
+ if (resp == true) return logger.Success("Bypassing 956 successfully!", function() { return process.exit(1); })
144
+ else return logger.Error("Bypass 956 failed ! DO YOUR SELF :>", function() { process.exit(0) });
145
+ }
146
+ }
147
+ catch (e) {
148
+ logger.Error("Bypass 956 failed ! DO YOUR SELF :>", function() { process.exit(0) })
149
+ }
150
+ }
151
+ }
152
+ }
153
+ break;
154
+ default: {
155
+ require('npmlog').Error("Invalid Message!");
156
+ };
157
+ }
158
+ }
159
+ });
160
+
161
+ try {
162
+ let Boolean_Fca = ["AntiSendAppState","AutoUpdate","Uptime","BroadCast","EncryptFeature","AutoLogin","ResetDataLogin","Login2Fa", "DevMode","AutoInstallNode"];
163
+ let String_Fca = ["MainName","PreKey","Language","AuthString","Config"]
164
+ let Number_Fca = ["AutoRestartMinutes","RestartMQTT_Minutes"];
165
+ let Object_Fca = ["HTML","Stable_Version","AntiGetInfo","Websocket_Extension", "CheckPointBypass", "AntiStuckAndMemoryLeak"];
166
+ let All_Variable = Boolean_Fca.concat(String_Fca,Number_Fca,Object_Fca);
167
+
168
+
169
+ if (!global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
170
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
171
+ process.exit(1);
172
+ }
173
+
174
+ try {
175
+ var Data_Setting = require(process.cwd() + "/FastConfigFca.json");
176
+ }
177
+ catch (e) {
178
+ global.Fca.Require.logger.Error('Detect Your FastConfigFca Settings Invalid!, Carry out default restoration');
179
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
180
+ process.exit(1)
181
+ }
182
+ if (global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
183
+
184
+ for (let i of All_Variable) {
185
+ if (Data_Setting[i] == undefined) {
186
+ Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
187
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
188
+ }
189
+ else continue;
190
+ } //Check Variable
191
+
192
+ for (let i in Data_Setting) {
193
+ if (Boolean_Fca.includes(i)) {
194
+ if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Boolean") logger.Error(i + " Is Not A Boolean, Need To Be true Or false !", function() { process.exit(0) });
195
+ else continue;
196
+ }
197
+ else if (String_Fca.includes(i)) {
198
+ if (global.Fca.Require.utils.getType(Data_Setting[i]) != "String") logger.Error(i + " Is Not A String, Need To Be String!", function() { process.exit(0) });
199
+ else continue;
200
+ }
201
+ else if (Number_Fca.includes(i)) {
202
+ if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Number") logger.Error(i + " Is Not A Number, Need To Be Number !", function() { process.exit(0) });
203
+ else continue;
204
+ }
205
+ else if (Object_Fca.includes(i)) {
206
+ if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Object") {
207
+ Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
208
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
209
+ }
210
+ else continue;
211
+ }
212
+ }
213
+
214
+ for (let i of Object_Fca) {
215
+ const All_Paths = utils.getPaths(global.Fca.Data.ObjFastConfig[i]);
216
+ const Mission = { Main_Path: i, Data_Path: All_Paths }
217
+ for (let i of Mission.Data_Path) {
218
+ if (Data_Setting[Mission.Main_Path] == undefined) {
219
+ Data_Setting[Mission.Main_Path] = global.Fca.Data.ObjFastConfig[Mission.Main_Path];
220
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
221
+ }
222
+ const User_Data = (utils.getData_Path(Data_Setting[Mission.Main_Path], i, 0))
223
+ const User_Data_Type = utils.getType(User_Data);
224
+ if (User_Data_Type == "Number") {
225
+ const Mission_Path = User_Data == 0 ? i : i.slice(0, User_Data);
226
+ const Mission_Obj = utils.getData_Path(global.Fca.Data.ObjFastConfig[Mission.Main_Path], Mission_Path, 0);
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() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
229
+ }
230
+ }
231
+ }
232
+
233
+ if (!global.Fca.Require.languageFile.some((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language)) {
234
+ global.Fca.Require.logger.Warning("Not Support Language: " + Data_Setting.Language + " Only 'en' and 'vi'");
235
+ process.exit(0);
236
+ }
237
+ global.Fca.Require.Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language).Folder;
238
+ } else process.exit(1);
239
+ global.Fca.Require.FastConfig = Data_Setting;
240
+ }
241
+ catch (e) {
242
+ console.log(e);
243
+ global.Fca.Require.logger.Error();
244
+ }
245
+
246
+ /*
247
+ if (global.Fca.Require.FastConfig.Websocket_Extension.Status) {
248
+ console.history = new Array();
249
+ var Convert = require('ansi-to-html');
250
+ var convert = new Convert();
251
+ console.__log = console.log;
252
+ console.log = function (data) {
253
+ const log = convert.toHtml(data)
254
+ console.history.push(log)
255
+ console.__log.apply(console,arguments)
256
+ if (console.history.length > 80) {
257
+ console.history.shift();
258
+ }
259
+ }
260
+ }
261
+ **/
262
+
263
+ module.exports = function(loginData, options, callback) {
264
+ //const Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == global.Fca.Require.FastConfig.Language).Folder.Index;
265
+ var login;
266
+ try {
267
+ login = require('./Main');
268
+ }
269
+ catch (e) {
270
+ console.log(e)
271
+ }
272
+ //const fs = require('fs-extra');
273
+ //const got = require('got');
274
+ //const log = require('npmlog');
275
+ //const { execSync } = require('child_process');
276
+ require('./Extra/Database');
277
+
278
+ /*
279
+ return got.get('https://github.com/KanzuXHorizon/Global_Horizon/raw/main/InstantAction.json').then(async function(res) {
280
+ if (global.Fca.Require.FastConfig.AutoInstallNode) {
281
+ switch (fs.existsSync(process.cwd() + "/replit.nix") && process.env["REPL_ID"] != undefined) {
282
+ case true: {
283
+ await require('./Extra/Src/Change_Environment.js')();
284
+ break;
285
+ }
286
+ case false: {
287
+ const NodeVersion = execSync('node -v').toString().replace(/(\r\n|\n|\r)/gm, "");
288
+ if (!NodeVersion.includes("v14") && !NodeVersion.includes("v16") && !Database(true).has('SkipReplitNix')) {
289
+ log.warn("[ FCA-UPDATE ] •",global.Fca.getText(Language.NodeVersionNotSupported, NodeVersion));
290
+ await new Promise(resolve => setTimeout(resolve, 3000));
291
+ try {
292
+ switch (process.platform) {
293
+ case "win32": {
294
+ try {
295
+ //check if user using nvm
296
+ if (fs.existsSync(process.env.APPDATA + "/nvm/nvm.exe")) {
297
+ log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
298
+ process.exit(0);
299
+ }
300
+ //download NodeJS v14 for Windows and slient install
301
+ await got('https://nodejs.org/dist/v14.17.0/node-v14.17.0-x64.msi').pipe(fs.createWriteStream(process.cwd() + "/node-v14.17.0-x64.msi"));
302
+ log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
303
+ await new Promise(resolve => setTimeout(resolve, 3000));
304
+ execSync('msiexec /i node-v14.17.0-x64.msi /qn');
305
+ log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
306
+ await new Promise(resolve => setTimeout(resolve, 3000));
307
+ log.info("[ FCA-UPDATE ] •", Language.RestartRequire);
308
+ Database(true).set("NeedRebuild", true);
309
+ process.exit(0);
310
+ }
311
+ catch (e) {
312
+ log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
313
+ process.exit(0);
314
+ }
315
+ }
316
+ case "linux": {
317
+
318
+ try {
319
+ if (process.env["REPL_ID"] != undefined) {
320
+ log.warn("[ FCA-UPDATE ] •", "Look like you are using Replit, and didn't have replit.nix file in your project, i don't know how to help you, hmm i will help you pass this step, but you need to install NodeJS v14 by yourself, and restart your repl");
321
+ Database(true).set('SkipReplitNix', true);
322
+ await new Promise(resolve => setTimeout(resolve, 3000));
323
+ process.exit(1);
324
+ }
325
+ //check if user using nvm
326
+ if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
327
+ log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
328
+ process.exit(0);
329
+ }
330
+ //download NodeJS v14 for Linux and slient install
331
+ await got('https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz').pipe(fs.createWriteStream(process.cwd() + "/node-v14.17.0-linux-x64.tar.xz"));
332
+ log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
333
+ await new Promise(resolve => setTimeout(resolve, 3000));
334
+ execSync('tar -xf node-v14.17.0-linux-x64.tar.xz');
335
+ execSync('cd node-v14.17.0-linux-x64');
336
+ execSync('sudo cp -R * /usr/local/');
337
+ log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
338
+ await new Promise(resolve => setTimeout(resolve, 3000));
339
+ log.info("[ FCA-UPDATE ] •",Language.RestartingN);
340
+ Database(true).set("NeedRebuild", true);
341
+ process.exit(1);
342
+ }
343
+ catch (e) {
344
+ log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
345
+ process.exit(0);
346
+ }
347
+ }
348
+ case "darwin": {
349
+ try {
350
+ //check if user using nvm
351
+ if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
352
+ log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
353
+ process.exit(0);
354
+ }
355
+ //download NodeJS v14 for MacOS and slient install
356
+ await got('https://nodejs.org/dist/v14.17.0/node-v14.17.0-darwin-x64.tar.gz').pipe(fs.createWriteStream(process.cwd() + "/node-v14.17.0-darwin-x64.tar.gz"));
357
+ log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
358
+ await new Promise(resolve => setTimeout(resolve, 3000));
359
+ execSync('tar -xf node-v14.17.0-darwin-x64.tar.gz');
360
+ execSync('cd node-v14.17.0-darwin-x64');
361
+ execSync('sudo cp -R * /usr/local/');
362
+ log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
363
+ await new Promise(resolve => setTimeout(resolve, 3000));
364
+ log.info("[ FCA-UPDATE ] •",Language.RestartingN);
365
+ Database(true).set("NeedRebuild", true);
366
+ process.exit(1);
367
+ }
368
+ catch (e) {
369
+ log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
370
+ process.exit(0);
371
+ }
372
+ }
373
+ }
374
+ }
375
+ catch (e) {
376
+ console.log(e);
377
+ log.error("[ FCA-UPDATE ] •","NodeJS v14 Installation Failed, Please Try Again and Contact fb.com/Lazic.Kanzu!");
378
+ process.exit(0);
379
+ }
380
+ }
381
+ }
382
+ }
383
+ }
384
+ if ((Database(true).get("NeedRebuild")) == true) {
385
+ Database(true).set("NeedRebuild", false);
386
+ log.info("[ FCA-UPDATE ] •",Language.Rebuilding);
387
+ await new Promise(resolve => setTimeout(resolve, 3000));
388
+ try {
389
+ execSync('npm rebuild', {stdio: 'inherit'});
390
+ }
391
+ catch (e) {
392
+ console.log(e);
393
+ log.error("[ FCA-UPDATE ] •",Language.ErrRebuilding);
394
+ }
395
+ log.info("[ FCA-UPDATE ] •",Language.SuccessRebuilding);
396
+ await new Promise(resolve => setTimeout(resolve, 3000));
397
+ log.info("[ FCA-UPDATE ] •",Language.RestartingN);
398
+ process.exit(1);
399
+ }
400
+
401
+ let Data = JSON.parse(res.body);
402
+ if (global.Fca.Require.FastConfig.Stable_Version.Accept == true) {
403
+ if (Data.Stable_Version.Valid_Version.includes(global.Fca.Require.FastConfig.Stable_Version.Version)) {
404
+ let TimeStamp = Database(true).get('Check_Update');
405
+ if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
406
+ var Check_Update = require('./Extra/Src/Check_Update.js');
407
+ await Check_Update(global.Fca.Require.FastConfig.Stable_Version.Version);
408
+ }
409
+ }
410
+ else {
411
+ log.warn("[ FCA-UPDATE ] •", "Error Stable Version, Please Check Your Stable Version in FastConfig.json, Automatically turn off Stable Version!");
412
+ global.Fca.Require.FastConfig.Stable_Version.Accept = false;
413
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
414
+ process.exit(1);
415
+ }
416
+ }
417
+ else {
418
+ if (Data.HasProblem == true || Data.ForceUpdate == true) {
419
+ let TimeStamp = Database(true).get('Instant_Update');
420
+ if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 500) {
421
+ var Instant_Update = require('./Extra/Src/Instant_Update.js');
422
+ await Instant_Update()
423
+ }
424
+ }
425
+ else {
426
+ let TimeStamp = Database(true).get('Check_Update');
427
+ if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
428
+ var Check_Update = require('./Extra/Src/Check_Update.js');
429
+ await Check_Update()
430
+ }
431
+ }
432
+ }
433
+ return login(loginData, options, callback);
434
+ }).catch(function(err) {
435
+ console.log(err)
436
+ log.error("[ FCA-UPDATE ] •",Language.UnableToConnect);
437
+ log.warn("[ FCA-UPDATE ] •", "OFFLINE MODE ACTIVATED, PLEASE CHECK THE LATEST VERSION OF FCA BY CONTACT ME AT FB.COM/LAZIC.KANZU");
438
+ return login(loginData, options, callback);
439
+ });
440
+ **/
441
+ //temp disabled
442
+ try {
443
+ login(loginData, options, callback);
444
+ }
445
+ catch (e) {
446
+ console.log(e)
447
+ }
448
+ };