fca-donqdev 0.0.1-security → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fca-donqdev might be problematic. Click here for more details.

Files changed (115) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.config/configstore/update-notifier-npm.json +4 -0
  3. package/.config/configstore/update-notifier-npm.json.1735545094 +4 -0
  4. package/.gitattributes +2 -0
  5. package/.replit +80 -0
  6. package/Extra/Database/index.js +469 -0
  7. package/Extra/ExtraAddons.js +82 -0
  8. package/Extra/ExtraFindUID.js +62 -0
  9. package/Extra/ExtraGetThread.js +340 -0
  10. package/Extra/ExtraScreenShot.js +430 -0
  11. package/Extra/ExtraUptimeRobot.js +38 -0
  12. package/Extra/Html/Classic/script.js +119 -0
  13. package/Extra/Html/Classic/style.css +8 -0
  14. package/Extra/Security/Index.js +173 -0
  15. package/Extra/Security/Step_1.js +6 -0
  16. package/Extra/Security/Step_2.js +22 -0
  17. package/Extra/Security/Step_3.js +22 -0
  18. package/Extra/Src/Change_Environment.js +24 -0
  19. package/Extra/Src/Check_Update.js +67 -0
  20. package/Extra/Src/History.js +115 -0
  21. package/Extra/Src/Instant_Update.js +65 -0
  22. package/Extra/Src/Last-Run.js +65 -0
  23. package/Extra/Src/Premium.js +81 -0
  24. package/Extra/Src/Release_Memory.js +41 -0
  25. package/Extra/Src/Websocket.js +213 -0
  26. package/Extra/Src/image/checkmate.jpg +0 -0
  27. package/Extra/Src/uuid.js +137 -0
  28. package/Func/AcceptAgreement.js +31 -0
  29. package/Func/ClearCache.js +64 -0
  30. package/Func/ReportV1.js +54 -0
  31. package/LICENSE +21 -0
  32. package/Language/index.json +217 -0
  33. package/Main.js +1192 -0
  34. package/README.md +116 -3
  35. package/broadcast.js +40 -0
  36. package/index.js +379 -0
  37. package/logger.js +66 -0
  38. package/package.json +90 -3
  39. package/replit.nix +8 -0
  40. package/src/Dev_Horizon_Data.js +125 -0
  41. package/src/Premium.js +25 -0
  42. package/src/Screenshot.js +83 -0
  43. package/src/addExternalModule.js +16 -0
  44. package/src/addUserToGroup.js +79 -0
  45. package/src/changeAdminStatus.js +79 -0
  46. package/src/changeArchivedStatus.js +41 -0
  47. package/src/changeAvt.js +85 -0
  48. package/src/changeBio.js +65 -0
  49. package/src/changeBlockedStatus.js +36 -0
  50. package/src/changeGroupImage.js +106 -0
  51. package/src/changeNickname.js +45 -0
  52. package/src/changeThreadColor.js +62 -0
  53. package/src/changeThreadEmoji.js +42 -0
  54. package/src/createNewGroup.js +70 -0
  55. package/src/createPoll.js +60 -0
  56. package/src/deleteMessage.js +45 -0
  57. package/src/deleteThread.js +43 -0
  58. package/src/forwardAttachment.js +48 -0
  59. package/src/getAccessToken.js +28 -0
  60. package/src/getCurrentUserID.js +7 -0
  61. package/src/getEmojiUrl.js +27 -0
  62. package/src/getFriendsList.js +73 -0
  63. package/src/getMessage.js +80 -0
  64. package/src/getThreadHistory.js +537 -0
  65. package/src/getThreadInfo.js +425 -0
  66. package/src/getThreadList.js +213 -0
  67. package/src/getThreadMain.js +220 -0
  68. package/src/getThreadPictures.js +59 -0
  69. package/src/getUID.js +59 -0
  70. package/src/getUserID.js +62 -0
  71. package/src/getUserInfo.js +113 -0
  72. package/src/getUserInfoMain.js +65 -0
  73. package/src/getUserInfoV2.js +32 -0
  74. package/src/getUserInfoV3.js +63 -0
  75. package/src/getUserInfoV4.js +55 -0
  76. package/src/getUserInfoV5.js +61 -0
  77. package/src/handleFriendRequest.js +46 -0
  78. package/src/handleMessageRequest.js +49 -0
  79. package/src/httpGet.js +49 -0
  80. package/src/httpPost.js +48 -0
  81. package/src/httpPostFormData.js +41 -0
  82. package/src/listenMqtt.js +787 -0
  83. package/src/logout.js +68 -0
  84. package/src/markAsDelivered.js +48 -0
  85. package/src/markAsRead.js +70 -0
  86. package/src/markAsReadAll.js +43 -0
  87. package/src/markAsSeen.js +51 -0
  88. package/src/muteThread.js +47 -0
  89. package/src/removeUserFromGroup.js +49 -0
  90. package/src/resolvePhotoUrl.js +37 -0
  91. package/src/searchForThread.js +43 -0
  92. package/src/sendMessage.js +379 -0
  93. package/src/sendTypingIndicator.js +80 -0
  94. package/src/setMessageReaction.js +109 -0
  95. package/src/setPostReaction.js +102 -0
  96. package/src/setTitle.js +74 -0
  97. package/src/threadColors.js +39 -0
  98. package/src/unfriend.js +43 -0
  99. package/src/unsendMessage.js +40 -0
  100. package/test/Database_Test.js +4 -0
  101. package/test/Db2.js +530 -0
  102. package/test/Horizon_Database/A_README.md +1 -0
  103. package/test/Horizon_Database/Database.db +0 -0
  104. package/test/data/shareAttach.js +146 -0
  105. package/test/data/something.mov +0 -0
  106. package/test/data/test.png +0 -0
  107. package/test/data/test.txt +7 -0
  108. package/test/env/.env +0 -0
  109. package/test/example-config.json +18 -0
  110. package/test/example-db.db +0 -0
  111. package/test/memoryleak.js +18 -0
  112. package/test/test-page.js +140 -0
  113. package/test/test.js +385 -0
  114. package/test/testv2.js +18 -0
  115. package/utils.js +1684 -0
package/README.md CHANGED
@@ -1,5 +1,118 @@
1
- # Security holding package
1
+ ## Notification !
2
2
 
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
3
+ + Lưu Ý! Đây Sản Phẩm Được MDong Duy Trì Phát Triển ( Fca Được Mod Lại Từ Scr Của Fca-Horizon-Remastered ),Tác Giả Không Chịu Trách Nghiệm Nào!, Nếu Có Lỗi Hãy Thử Sử Dụng Sang Sản Phẩm Khác!
4
4
 
5
- Please refer to www.npmjs.com/advisories?search=fca-donqdev for more information.
5
+ # Api Cho ChatBot Messenger
6
+
7
+ 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).
8
+
9
+ ### 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é =))
10
+
11
+ 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).
12
+
13
+ ## Tải Về
14
+
15
+ Nếu Bạn Muốn Sử Dụng, Hãy Tải Nó Bằng Cách:
16
+ ```bash
17
+ npm i fca-donqdev
18
+ ```
19
+ or
20
+ ```bash
21
+ npm install fca-donqdev
22
+ ```
23
+
24
+
25
+ ### Tải Bản Mới Nhất Hoặc Update
26
+
27
+ 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 :
28
+ ```bash
29
+ npm install fca-donqdev@latest
30
+ ```
31
+ Hoặc
32
+ ```bash
33
+ npm i fca-donqdev@latest
34
+ ```
35
+
36
+ ## Nếu Bạn Muốn Test Api
37
+
38
+ Lợi Ích Cho Việc Này Thì Bạn Sẽ Không Tốn Thời Gian Pay Acc Và Có Acc 😪
39
+ Hãy Sử Dụng Với Tài Khoản Thử Nghiệm => [Facebook Whitehat Accounts](https://www.facebook.com/whitehat/accounts/).
40
+
41
+ ## Cách Sử Dụng
42
+
43
+ ```javascript
44
+ const login = require("fca-dongqdev"); // lấy từ lib ra
45
+
46
+ // đăng nhập
47
+ login({email: "Gmail Account", password: "Mật Khẩu Facebook Của Bạn"}, (err, api) => {
48
+
49
+ if(err) return console.error(err); // trường hợp lỗi
50
+
51
+ // tạo bot tự động nhái theo bạn:
52
+ api.listenMqtt((err, message) => {
53
+ api.sendMessage(message.body, message.threadID);
54
+ });
55
+
56
+ });
57
+ ```
58
+
59
+ Kết Quả Là Nó Sẽ Nhái Bạn Như Hình Dưới:
60
+ <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">
61
+
62
+ 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 !
63
+
64
+ ## Cài Đặt Cho Mirai:
65
+
66
+ Bạn Cần Vô File Mirai.js,Sau Đó Tìm Đến Dòng
67
+ ```js
68
+ var login = require('tùy bot');
69
+ /* Có thể là :
70
+ var login = require('@maihuybao/fca-Unofficial');
71
+ var login = require('fca-xuyen-get');
72
+ var login = require('fca-unofficial-force');
73
+ ...
74
+ */
75
+ ```
76
+
77
+ Và Thay Nó Bằng:
78
+
79
+ ```js
80
+ var login = require('fca-donqdev')
81
+ ```
82
+
83
+ Sau Đó Thì Chạy Bình Thường Thôi !
84
+
85
+ ## Tự Nghiên Cứu
86
+
87
+ 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)
88
+
89
+ ------------------------------------
90
+
91
+ ### Lưu Lại Thông Tin Đăng Nhập.
92
+
93
+ Để 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 !
94
+
95
+ Và Chế Độ Này Đã Có Sẵn Trong 1 Số Bot Việt Nam Nên Bạn Cứ Yên Tâm Nhé !
96
+
97
+ __Hướng Dẫn Với Appstate__
98
+
99
+ ```js
100
+ const fs = require("fs");
101
+ const login = require("fca-donqdev");
102
+
103
+ var credentials = {email: "FB_EMAIL", password: "FB_PASSWORD"}; // thông tin tk
104
+
105
+ login(credentials, (err, api) => {
106
+ if(err) return console.error(err);
107
+ // đăng nhập
108
+ fs.writeFileSync('appstate.json', JSON.stringify(api.getAppState(), null,'\t')); //tạo appstate
109
+ });
110
+ ```
111
+
112
+ 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)
113
+
114
+ ------------------------------------
115
+
116
+ ## FAQS
117
+
118
+ FAQS => [Link](https://github.com/Schmavery/facebook-chat-api#FAQS)
package/broadcast.js ADDED
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ switch (global.Fca.Require.FastConfig.BroadCast) {
4
+ case true: {
5
+ try {
6
+ var logger = global.Fca.Require.logger;
7
+ var Fetch = global.Fca.Require.Fetch;
8
+ Fetch.get("https://raw.githubusercontent.com/MDong-06/Global_MDZ/main/Fca_BroadCast.json").then(async (/** @type {{ body: { toString: () => string; }; }} */ res) => {
9
+ global.Fca.Data.BroadCast = JSON.parse(res.body.toString())
10
+ var random = JSON.parse(res.body.toString())[Math.floor(Math.random() * JSON.parse(res.body.toString()).length)] || "Ae Zui Zẻ Nhé !";
11
+ logger.Normal(random);
12
+ });
13
+ }
14
+ catch (e) {
15
+ console.log(e);
16
+ }
17
+ return setInterval(() => {
18
+ try {
19
+ try {
20
+ var logger = global.Fca.Require.logger;
21
+ var random = global.Fca.Data.BroadCast[Math.floor(Math.random() * global.Fca.Data.BroadCast.length)] || "Ae Zui Zẻ Nhé !";
22
+ logger.Normal(random);
23
+ }
24
+ catch (e) {
25
+ console.log(e);
26
+ return;
27
+ }
28
+ }
29
+ catch (e) {
30
+ console.log(e);
31
+ }
32
+ },3600 * 1000);
33
+ }
34
+ case false: {
35
+ break;
36
+ }
37
+ default: {
38
+ break;
39
+ }
40
+ }
package/index.js ADDED
@@ -0,0 +1,379 @@
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": "#00FFFF",
30
+ "MainName": "[ FCA-DONG ]",
31
+ "Uptime": true,
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
+ "AntiGetInfo": {
51
+ "Database_Type": "default", //json or default
52
+ "AntiGetThreadInfo": true,
53
+ "AntiGetUserInfo": true
54
+ },
55
+ "Stable_Version": {
56
+ "Accept": false,
57
+ "Version": ""
58
+ }
59
+ },
60
+ CountTime: function() {
61
+ var fs = global.Fca.Require.fs;
62
+ if (fs.existsSync(__dirname + '/CountTime.json')) {
63
+ try {
64
+ var data = Number(fs.readFileSync(__dirname + '/CountTime.json', 'utf8')),
65
+ hours = Math.floor(data / (60 * 60));
66
+ }
67
+ catch (e) {
68
+ fs.writeFileSync(__dirname + '/CountTime.json', 0);
69
+ hours = 0;
70
+ }
71
+ }
72
+ else {
73
+ hours = 0;
74
+ }
75
+ return `${hours} Hours`;
76
+ }
77
+ }),
78
+ Action: function(Type) {
79
+ switch (Type) {
80
+ case "AutoLogin": {
81
+ var Database = require('./Extra/Database');
82
+ var logger = global.Fca.Require.logger;
83
+ var Email = (Database().get('Account')).replace(RegExp('"', 'g'), ''); //hmm IDK
84
+ var PassWord = (Database().get('Password')).replace(RegExp('"', 'g'), '');
85
+ require('./Main')({ email: Email, password: PassWord},async (error, api) => {
86
+ if (error) {
87
+ logger.Error(JSON.stringify(error,null,2), function() { logger.Error("AutoLogin Failed!", function() { process.exit(0); }) });
88
+ }
89
+ try {
90
+ Database().set("TempState", Database().get('Through2Fa'));
91
+ }
92
+ catch(e) {
93
+ logger.Warning(global.Fca.Require.Language.Index.ErrDatabase);
94
+ logger.Error();
95
+ process.exit(0);
96
+ }
97
+ process.exit(1);
98
+ });
99
+ }
100
+ break;
101
+ default: {
102
+ require('npmlog').Error("Invalid Message!");
103
+ };
104
+ }
105
+ }
106
+ });
107
+
108
+ try {
109
+ let Boolean_Fca = ["AntiSendAppState","AutoUpdate","Uptime","BroadCast","EncryptFeature","AutoLogin","ResetDataLogin","Login2Fa", "DevMode","AutoInstallNode"];
110
+ let String_Fca = ["MainName","PreKey","Language","AuthString","Config"]
111
+ let Number_Fca = ["AutoRestartMinutes","RestartMQTT_Minutes"];
112
+ let Object_Fca = ["HTML","Stable_Version","AntiGetInfo","Websocket_Extension"];
113
+ let All_Variable = Boolean_Fca.concat(String_Fca,Number_Fca,Object_Fca);
114
+
115
+
116
+ if (!global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
117
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
118
+ process.exit(1);
119
+ }
120
+
121
+ try {
122
+ var Data_Setting = require(process.cwd() + "/FastConfigFca.json");
123
+ }
124
+ catch (e) {
125
+ global.Fca.Require.logger.Error('Detect Your FastConfigFca Settings Invalid!, Carry out default restoration');
126
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
127
+ process.exit(1)
128
+ }
129
+ if (global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
130
+
131
+ for (let i of All_Variable) {
132
+ if (Data_Setting[i] == undefined) {
133
+ Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
134
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
135
+ }
136
+ else continue;
137
+ } //Check Variable
138
+
139
+ for (let i in Data_Setting) {
140
+ if (Boolean_Fca.includes(i)) {
141
+ 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) });
142
+ else continue;
143
+ }
144
+ else if (String_Fca.includes(i)) {
145
+ 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) });
146
+ else continue;
147
+ }
148
+ else if (Number_Fca.includes(i)) {
149
+ 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) });
150
+ else continue;
151
+ }
152
+ else if (Object_Fca.includes(i)) {
153
+ if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Object") {
154
+ Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
155
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
156
+ }
157
+ else continue;
158
+ }
159
+ }
160
+
161
+ for (let i of Object_Fca) {
162
+ const All_Paths = utils.getPaths(global.Fca.Data.ObjFastConfig[i]);
163
+ const Mission = { Main_Path: i, Data_Path: All_Paths }
164
+ for (let i of Mission.Data_Path) {
165
+ if (Data_Setting[Mission.Main_Path] == undefined) {
166
+ Data_Setting[Mission.Main_Path] = global.Fca.Data.ObjFastConfig[Mission.Main_Path];
167
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
168
+ }
169
+ const User_Data = (utils.getData_Path(Data_Setting[Mission.Main_Path], i, 0))
170
+ const User_Data_Type = utils.getType(User_Data);
171
+ if (User_Data_Type == "Number") {
172
+ const Mission_Path = User_Data == 0 ? i : i.slice(0, User_Data);
173
+ const Mission_Obj = utils.getData_Path(global.Fca.Data.ObjFastConfig[Mission.Main_Path], Mission_Path, 0);
174
+ Data_Setting[Mission.Main_Path] = utils.setData_Path(Data_Setting[Mission.Main_Path], Mission_Path, Mission_Obj)
175
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
176
+ }
177
+ }
178
+ }
179
+
180
+ if (!global.Fca.Require.languageFile.some((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language)) {
181
+ global.Fca.Require.logger.Warning("Not Support Language: " + Data_Setting.Language + " Only 'en' and 'vi'");
182
+ process.exit(0);
183
+ }
184
+ global.Fca.Require.Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language).Folder;
185
+ } else process.exit(1);
186
+ global.Fca.Require.FastConfig = Data_Setting;
187
+ }
188
+ catch (e) {
189
+ console.log(e);
190
+ global.Fca.Require.logger.Error();
191
+ }
192
+
193
+ if (global.Fca.Require.FastConfig.Websocket_Extension.Status) {
194
+ console.history = new Array();
195
+ var Convert = require('ansi-to-html');
196
+ var convert = new Convert();
197
+ console.__log = console.log;
198
+ console.log = function (data) {
199
+ const log = convert.toHtml(data)
200
+ console.history.push(log)
201
+ console.__log.apply(console,arguments)
202
+ }
203
+ }
204
+
205
+ module.exports = function(loginData, options, callback) {
206
+ const Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == global.Fca.Require.FastConfig.Language).Folder.Index;
207
+ const login = require('./Main');
208
+ const fs = require('fs-extra');
209
+ const got = require('got');
210
+ const log = require('npmlog');
211
+ const { execSync } = require('child_process');
212
+ const Database = require('./Extra/Database');
213
+
214
+ if (global.Fca.Require.FastConfig.DevMode) {
215
+ require('./Extra/Src/Release_Memory');
216
+ }
217
+
218
+ return got.get('https://github.com/MDong-06/Global_MDZ/raw/main/InstantAction.json').then(async function(res) {
219
+ if (global.Fca.Require.FastConfig.AutoInstallNode) {
220
+ switch (fs.existsSync(process.cwd() + "/replit.nix") && process.env["REPL_ID"] != undefined) {
221
+ case true: {
222
+ await require('./Extra/Src/Change_Environment.js')();
223
+ break;
224
+ }
225
+ case false: {
226
+ const NodeVersion = execSync('node -v').toString().replace(/(\r\n|\n|\r)/gm, "");
227
+ if (!NodeVersion.includes("v14") && !NodeVersion.includes("v16") && !Database(true).has('SkipReplitNix')) {
228
+ log.warn("[ FCA-UPDATE ] •",global.Fca.getText(Language.NodeVersionNotSupported, NodeVersion));
229
+ await new Promise(resolve => setTimeout(resolve, 3000));
230
+ try {
231
+ switch (process.platform) {
232
+ case "win32": {
233
+ try {
234
+ //check if user using nvm
235
+ if (fs.existsSync(process.env.APPDATA + "/nvm/nvm.exe")) {
236
+ log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
237
+ process.exit(0);
238
+ }
239
+ //download NodeJS v14 for Windows and slient install
240
+ 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"));
241
+ log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
242
+ await new Promise(resolve => setTimeout(resolve, 3000));
243
+ execSync('msiexec /i node-v14.17.0-x64.msi /qn');
244
+ log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
245
+ await new Promise(resolve => setTimeout(resolve, 3000));
246
+ log.info("[ FCA-UPDATE ] •", Language.RestartRequire);
247
+ Database(true).set("NeedRebuild", true);
248
+ process.exit(0);
249
+ }
250
+ catch (e) {
251
+ log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
252
+ process.exit(0);
253
+ }
254
+ }
255
+ case "linux": {
256
+
257
+ try {
258
+ if (process.env["REPL_ID"] != undefined) {
259
+ 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");
260
+ Database(true).set('SkipReplitNix', true);
261
+ await new Promise(resolve => setTimeout(resolve, 3000));
262
+ process.exit(1);
263
+ }
264
+ //check if user using nvm
265
+ if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
266
+ log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
267
+ process.exit(0);
268
+ }
269
+ //download NodeJS v14 for Linux and slient install
270
+ 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"));
271
+ log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
272
+ await new Promise(resolve => setTimeout(resolve, 3000));
273
+ execSync('tar -xf node-v14.17.0-linux-x64.tar.xz');
274
+ execSync('cd node-v14.17.0-linux-x64');
275
+ execSync('sudo cp -R * /usr/local/');
276
+ log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
277
+ await new Promise(resolve => setTimeout(resolve, 3000));
278
+ log.info("[ FCA-UPDATE ] •",Language.RestartingN);
279
+ Database(true).set("NeedRebuild", true);
280
+ process.exit(1);
281
+ }
282
+ catch (e) {
283
+ log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
284
+ process.exit(0);
285
+ }
286
+ }
287
+ case "darwin": {
288
+ try {
289
+ //check if user using nvm
290
+ if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
291
+ log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
292
+ process.exit(0);
293
+ }
294
+ //download NodeJS v14 for MacOS and slient install
295
+ 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"));
296
+ log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
297
+ await new Promise(resolve => setTimeout(resolve, 3000));
298
+ execSync('tar -xf node-v14.17.0-darwin-x64.tar.gz');
299
+ execSync('cd node-v14.17.0-darwin-x64');
300
+ execSync('sudo cp -R * /usr/local/');
301
+ log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
302
+ await new Promise(resolve => setTimeout(resolve, 3000));
303
+ log.info("[ FCA-UPDATE ] •",Language.RestartingN);
304
+ Database(true).set("NeedRebuild", true);
305
+ process.exit(1);
306
+ }
307
+ catch (e) {
308
+ log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
309
+ process.exit(0);
310
+ }
311
+ }
312
+ }
313
+ }
314
+ catch (e) {
315
+ console.log(e);
316
+ log.error("[ FCA-UPDATE ] •","NodeJS v14 Installation Failed, Please Try Again and Contact fb.com/mdonq!");
317
+ process.exit(0);
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
323
+ if ((Database(true).get("NeedRebuild")) == true) {
324
+ Database(true).set("NeedRebuild", false);
325
+ log.info("[ FCA-UPDATE ] •",Language.Rebuilding);
326
+ await new Promise(resolve => setTimeout(resolve, 3000));
327
+ try {
328
+ execSync('npm rebuild', {stdio: 'inherit'});
329
+ }
330
+ catch (e) {
331
+ console.log(e);
332
+ log.error("[ FCA-UPDATE ] •",Language.ErrRebuilding);
333
+ }
334
+ log.info("[ FCA-UPDATE ] •",Language.SuccessRebuilding);
335
+ await new Promise(resolve => setTimeout(resolve, 3000));
336
+ log.info("[ FCA-UPDATE ] •",Language.RestartingN);
337
+ process.exit(1);
338
+ }
339
+
340
+ let Data = JSON.parse(res.body);
341
+ if (global.Fca.Require.FastConfig.Stable_Version.Accept == true) {
342
+ if (Data.Stable_Version.Valid_Version.includes(global.Fca.Require.FastConfig.Stable_Version.Version)) {
343
+ let TimeStamp = Database(true).get('Check_Update');
344
+ if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
345
+ var Check_Update = require('./Extra/Src/Check_Update.js');
346
+ await Check_Update(global.Fca.Require.FastConfig.Stable_Version.Version);
347
+ }
348
+ }
349
+ else {
350
+ log.warn("[ FCA-UPDATE ] •", "Error Stable Version, Please Check Your Stable Version in FastConfig.json, Automatically turn off Stable Version!");
351
+ global.Fca.Require.FastConfig.Stable_Version.Accept = false;
352
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
353
+ process.exit(1);
354
+ }
355
+ }
356
+ else {
357
+ if (Data.HasProblem == true || Data.ForceUpdate == true) {
358
+ let TimeStamp = Database(true).get('Instant_Update');
359
+ if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 500) {
360
+ var Instant_Update = require('./Extra/Src/Instant_Update.js');
361
+ await Instant_Update()
362
+ }
363
+ }
364
+ else {
365
+ let TimeStamp = Database(true).get('Check_Update');
366
+ if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
367
+ var Check_Update = require('./Extra/Src/Check_Update.js');
368
+ await Check_Update()
369
+ }
370
+ }
371
+ }
372
+ return login(loginData, options, callback);
373
+ }).catch(function(err) {
374
+ console.log(err)
375
+ log.error("[ FCA-UPDATE ] •",Language.UnableToConnect);
376
+ log.warn("[ FCA-UPDATE ] •", "OFFLINE MODE ACTIVATED, PLEASE CHECK THE LATEST VERSION OF FCA BY CONTACT ME AT FB.COM/MDONQ");
377
+ return login(loginData, options, callback);
378
+ });
379
+ };
package/logger.js ADDED
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+ /* eslint-disable linebreak-style */
3
+
4
+ const chalk = require('chalk');
5
+ var isHexcolor = require('is-hexcolor');
6
+ var getText = function(/** @type {string[]} */ ...Data) {
7
+ var Main = (Data.splice(0,1)).toString();
8
+ for (let i = 0; i < Data.length; i++) Main = Main.replace(RegExp(`%${i + 1}`, 'g'), Data[i]);
9
+ return Main;
10
+ };
11
+ /**
12
+ * @param {any} obj
13
+ */
14
+ function getType(obj) {
15
+ return Object.prototype.toString.call(obj).slice(8, -1);
16
+ }
17
+
18
+ module.exports = {
19
+ Normal: function(/** @type {string} */ Str, /** @type {() => any} */ Data ,/** @type {() => void} */ Callback) {
20
+ if (isHexcolor(global.Fca.Require.FastConfig.MainColor) != true) {
21
+ this.Warning(getText(global.Fca.Require.Language.Index.InvaildMainColor,global.Fca.Require.FastConfig.MainColor),process.exit(0));
22
+ }
23
+ else console.log(chalk.hex(global.Fca.Require.FastConfig.MainColor).bold(`${global.Fca.Require.FastConfig.MainName || '[ FCA-DONG ]'} > `) + Str);
24
+ if (getType(Data) == 'Function' || getType(Data) == 'AsyncFunction') {
25
+ return Data();
26
+ }
27
+ if (Data) {
28
+ return Data;
29
+ }
30
+ if (getType(Callback) == 'Function' || getType(Callback) == 'AsyncFunction') {
31
+ Callback();
32
+ }
33
+ else return Callback;
34
+ },
35
+ Warning: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
36
+ console.log(chalk.magenta.bold('[ FCA-WARNING ] > ') + chalk.yellow(str));
37
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
38
+ callback();
39
+ }
40
+ else return callback;
41
+ },
42
+ Error: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
43
+ if (!str) {
44
+ console.log(chalk.magenta.bold('[ FCA-ERROR ] > ') + chalk.red("Already Faulty, Please Contact: Facebook.com/mdonq"));
45
+ }
46
+ console.log(chalk.magenta.bold('[ FCA-ERROR ] > ') + chalk.red(str));
47
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
48
+ callback();
49
+ }
50
+ else return callback;
51
+ },
52
+ Success: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
53
+ console.log(chalk.hex('#00FFFF').bold(`${global.Fca.Require.FastConfig.MainName || '[ FCA-DONG ]'} > `) + chalk.green(str));
54
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
55
+ callback();
56
+ }
57
+ else return callback;
58
+ },
59
+ Info: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
60
+ console.log(chalk.hex('#00FFFF').bold(`${global.Fca.Require.FastConfig.MainName || '[ FCA-DONG ]'} > `) + chalk.blue(str));
61
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
62
+ callback();
63
+ }
64
+ else return callback;
65
+ }
66
+ };