fca-pretest 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/.github/workflows/publish.yml +20 -0
  2. package/Extra/Database/index.js +360 -0
  3. package/Extra/ExtraAddons.js +80 -0
  4. package/Extra/ExtraFindUID.js +60 -0
  5. package/Extra/ExtraGetThread.js +118 -0
  6. package/Extra/ExtraScreenShot.js +430 -0
  7. package/Extra/ExtraUptimeRobot.js +26 -0
  8. package/Extra/Html/Classic/script.js +119 -0
  9. package/Extra/Html/Classic/style.css +8 -0
  10. package/Extra/Security/Index.js +146 -0
  11. package/Extra/Security/Step_1.js +11 -0
  12. package/Extra/Security/Step_2.js +20 -0
  13. package/Extra/Security/Step_3.js +20 -0
  14. package/Extra/Src/Change_Environment.js +24 -0
  15. package/Extra/Src/History.js +115 -0
  16. package/Extra/Src/Last-Run.js +65 -0
  17. package/Extra/Src/Premium.js +84 -0
  18. package/Extra/Src/uuid.js +137 -0
  19. package/Func/AcceptAgreement.js +32 -0
  20. package/Func/ClearCache.js +64 -0
  21. package/Func/ReportV1.js +54 -0
  22. package/LICENSE +24 -0
  23. package/Language/index.json +177 -0
  24. package/README.md +1 -0
  25. package/SECURITY.md +17 -0
  26. package/broadcast.js +38 -0
  27. package/gitattributes +2 -0
  28. package/gitignore.txt +10 -0
  29. package/index.js +1898 -0
  30. package/logger.js +66 -0
  31. package/package.json +93 -0
  32. package/src/Dev_Horizon_Data.js +125 -0
  33. package/src/Premium.js +30 -0
  34. package/src/Screenshot.js +85 -0
  35. package/src/addExternalModule.js +16 -0
  36. package/src/addUserToGroup.js +79 -0
  37. package/src/changeAdminStatus.js +79 -0
  38. package/src/changeArchivedStatus.js +41 -0
  39. package/src/changeAvt.js +85 -0
  40. package/src/changeBio.js +65 -0
  41. package/src/changeBlockedStatus.js +36 -0
  42. package/src/changeGroupImage.js +106 -0
  43. package/src/changeNickname.js +45 -0
  44. package/src/changeThreadColor.js +62 -0
  45. package/src/changeThreadEmoji.js +42 -0
  46. package/src/createNewGroup.js +70 -0
  47. package/src/createPoll.js +60 -0
  48. package/src/deleteMessage.js +45 -0
  49. package/src/deleteThread.js +43 -0
  50. package/src/forwardAttachment.js +48 -0
  51. package/src/getAccessToken.js +32 -0
  52. package/src/getCurrentUserID.js +7 -0
  53. package/src/getEmojiUrl.js +27 -0
  54. package/src/getFriendsList.js +73 -0
  55. package/src/getMessage.js +80 -0
  56. package/src/getThreadHistory.js +537 -0
  57. package/src/getThreadInfo.js +348 -0
  58. package/src/getThreadList.js +213 -0
  59. package/src/getThreadMain.js +220 -0
  60. package/src/getThreadPictures.js +59 -0
  61. package/src/getUID.js +59 -0
  62. package/src/getUserID.js +62 -0
  63. package/src/getUserInfo.js +129 -0
  64. package/src/getUserInfoMain.js +65 -0
  65. package/src/getUserInfoV2.js +36 -0
  66. package/src/getUserInfoV3.js +63 -0
  67. package/src/getUserInfoV4.js +55 -0
  68. package/src/getUserInfoV5.js +61 -0
  69. package/src/handleFriendRequest.js +46 -0
  70. package/src/handleMessageRequest.js +49 -0
  71. package/src/httpGet.js +49 -0
  72. package/src/httpPost.js +48 -0
  73. package/src/httpPostFormData.js +41 -0
  74. package/src/listenMqtt.js +676 -0
  75. package/src/logout.js +68 -0
  76. package/src/markAsDelivered.js +48 -0
  77. package/src/markAsRead.js +70 -0
  78. package/src/markAsReadAll.js +43 -0
  79. package/src/markAsSeen.js +51 -0
  80. package/src/muteThread.js +47 -0
  81. package/src/removeUserFromGroup.js +49 -0
  82. package/src/resolvePhotoUrl.js +37 -0
  83. package/src/searchForThread.js +43 -0
  84. package/src/sendMessage.js +334 -0
  85. package/src/sendTypingIndicator.js +80 -0
  86. package/src/setMessageReaction.js +109 -0
  87. package/src/setPostReaction.js +102 -0
  88. package/src/setTitle.js +74 -0
  89. package/src/threadColors.js +39 -0
  90. package/src/unfriend.js +43 -0
  91. package/src/unsendMessage.js +40 -0
  92. package/test/data/shareAttach.js +146 -0
  93. package/test/data/something.mov +0 -0
  94. package/test/data/test.png +0 -0
  95. package/test/data/test.txt +7 -0
  96. package/test/example-config.json +18 -0
  97. package/test/test-page.js +140 -0
  98. package/test/test.js +385 -0
  99. package/test/testv2.js +3 -0
  100. package/utils.js +1648 -0
package/index.js ADDED
@@ -0,0 +1,1898 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Developers: @KanzuWakazaki - @HarryWakazaki
5
+ ** A few words about developer appstate security.
6
+ *! Statement renouncing responsibility for the security of appstate encryption of the following operating systems: windows, Android, Linux operating systems,.. (maybe repl.it?),
7
+ *! because the above operating systems are private (except rep.it if the fraudster does not own your account or invite link to join).
8
+ *! If the intruder owns the computer, these private operating systems,the security of this fca cannot guarantee 100% of the time.
9
+ ** If the grammar is wrong, please understand because I'm just a kid 🍵.
10
+ */
11
+
12
+ /!-[ Global Set ]-!/
13
+
14
+ global.Fca = new Object({
15
+ isThread: new Array(),
16
+ isUser: new Array(),
17
+ startTime: Date.now(),
18
+ Setting: new Map(),
19
+ Version: require('./package.json').version,
20
+ Require: new Object({
21
+ fs: require("fs"),
22
+ Fetch: require('got'),
23
+ log: require("npmlog"),
24
+ utils: require("./utils"),
25
+ logger: require('./logger'),
26
+ languageFile: require('./Language/index.json'),
27
+ Database: require("./Extra/Database"),
28
+ Security: require('./Extra/Src/uuid')
29
+ }),
30
+ getText: function(/** @type {any[]} */...Data) {
31
+ var Main = (Data.splice(0,1)).toString();
32
+ for (let i = 0; i < Data.length; i++) Main = Main.replace(RegExp(`%${i + 1}`, 'g'), Data[i]);
33
+ return Main;
34
+ },
35
+ Data: new Object({
36
+ ObjPriyansh: {
37
+ "Language": "en",
38
+ "PreKey": "",
39
+ "AutoUpdate": true,
40
+ "MainColor": "#9900FF",
41
+ "MainName": "[ FCA-PRIYANSH ]",
42
+ "Logo": true,
43
+ "Uptime": true,
44
+ "Config": "default",
45
+ "Login2Fa": false,
46
+ "AutoLogin": false,
47
+ "BroadCast": true,
48
+ "AuthString": "SD4S XQ32 O2JA WXB3 FUX2 OPJ7 Q7JZ 4R6Z",
49
+ "EncryptFeature": true,
50
+ "ResetDataLogin": false,
51
+ "AutoRestartMinutes": 0,
52
+ "HTML": {
53
+ "HTML": true,
54
+ "UserName": "Guest"
55
+ }
56
+ },
57
+ CountTime: function() {
58
+ var fs = global.Fca.Require.fs;
59
+ if (fs.existsSync(__dirname + '/CountTime.json')) {
60
+ try {
61
+ var data = Number(fs.readFileSync(__dirname + '/CountTime.json', 'utf8')),
62
+ hours = Math.floor(data / (60 * 60));
63
+ }
64
+ catch (e) {
65
+ fs.writeFileSync(__dirname + '/CountTime.json', 0);
66
+ hours = 0;
67
+ }
68
+ }
69
+ else {
70
+ hours = 0;
71
+ }
72
+ return `${hours} Hours`;
73
+ }
74
+ }),
75
+ AutoLogin: async function () {
76
+ var Database = global.Fca.Require.Database;
77
+ var logger = global.Fca.Require.logger;
78
+ var Email = (await global.Fca.Require.Database.get('Account')).replace(RegExp('"', 'g'), ''); //hmm IDK
79
+ var PassWord = (await global.Fca.Require.Database.get('Password')).replace(RegExp('"', 'g'), '');
80
+ login({ email: Email, password: PassWord},async (error, api) => {
81
+ if (error) {
82
+ logger.Error(JSON.stringify(error,null,2), function() { logger.Error("AutoLogin Failed!", function() { process.exit(0); }) });
83
+ }
84
+ try {
85
+ await Database.set("TempState", api.getAppState());
86
+ }
87
+ catch(e) {
88
+ logger.Warning(global.Fca.Require.Language.Index.ErrDatabase);
89
+ logger.Error();
90
+ process.exit(0);
91
+ }
92
+ process.exit(1);
93
+ });
94
+ }
95
+ });
96
+
97
+ /!-[ Check File To Run Process ]-!/
98
+
99
+ let Boolean_Fca = ["AutoUpdate","Uptime","BroadCast","EncryptFeature","AutoLogin","ResetDataLogin","Login2Fa","Logo"];
100
+ let String_Fca = ["MainName","PreKey","Language","AuthString","Config"]
101
+ let Number_Fca = ["AutoRestartMinutes"];
102
+ let All_Variable = Boolean_Fca.concat(String_Fca,Number_Fca);
103
+
104
+ try {
105
+ if (!global.Fca.Require.fs.existsSync(process.cwd() + '/PriyanshFca.json')) {
106
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/PriyanshFca.json", JSON.stringify(global.Fca.Data.ObjPriyansh, null, "\t"));
107
+ process.exit(1);
108
+ }
109
+
110
+ try {
111
+ var DataLanguageSetting = require(process.cwd() + "/PriyanshFca.json");
112
+ }
113
+ catch (e) {
114
+ global.Fca.Require.logger.Error('Detect Your FastConfigFca Settings Invalid!, Carry out default restoration');
115
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/PriyanshFca.json", JSON.stringify(global.Fca.Data.ObjPriyansh, null, "\t"));
116
+ process.exit(1)
117
+ }
118
+ if (global.Fca.Require.fs.existsSync(process.cwd() + '/PriyanshFca.json')) {
119
+ try {
120
+ if (DataLanguageSetting.Logo != undefined) {
121
+ delete DataLanguageSetting.Logo
122
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/PriyanshFca.json", JSON.stringify(DataLanguageSetting, null, "\t"));
123
+ }
124
+ }
125
+ catch (e) {
126
+ console.log(e);
127
+ }
128
+ if (!global.Fca.Require.languageFile.some((/** @type {{ Language: string; }} */i) => i.Language == DataLanguageSetting.Language)) {
129
+ global.Fca.Require.logger.Warning("Not Support Language: " + DataLanguageSetting.Language + " Only 'en' and 'vi'");
130
+ process.exit(0);
131
+ }
132
+ var Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == DataLanguageSetting.Language).Folder.Index;
133
+ global.Fca.Require.Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == DataLanguageSetting.Language).Folder;
134
+ } else process.exit(1);
135
+ for (let i in DataLanguageSetting) {
136
+ if (Boolean_Fca.includes(i)) {
137
+ if (global.Fca.Require.utils.getType(DataLanguageSetting[i]) != "Boolean") return logger.Error(i + " Is Not A Boolean, Need To Be true Or false !", function() { process.exit(0) });
138
+ else continue;
139
+ }
140
+ else if (String_Fca.includes(i)) {
141
+ if (global.Fca.Require.utils.getType(DataLanguageSetting[i]) != "String") return logger.Error(i + " Is Not A String, Need To Be String!", function() { process.exit(0) });
142
+ else continue;
143
+ }
144
+ else if (Number_Fca.includes(i)) {
145
+ if (global.Fca.Require.utils.getType(DataLanguageSetting[i]) != "Number") return logger.Error(i + " Is Not A Number, Need To Be Number !", function() { process.exit(0) });
146
+ else continue;
147
+ }
148
+ }
149
+ for (let i of All_Variable) {
150
+ if (!DataLanguageSetting[All_Variable[i]] == undefined) {
151
+ DataLanguageSetting[All_Variable[i]] = global.Fca.Data.ObjPriyansh[All_Variable[i]];
152
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/PriyanshFca.json", JSON.stringify(DataLanguageSetting, null, "\t"));
153
+ }
154
+ else continue;
155
+ }
156
+ global.Fca.Require.Priyansh = DataLanguageSetting;
157
+ }
158
+ catch (e) {
159
+ console.log(e);
160
+ global.Fca.Require.logger.Error();
161
+ }
162
+
163
+ /!-[ Require config and use ]-!/
164
+
165
+ if (global.Fca.Require.Priyansh.Config != 'default') {
166
+ //do ssth
167
+ }
168
+
169
+ /!-[ Require All Package Need Use ]-!/
170
+
171
+ var utils = global.Fca.Require.utils,
172
+ logger = global.Fca.Require.logger,
173
+ fs = global.Fca.Require.fs,
174
+ getText = global.Fca.getText,
175
+ log = global.Fca.Require.log,
176
+ Fetch = global.Fca.Require.Fetch,
177
+ express = require("express")(),
178
+ { join, resolve } = require('path'),
179
+ cheerio = require("cheerio"),
180
+ StateCrypt = {},
181
+ { readFileSync } = require('fs-extra'),
182
+ Database = require("./Extra/Database"),
183
+ readline = require("readline"),
184
+ chalk = require("chalk"),
185
+ figlet = require("figlet"),
186
+ os = require("os"),
187
+ Security = require("./Extra/Security/Index");
188
+
189
+ /!-[ Set Variable For Process ]-!/
190
+
191
+ log.maxRecordSize = 100;
192
+ var checkVerified = null;
193
+ var Boolean_Option = ['online','selfListen','listenEvents','updatePresence','forceLogin','autoMarkDelivery','autoMarkRead','listenTyping','autoReconnect','emitReady'];
194
+
195
+ /!-[ Set And Check Template HTML ]-!/
196
+
197
+ var css = readFileSync(join(__dirname, 'Extra', 'Html', 'Classic', 'style.css'));
198
+ var js = readFileSync(join(__dirname, 'Extra', 'Html', 'Classic', 'script.js'));
199
+
200
+ /!-[ Function Generate HTML Template ]-!/
201
+
202
+ /**
203
+ * It returns a string of HTML code.
204
+ * @param UserName - The username of the user
205
+ * @param Type - The type of user, either "Free" or "Premium"
206
+ * @param link - The link to the music you want to play
207
+ * @returns A HTML file
208
+ */
209
+
210
+ function ClassicHTML(UserName,Type,link) {
211
+ return `<!DOCTYPE html>
212
+ <html lang="en">
213
+ <head>
214
+ <meta charset="UTF-8">
215
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
216
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
217
+ <title>Priyanshu Rajput Info</title>
218
+ <!--font awasome icons-->
219
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
220
+ <link rel="preconnect" href="https://fonts.googleapis.com">
221
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
222
+ <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
223
+ <!--my css file-->
224
+ <link rel="stylesheet" href="style.css">
225
+ </head>
226
+ <body >
227
+ <video autoplay muted plays-inline loop>
228
+ <source src="https://imgur.com/aoGxVLX.mp4" type="video/mp4">
229
+ </video>
230
+ <div class="container">
231
+ <button class="call"><i class="fa-solid fa-phone"></i></button>
232
+ <div class="card move">
233
+ <div class="imgbox">
234
+ <img src="https://i.imgur.com/eDbdlvd.jpg" alt="">
235
+ </div>
236
+ <div class="name-job">
237
+ <h3>Priyansh Rajput</h3>
238
+ <h5>Web Developer</h5>
239
+ </div>
240
+ <div class="skills">
241
+ <button class="btn-Follow"><a href="https://facebook.com/Priyanshu.Rajput.Official" target="_blank">Follow</a></button>
242
+ <button class="btn-Message"><a href=" https://telegram.me/Priyanshrajput" target="_blank">Message!</a></button>
243
+ </div>
244
+
245
+ </div>
246
+ <div class="icons">
247
+ <div class="icon">
248
+ <i class="fa-brands fa-twitter front"></i>
249
+ <i class="fa-brands fa-twitter back"></i>
250
+ <i class="fa-brands fa-twitter left"></i>
251
+ <i class="fa-brands fa-twitter right"></i>
252
+ <i class="fa-brands fa-twitter top"></i>
253
+ <i class="fa-brands fa-twitter bottom"></i>
254
+ </div>
255
+ <div class="icon">
256
+ <i class="fa-brands fa-youtube front"></i>
257
+ <i class="fa-brands fa-youtube back"></i>
258
+ <i class="fa-brands fa-youtube left"></i>
259
+ <i class="fa-brands fa-youtube right"></i>
260
+ <i class="fa-brands fa-youtube top"></i>
261
+ <i class="fa-brands fa-youtube bottom"></i>
262
+ </div>
263
+ <div class="icon">
264
+ <i class="fa-brands fa-facebook-f front"></i>
265
+ <i class="fa-brands fa-facebook-f back"></i>
266
+ <i class="fa-brands fa-facebook-f left"></i>
267
+ <i class="fa-brands fa-facebook-f right"></i>
268
+ <i class="fa-brands fa-facebook-f top"></i>
269
+ <i class="fa-brands fa-facebook-f bottom"></i>
270
+ </div>
271
+ <div class="icon">
272
+ <i class="fa-brands fa-whatsapp front"></i>
273
+ <i class="fa-brands fa-whatsapp back"></i>
274
+ <i class="fa-brands fa-whatsapp left"></i>
275
+ <i class="fa-brands fa-whatsapp right"></i>
276
+ <i class="fa-brands fa-whatsapp top"></i>
277
+ <i class="fa-brands fa-whatsapp bottom"></i>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </body>
282
+ </html>
283
+ <script>
284
+ var container=document.querySelector('.container')
285
+ var icons=document.querySelector('.icons')
286
+ var call=document.querySelector('.call')
287
+ var body =document.querySelector('body')
288
+ var card=document.querySelector('.card')
289
+ // body.addEventListener('onload',function(){
290
+ setTimeout(function(){
291
+ container.classList.add('move')
292
+ },3000)
293
+ // })
294
+ setTimeout(function(){
295
+ icons.style="opacity: 0"
296
+ call.style="opacity: 0"
297
+ },2000)
298
+ setTimeout(function(){
299
+ card.classList.remove('move')
300
+ icons.style="opacity: 1"
301
+ call.style="opacity: 1"
302
+ },6000)
303
+
304
+ </script>
305
+
306
+ <style>/* @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300&display=swap'); */
307
+ * {
308
+ padding: 0;
309
+ margin: 0;
310
+ box-sizing: border-box;
311
+ font-family: 'Roboto', sans-serif;
312
+ }
313
+ :root {
314
+ --width: 250px;
315
+ --height: 260px;
316
+ --i-width: calc(var(--height)*0.25 - 23px);
317
+ }
318
+
319
+ @media only screen and (min-width:64.1875em){
320
+ video{
321
+ height: 100%;
322
+ width: 100%;
323
+ }
324
+
325
+ }
326
+ @media only screen and (min-width:46.1875em) and (max-width:63.9375em){
327
+ video{
328
+ position: fixed;
329
+ top:0;
330
+ left: 0;
331
+ right: 0;
332
+ bottom: 0;
333
+ background-color: #000;
334
+ height: 100%;
335
+ display: block;
336
+ }
337
+ }
338
+ @media only screen and (max-width:46.1875em){
339
+ video{
340
+ position: fixed;
341
+ top:0;
342
+ left: 0;
343
+ right: 0;
344
+ bottom: 0;
345
+ background-color: #000;
346
+ height: 100%;
347
+ display: block;
348
+ }
349
+
350
+ }
351
+ body {
352
+ height: 100vh;
353
+ width: 100vw;
354
+ background-color: black;
355
+ display: flex;
356
+ justify-content: center;
357
+ align-items: center;
358
+ perspective: 600px;
359
+ overflow: hidden;
360
+ }
361
+ body::before {
362
+ content: '';
363
+ position: absolute;
364
+ left: 0;
365
+ top: 0;
366
+ width: 100%;
367
+ height: 100%;
368
+ background: linear-gradient(#E91e63, #FF0);
369
+ clip-path: circle(22% at 30% 22%);
370
+ z-index: -1;
371
+ }
372
+ body::after {
373
+ content: '';
374
+ position: absolute;
375
+ left: 0;
376
+ top: 0;
377
+ width: 100%;
378
+ height: 100%;
379
+ background: linear-gradient(#FFF, #DA00FF);
380
+ clip-path: circle(25% at 70% 80%);
381
+ z-index: -1;
382
+ }
383
+ .container {
384
+ position: fixed;
385
+ transform-style: preserve-3d;
386
+
387
+ display: none;
388
+
389
+ z-index: 99;
390
+
391
+
392
+ }
393
+ @keyframes move{
394
+ 0% {
395
+ transform: scale(0);
396
+ /* opacity: 0; */
397
+ border-radius: 50%;
398
+ }
399
+ 25% {
400
+ transform: scale(0.20);
401
+ /* opacity: 0.3; */
402
+ border-radius: 25%;
403
+ }
404
+ 50% {
405
+ transform: scale(0.50);
406
+ /* opacity: 0,6; */
407
+ }
408
+ 75% {
409
+ transform: scale(0.75);
410
+ /* opacity: 0,6; */
411
+ }
412
+ 100% {
413
+ transform: scale(1);
414
+ /* opacity: 1; */
415
+ }
416
+ }
417
+ .container.move{
418
+ animation: move linear 1.5s;
419
+ display: block;
420
+ }
421
+ .container::before{
422
+ content: "";
423
+ position: absolute;
424
+ top:-2px;
425
+ left: -2px;
426
+ width:calc(100% + 5px) ;
427
+ height: calc(100% + 5px);
428
+ border:3px solid linear-gradient(45deg,#e6fb04,#00ff66,#00ffff,#ff00ff
429
+ ,#ff0099,#6e0dde,#ff3300,#099fff);
430
+ /* background: linear-gradient(45deg,#e6fb04,#00ff66,#00ffff,#ff00ff
431
+ ,#ff0099,#6e0dde,#ff3300,#099fff); */
432
+ animation: animate 20s linear infinite;
433
+ background-size: 400%;
434
+ /* background:linear-gradient(transparent,#45f3ff,#45f3ff,#45f3ff,transparent); */
435
+ z-index: -1;
436
+
437
+ }
438
+ /* .container::after{
439
+ content: "";
440
+ position: absolute;
441
+
442
+ inset: 3px;
443
+ } */
444
+ @keyframes animate{
445
+ 0%{
446
+ /* transform: translate(-50%,-50%) rotate(0deg); */
447
+
448
+ background-position: 0 0;
449
+ }
450
+ 50%{
451
+ background-position:100% 0;
452
+ }
453
+ 100%{
454
+ /* transform: translate(-50%,-50%) rotate(360deg); */
455
+ background-position: 0 0;
456
+ }
457
+ }
458
+ .card {
459
+ position: relative;
460
+ width: var(--width);
461
+ height: var(--height);
462
+ background-color: rgba(255, 255, 255, 0.02);
463
+ backdrop-filter: blur(9px);
464
+ border-top: 1px solid #FFF2;
465
+ border-left: 1px solid #FFF2;
466
+ box-shadow: 4px 4px 12px #0004;
467
+
468
+
469
+ color: #FFF;
470
+ overflow: hidden;
471
+ transition: transform 0.7s;
472
+ display: flex;
473
+ flex-wrap: wrap;
474
+ justify-content: center;
475
+ transition: 1s linear;
476
+ }
477
+ .card.move{
478
+ width: 120px;
479
+ height: 120px;
480
+ border-radius: 50%;
481
+ overflow: hidden;
482
+ padding: 0px;
483
+
484
+ }
485
+ .card.move .imgbox{
486
+ transform: translateY(0);
487
+ }
488
+ .card.move.card:before{
489
+ opacity: 0;
490
+ }
491
+ .card::before {
492
+ content: '';
493
+ position: absolute;
494
+ left: -99%;
495
+ width: 70px;
496
+ height: 400px;
497
+ background-color: #FFFB;
498
+ transform: rotate(38deg) translateY(-25%);
499
+ z-index: 1;
500
+ }
501
+ .container:hover .card:before {
502
+ animation: brightness 0.8s 1 forwards;
503
+ }
504
+ @keyframes brightness {
505
+ 0% {
506
+ left: -99%;
507
+ }
508
+ 100% {
509
+ left: 120%;
510
+ }
511
+ }
512
+ .imgbox {
513
+ width: 115px;
514
+ height: 115px;
515
+ border: 5px solid transparent;
516
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.533);
517
+ border-radius: 50%;
518
+ overflow: hidden;
519
+ text-align: center;
520
+ transition: 1s;
521
+ transform: translateY(10px);
522
+ }
523
+ .imgbox:hover{
524
+ width: 100%;
525
+ height: 100%;
526
+ border: none;
527
+ border-radius: unset;
528
+ transform: translateY(0px);
529
+ }
530
+ .imgbox:hover.card{
531
+ padding: 0;
532
+ }
533
+ .imgbox img {
534
+ width: 100%;
535
+ height: 100%;
536
+
537
+ }
538
+ .name-job {
539
+ width: 100%;
540
+ text-align: center;
541
+ text-shadow: 1px 2px 2px #000;
542
+ /* margin-bottom: 40px; */
543
+ margin-top: 10px
544
+ }
545
+
546
+ .name-job h3 {
547
+ margin-bottom: 0.1em;
548
+ }
549
+ .name-job h5 {
550
+ color: rgb(36, 219, 36);
551
+ line-height: 25px;
552
+ }
553
+ .info {
554
+ grid-column: 2 / 4;
555
+ grid-row: 1 / 3;
556
+ padding: 7px;
557
+ line-height: 1.8;
558
+ font-weight: 200;
559
+ }
560
+ .skills {
561
+ display: flex;
562
+ justify-content: space-around;
563
+ align-items: center;
564
+ margin-bottom: 6px;
565
+ }
566
+ .skills button{
567
+ padding: 5px 10px;
568
+ width: 85px;
569
+ margin: 5px;
570
+
571
+
572
+ cursor: pointer;
573
+ }
574
+ .btn-Follow a{
575
+ text-decoration: none;
576
+ color: black;
577
+ }
578
+ .btn-Follow{
579
+ background-color: rgb(36, 219, 36);
580
+ border-radius: 1px;
581
+ border: none;
582
+ }
583
+ .btn-Follow:hover{
584
+ background-color: rgb(2, 250, 2);
585
+
586
+ }
587
+ .btn-Message a{
588
+ text-decoration: none;
589
+ color: rgb(36, 219, 36);
590
+ }
591
+ .btn-Message a:hover{
592
+ color: #000;
593
+ }
594
+ .btn-Message{
595
+ border: 1px solid rgb(36, 219, 36);
596
+ border-radius: 3px;
597
+ background-color: transparent;
598
+ color: #fff;
599
+ }
600
+ .btn-Message:hover{
601
+ background-color: rgb(2, 250, 2);
602
+ color: red;
603
+ }
604
+ .skills .fa-brands {
605
+ cursor: pointer;
606
+ position: relative;
607
+ width: 45px;
608
+ height: 45px;
609
+ background-color: #FFF5;
610
+ box-shadow: 0px 2px 4px #0008, 0px -1px 1px #FFF;
611
+ display: grid;
612
+ place-content: center;
613
+ font-size: 1.22em;
614
+ border-radius: 50%;
615
+ transition: 0.3s;
616
+ }
617
+ .skills .fa-brands:hover {
618
+ background-color: #FFF;
619
+ color: #222;
620
+ }
621
+ .call {
622
+ cursor: pointer;
623
+ position: absolute;
624
+ left: 10px;
625
+ top: 10px;
626
+ width: 40px;
627
+ height: 40px;
628
+ background-color: #555;
629
+ color: #FFF;
630
+ border: 2px solid #FFF;
631
+ display: grid;
632
+ place-content: center;
633
+ border-radius: 50%;
634
+ z-index: 1;
635
+ transition: 0.4s;
636
+ }
637
+ .call:focus {
638
+ transform: rotateY(45deg) translateX(120px) translateZ(-70px);
639
+ }
640
+ .call:focus ~ .card {
641
+ transform: rotateY(45deg) translateX(140px) translateZ(-120px);
642
+ }
643
+ .call:focus ~ .icons {
644
+ height: var(--height);
645
+ transform: translateZ(var(--i-width)) translateY(-50%);
646
+ }
647
+ .icon {
648
+ position: relative;
649
+ width: var(--i-width);
650
+ height: var(--i-width);
651
+ transform-style: preserve-3d;
652
+ transform: rotateX(-40deg) rotateY(45deg);
653
+ transition: 0.7s;
654
+ }
655
+ .icons {
656
+ position: absolute;
657
+ left: 5px;
658
+ top: 50%;
659
+ width: var(--i-width);
660
+ height: calc(var(--i-width)*4);
661
+ transition: 0.6s;
662
+ display: flex;
663
+ flex-direction: column;
664
+ justify-content: space-between;
665
+ transform: translateZ(calc(var(--i-width) * -1)) translateY(-50%);
666
+ transform-style: preserve-3d;
667
+ }
668
+ .icon .fa-brands {
669
+ position: absolute;
670
+ left: 0;
671
+ top: 0;
672
+ width: 100%;
673
+ height: 100%;
674
+ background-color: #222;
675
+ color: #0FF;
676
+ border: 1px dashed #0FF;
677
+ display: grid;
678
+ place-content: center;
679
+ font-size: 1.2em;
680
+ transition: 0.5s;
681
+ }
682
+ .call:hover {
683
+ border-color: #222;
684
+ color: #000;
685
+ background-color: #FC0;
686
+ }
687
+ .icon:hover {
688
+ cursor: pointer;
689
+ transform: rotateX(-40deg) rotateY(315deg);
690
+ }
691
+ .icon:hover .fa-brands {
692
+ border-color: inherit;
693
+ background-color: #FFF;
694
+ }
695
+ .icon:hover .fa-facebook-f {
696
+ color: #0000dd;
697
+ }
698
+ .icon:hover .fa-twitter {
699
+ color: #002fff;
700
+ }
701
+ .icon:hover .fa-youtube {
702
+ color: #F00;
703
+ }
704
+ .icon:hover .fa-whatsapp {
705
+ color: #0F0;
706
+ }
707
+ .front {
708
+ transform: translateZ(calc(var(--i-width)*0.5));
709
+ }
710
+ .back {
711
+ transform: translateZ(calc(var(--i-width)* -0.5));
712
+ }
713
+ .left {
714
+ transform: rotateY(-90deg) translateZ(calc(var(--i-width)* 0.5));
715
+ }
716
+ .right {
717
+ transform: rotateY(90deg) translateZ(calc(var(--i-width)* 0.5));
718
+ }
719
+ .bottom {
720
+ transform: rotateX(-90deg) translateZ(calc(var(--i-width)* 0.5));
721
+ }
722
+ .top {
723
+ transform: rotateX(90deg) translateZ(calc(var(--i-width)* 0.5));
724
+ }</style>`
725
+ //lazy to change
726
+ }
727
+
728
+ /!-[ Stating Http Infomation ]-!/
729
+
730
+ express.set('DFP', (process.env.port || 8000));
731
+ express.use(function(req, res, next) {
732
+ switch (req.url.split('?')[0]) {
733
+ case '/script.js': {
734
+ res.writeHead(200, { 'Content-Type': 'text/javascript' });
735
+ res.write(js);
736
+ break;
737
+ }
738
+ case '/style.css': {
739
+ res.writeHead(200, { 'Content-Type': 'text/css' });
740
+ res.write(css);
741
+ break;
742
+ }
743
+ // case '/History': {
744
+ // if (req.query.PassWord == process.env.REPL_OWNER) {
745
+ // res.writeHead(200, { 'Content-Type': 'application/json charset=utf-8' });
746
+ // res.write(JSON.stringify(console.history,null,2),'utf8');
747
+ // res.end();
748
+ // }
749
+ // else res.json({
750
+ // Status: false,
751
+ // Error: "Thiếu Params ?PassWord=PassWordCuaBan =))"
752
+ // });
753
+ // break;
754
+ // }
755
+ default: {
756
+ res.writeHead(200, "OK", { "Content-Type": "text/html" });
757
+ res.write(ClassicHTML(global.Fca.Require.Priyansh.HTML.UserName, global.Fca.Data.PremText.includes("Premium") ? "Premium": "Free", global.Fca.Require.Priyansh.HTML.MusicLink));
758
+ }
759
+ }
760
+ res.end();
761
+ })
762
+
763
+ global.Fca.Require.Web = express;
764
+
765
+ /!-[ Function setOptions ]-!/
766
+
767
+ /**
768
+ * @param {{ [x: string]: boolean; selfListen?: boolean; listenEvents?: boolean; listenTyping?: boolean; updatePresence?: boolean; forceLogin?: boolean; autoMarkDelivery?: boolean; autoMarkRead?: boolean; autoReconnect?: boolean; logRecordSize: any; online?: boolean; emitReady?: boolean; userAgent: any; logLevel?: any; pageID?: any; proxy?: any; }} globalOptions
769
+ * @param {{ [x: string]: any; logLevel?: any; forceLogin?: boolean; userAgent?: any; pauseLog?: any; logRecordSize?: any; pageID?: any; proxy?: any; }} options
770
+ */
771
+
772
+ function setOptions(globalOptions, options) {
773
+ Object.keys(options).map(function(key) {
774
+ switch (Boolean_Option.includes(key)) {
775
+ case true: {
776
+ globalOptions[key] = Boolean(options[key]);
777
+ break;
778
+ }
779
+ case false: {
780
+ switch (key) {
781
+ case 'pauseLog': {
782
+ if (options.pauseLog) log.pause();
783
+ else log.resume();
784
+ break;
785
+ }
786
+ case 'logLevel': {
787
+ log.level = options.logLevel;
788
+ globalOptions.logLevel = options.logLevel;
789
+ break;
790
+ }
791
+ case 'logRecordSize': {
792
+ log.maxRecordSize = options.logRecordSize;
793
+ globalOptions.logRecordSize = options.logRecordSize;
794
+ break;
795
+ }
796
+ case 'pageID': {
797
+ globalOptions.pageID = options.pageID.toString();
798
+ break;
799
+ }
800
+ case 'userAgent': {
801
+ globalOptions.userAgent = (options.userAgent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36');
802
+ break;
803
+ }
804
+ case 'proxy': {
805
+ if (typeof options.proxy != "string") {
806
+ delete globalOptions.proxy;
807
+ utils.setProxy();
808
+ } else {
809
+ globalOptions.proxy = options.proxy;
810
+ utils.setProxy(globalOptions.proxy);
811
+ }
812
+ break;
813
+ }
814
+ default: {
815
+ log.warn("setOptions", "Unrecognized option given to setOptions: " + key);
816
+ break;
817
+ }
818
+ }
819
+ break;
820
+ }
821
+ }
822
+ });
823
+ }
824
+
825
+ /!-[ Function BuildAPI ]-!/
826
+
827
+ /**
828
+ * @param {any} globalOptions
829
+ * @param {string} html
830
+ * @param {{ getCookies: (arg0: string) => any[]; }} jar
831
+ */
832
+
833
+ function buildAPI(globalOptions, html, jar) {
834
+ var maybeCookie = jar.getCookies("https://www.facebook.com").filter(function(/** @type {{ cookieString: () => string; }} */val) { return val.cookieString().split("=")[0] === "c_user"; });
835
+
836
+ if (maybeCookie.length === 0) {
837
+ switch (global.Fca.Require.Priyansh.AutoLogin) {
838
+ case true: {
839
+ global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
840
+ return global.Fca.AutoLogin();
841
+ });
842
+ break;
843
+ }
844
+ case false: {
845
+ throw { error: global.Fca.Require.Language.Index.ErrAppState };
846
+
847
+ }
848
+ }
849
+ }
850
+
851
+ if (html.indexOf("/checkpoint/block/?next") > -1) log.warn("login", Language.CheckPointLevelI);
852
+
853
+ var userID = maybeCookie[0].cookieString().split("=")[1].toString();
854
+ process.env['UID'] = logger.Normal(getText(Language.UID,userID), userID);
855
+
856
+ try {
857
+ clearInterval(checkVerified);
858
+ } catch (e) {
859
+ console.log(e);
860
+ }
861
+
862
+ var clientID = (Math.random() * 2147483648 | 0).toString(16);
863
+
864
+ var CHECK_MQTT = {
865
+ oldFBMQTTMatch: html.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/),
866
+ newFBMQTTMatch: html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/),
867
+ legacyFBMQTTMatch: html.match(/(\["MqttWebConfig",\[\],{fbid:")(.+?)(",appID:219994525426954,endpoint:")(.+?)(",pollingEndpoint:")(.+?)(3790])/)
868
+ }
869
+
870
+ let Slot = Object.keys(CHECK_MQTT);
871
+
872
+ var mqttEndpoint,region,irisSeqID;
873
+ Object.keys(CHECK_MQTT).map(function(MQTT) {
874
+ if (CHECK_MQTT[MQTT] && !region) {
875
+ switch (Slot.indexOf(MQTT)) {
876
+ case 0: {
877
+ irisSeqID = CHECK_MQTT[MQTT][1];
878
+ mqttEndpoint = CHECK_MQTT[MQTT][2];
879
+ region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
880
+ return;
881
+ }
882
+ case 1: {
883
+ irisSeqID = CHECK_MQTT[MQTT][2];
884
+ mqttEndpoint = CHECK_MQTT[MQTT][1].replace(/\\\//g, "/");
885
+ region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
886
+ return;
887
+ }
888
+ case 2: {
889
+ mqttEndpoint = CHECK_MQTT[MQTT][4];
890
+ region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
891
+ return;
892
+ }
893
+ }
894
+ return;
895
+ }
896
+ });
897
+
898
+ var ctx = {
899
+ userID: userID,
900
+ jar: jar,
901
+ clientID: clientID,
902
+ globalOptions: globalOptions,
903
+ loggedIn: true,
904
+ access_token: 'NONE',
905
+ clientMutationId: 0,
906
+ mqttClient: undefined,
907
+ lastSeqId: irisSeqID,
908
+ syncToken: undefined,
909
+ mqttEndpoint: mqttEndpoint,
910
+ region: region,
911
+ firstListen: true
912
+ };
913
+
914
+ var api = {
915
+ setOptions: setOptions.bind(null, globalOptions),
916
+ getAppState: function getAppState() {
917
+ return utils.getAppState(jar);
918
+ }
919
+ };
920
+
921
+ if (region && mqttEndpoint) {
922
+ //do sth
923
+ }
924
+ else {
925
+ log.warn("login", getText(Language.NoAreaData));
926
+ api["htmlData"] = html;
927
+ }
928
+
929
+ var defaultFuncs = utils.makeDefaults(html, userID, ctx);
930
+
931
+ fs.readdirSync(__dirname + "/src").filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => api[File.split('.').slice(0, -1).join('.')] = require('./src/' + File)(defaultFuncs, api, ctx));
932
+
933
+ return {
934
+ ctx,
935
+ defaultFuncs,
936
+ api
937
+ };
938
+ }
939
+
940
+ /!-[ Function makeLogin ]-!/
941
+
942
+ /**
943
+ * @param {{ setCookie: (arg0: any, arg1: string) => void; }} jar
944
+ * @param {any} email
945
+ * @param {any} password
946
+ * @param {{ forceLogin: any; }} loginOptions
947
+ * @param {(err: any, api: any) => any} callback
948
+ * @param {any} prCallback
949
+ */
950
+
951
+ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
952
+ return function(/** @type {{ body: any; }} */res) {
953
+ var html = res.body,$ = cheerio.load(html),arr = [];
954
+
955
+ $("#login_form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
956
+
957
+ arr = arr.filter(function(v) {
958
+ return v.val && v.val.length;
959
+ });
960
+
961
+ var form = utils.arrToForm(arr);
962
+ form.lsd = utils.getFrom(html, "[\"LSD\",[],{\"token\":\"", "\"}");
963
+ form.lgndim = Buffer.from("{\"w\":1440,\"h\":900,\"aw\":1440,\"ah\":834,\"c\":24}").toString('base64');
964
+ form.email = email;
965
+ form.pass = password;
966
+ form.default_persistent = '0';
967
+ form.locale = 'en_US';
968
+ form.timezone = '240';
969
+ form.lgnjs = ~~(Date.now() / 1000);
970
+
971
+ html.split("\"_js_").slice(1).map((/** @type {any} */val) => {
972
+ jar.setCookie(utils.formatCookie(JSON.parse("[\"" + utils.getFrom(val, "", "]") + "]"), "facebook"),"https://www.facebook.com")
973
+ });
974
+
975
+ logger.Normal(Language.OnLogin);
976
+ return utils
977
+ .post("https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110", jar, form, loginOptions)
978
+ .then(utils.saveCookies(jar))
979
+ .then(function(/** @type {{ headers: any; }} */res) {
980
+ var headers = res.headers;
981
+ if (!headers.location) throw { error: Language.InvaildAccount };
982
+
983
+ // This means the account has login approvals turned on.
984
+ if (headers.location.indexOf('https://www.facebook.com/checkpoint/') > -1) {
985
+ logger.Warning(Language.TwoAuth);
986
+ var nextURL = 'https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php';
987
+
988
+ return utils
989
+ .get(headers.location, jar, null, loginOptions)
990
+ .then(utils.saveCookies(jar))
991
+ .then(async function(/** @type {{ body: any; }} */res) {
992
+ if (!await Database.get('ThroughAcc')) {
993
+ await Database.set('ThroughAcc', email);
994
+ }
995
+ else {
996
+ if (String((await Database.get('ThroughAcc'))).replace(RegExp('"','g'), '') != String(email).replace(RegExp('"','g'), '')) {
997
+ await Database.set('ThroughAcc', email);
998
+ if (await Database.get('Through2Fa')) {
999
+ await Database.delete('Through2Fa');
1000
+ }
1001
+ }
1002
+ }
1003
+ var html = res.body,$ = cheerio.load(html), arr = [];
1004
+ $("form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
1005
+ arr = arr.filter(v => { return v.val && v.val.length });
1006
+ var form = utils.arrToForm(arr);
1007
+ if (html.indexOf("checkpoint/?next") > -1) {
1008
+ setTimeout(() => {
1009
+ checkVerified = setInterval((_form) => {}, 5000, {
1010
+ fb_dtsg: form.fb_dtsg,
1011
+ jazoest: form.jazoest,
1012
+ dpr: 1
1013
+ });
1014
+ }, 2500);
1015
+ switch (global.Fca.Require.Priyansh.Login2Fa) {
1016
+ case true: {
1017
+ try {
1018
+ const question = question => {
1019
+ const rl = readline.createInterface({
1020
+ input: process.stdin,
1021
+ output: process.stdout
1022
+ });
1023
+ return new Promise(resolve => {
1024
+ rl.question(question, answer => {
1025
+ rl.close();
1026
+ return resolve(answer);
1027
+ });
1028
+ });
1029
+ };
1030
+ async function EnterSecurityCode() {
1031
+ try {
1032
+ var Through2Fa = await Database.get('Through2Fa');
1033
+ if (Through2Fa) {
1034
+ Through2Fa.map(function(/** @type {{ key: string; value: string; expires: string; domain: string; path: string; }} */c) {
1035
+ let str = c.key + "=" + c.value + "; expires=" + c.expires + "; domain=" + c.domain + "; path=" + c.path + ";";
1036
+ jar.setCookie(str, "http://" + c.domain);
1037
+ })
1038
+ var from2 = utils.arrToForm(arr);
1039
+ from2.lsd = utils.getFrom(html, "[\"LSD\",[],{\"token\":\"", "\"}");
1040
+ from2.lgndim = Buffer.from("{\"w\":1440,\"h\":900,\"aw\":1440,\"ah\":834,\"c\":24}").toString('base64');
1041
+ from2.email = email;
1042
+ from2.pass = password;
1043
+ from2.default_persistent = '0';
1044
+ from2.locale = 'en_US';
1045
+ from2.timezone = '240';
1046
+ from2.lgnjs = ~~(Date.now() / 1000);
1047
+ return utils
1048
+ .post("https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110", jar, from2, loginOptions)
1049
+ .then(utils.saveCookies(jar))
1050
+ .then(function(/** @type {{ headers: any; }} */res) {
1051
+ var headers = res.headers;
1052
+ if (!headers['set-cookie'][0].includes('deleted')) {
1053
+ logger.Warning(Language.ErrThroughCookies, async function() {
1054
+ await Database.delete('Through2Fa');
1055
+ });
1056
+ process.exit(1);
1057
+ }
1058
+ if (headers.location && headers.location.indexOf('https://www.facebook.com/checkpoint/') > -1) {
1059
+ return utils
1060
+ .get(headers.location, jar, null, loginOptions)
1061
+ .then(utils.saveCookies(jar))
1062
+ .then(function(/** @type {{ body: any; }} */res) {
1063
+ var html = res.body,$ = cheerio.load(html), arr = [];
1064
+ $("form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
1065
+ arr = arr.filter(v => { return v.val && v.val.length });
1066
+ var from2 = utils.arrToForm(arr);
1067
+
1068
+ if (html.indexOf("checkpoint/?next") > -1) {
1069
+ setTimeout(() => {
1070
+ checkVerified = setInterval((_form) => {}, 5000, {
1071
+ fb_dtsg: from2.fb_dtsg,
1072
+ jazoest: from2.jazoest,
1073
+ dpr: 1
1074
+ });
1075
+ }, 2500);
1076
+ if (!res.headers.location && res.headers['set-cookie'][0].includes('checkpoint')) {
1077
+ try {
1078
+ delete from2.name_action_selected;
1079
+ from2['submit[Continue]'] = $("#checkpointSubmitButton").html();
1080
+ return utils
1081
+ .post(nextURL, jar, from2, loginOptions)
1082
+ .then(utils.saveCookies(jar))
1083
+ .then(function() {
1084
+ from2['submit[This was me]'] = "This was me";
1085
+ return utils.post(nextURL, jar, from2, loginOptions).then(utils.saveCookies(jar));
1086
+ })
1087
+ .then(function() {
1088
+ delete from2['submit[This was me]'];
1089
+ from2.name_action_selected = 'save_device';
1090
+ from2['submit[Continue]'] = $("#checkpointSubmitButton").html();
1091
+ return utils.post(nextURL, jar, from2, loginOptions).then(utils.saveCookies(jar));
1092
+ })
1093
+ .then(async function(/** @type {{ headers: any; body: string | string[]; }} */res) {
1094
+ var headers = res.headers;
1095
+ if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) throw { error: "wtf ??:D" };
1096
+ var appState = utils.getAppState(jar,false);
1097
+ await Database.set('Through2Fa', appState);
1098
+ return loginHelper(appState, email, password, loginOptions, callback);
1099
+ })
1100
+ .catch((/** @type {any} */e) => callback(e));
1101
+ }
1102
+ catch (e) {
1103
+ console.log(e)
1104
+ }
1105
+ }
1106
+ }
1107
+ })
1108
+ }
1109
+ return utils.get('https://www.facebook.com/', jar, null, loginOptions).then(utils.saveCookies(jar));
1110
+ }).catch((/** @type {any} */e) => console.log(e));
1111
+ }
1112
+ }
1113
+ catch (e) {
1114
+ await Database.delete('Through2Fa');
1115
+ }
1116
+ var code = await question(Language.EnterSecurityCode);
1117
+ try {
1118
+ form.approvals_code = code;
1119
+ form['submit[Continue]'] = $("#checkpointSubmitButton").html();
1120
+ var prResolve,prReject;
1121
+ var rtPromise = new Promise((resolve, reject) => { prResolve = resolve; prReject = reject; });
1122
+ if (typeof code == "string") { //always strings
1123
+ utils
1124
+ .post(nextURL, jar, form, loginOptions)
1125
+ .then(utils.saveCookies(jar))
1126
+ .then(function(/** @type {{ body: string | Buffer; }} */res) {
1127
+ var $ = cheerio.load(res.body);
1128
+ var error = $("#approvals_code").parent().attr("data-xui-error");
1129
+ if (error) {
1130
+ logger.Warning(Language.InvaildTwoAuthCode,function() { EnterSecurityCode(); }); //bruh loop
1131
+ };
1132
+ })
1133
+ .then(function() {
1134
+ delete form.no_fido;delete form.approvals_code;
1135
+ form.name_action_selected = 'save_device'; //'save_device' || 'dont_save;
1136
+ return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
1137
+ })
1138
+ .then(async function(/** @type {{ headers: any; body: string | string[]; }} */res) {
1139
+ var headers = res.headers;
1140
+ if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) {
1141
+ try {
1142
+ delete form.name_action_selected;
1143
+ form['submit[Continue]'] = $("#checkpointSubmitButton").html();
1144
+ return utils
1145
+ .post(nextURL, jar, form, loginOptions)
1146
+ .then(utils.saveCookies(jar))
1147
+ .then(function() {
1148
+ form['submit[This was me]'] = "This was me";
1149
+ return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
1150
+ })
1151
+ .then(function() {
1152
+ delete form['submit[This was me]'];
1153
+ form.name_action_selected = 'save_device';
1154
+ form['submit[Continue]'] = $("#checkpointSubmitButton").html();
1155
+ return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
1156
+ })
1157
+ .then(async function(/** @type {{ headers: any; body: string | string[]; }} */res) {
1158
+ var headers = res.headers;
1159
+ if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) throw { error: "wtf ??:D" };
1160
+ var appState = utils.getAppState(jar,false);
1161
+ await Database.set('Through2Fa', appState);
1162
+ return loginHelper(appState, email, password, loginOptions, callback);
1163
+ })
1164
+ .catch((/** @type {any} */e) => callback(e));
1165
+ }
1166
+ catch (e) {
1167
+ console.log(e)
1168
+ }
1169
+ }
1170
+ var appState = utils.getAppState(jar,false);
1171
+ if (callback === prCallback) {
1172
+ callback = function(/** @type {any} */err, /** @type {any} */api) {
1173
+ if (err) return prReject(err);
1174
+ return prResolve(api);
1175
+ };
1176
+ }
1177
+ await Database.set('Through2Fa', appState);
1178
+ return loginHelper(appState, email, password, loginOptions, callback);
1179
+ })
1180
+ .catch(function(/** @type {any} */err) {
1181
+ if (callback === prCallback) prReject(err);
1182
+ else callback(err);
1183
+ });
1184
+ } else {
1185
+ utils
1186
+ .post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php", jar, form, loginOptions, null, { "Referer": "https://www.facebook.com/checkpoint/?next" })
1187
+ .then(utils.saveCookies(jar))
1188
+ .then(async function(/** @type {{ body: string; }} */res) {
1189
+ try {
1190
+ JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, ""));
1191
+ } catch (ex) {
1192
+ clearInterval(checkVerified);
1193
+ logger.Warning(Language.VerifiedCheck);
1194
+ if (callback === prCallback) {
1195
+ callback = function(/** @type {any} */err, /** @type {any} */api) {
1196
+ if (err) return prReject(err);
1197
+ return prResolve(api);
1198
+ };
1199
+ }
1200
+ let appState = utils.getAppState(jar,false);
1201
+ return loginHelper(appState, email, password, loginOptions, callback);
1202
+ }
1203
+ })
1204
+ .catch((/** @type {any} */ex) => {
1205
+ log.error("login", ex);
1206
+ if (callback === prCallback) prReject(ex);
1207
+ else callback(ex);
1208
+ });
1209
+ }
1210
+ return rtPromise;
1211
+ }
1212
+ catch (e) {
1213
+ logger.Error(e)
1214
+ logger.Error()
1215
+ process.exit(0)
1216
+ }
1217
+ }
1218
+ await EnterSecurityCode()
1219
+ }
1220
+ catch (e) {
1221
+ logger.Error(e)
1222
+ logger.Error();
1223
+ process.exit(0);
1224
+ }
1225
+ }
1226
+ break;
1227
+ case false: {
1228
+ throw {
1229
+ error: 'login-approval',
1230
+ continue: function submit2FA(/** @type {any} */code) {
1231
+ form.approvals_code = code;
1232
+ form['submit[Continue]'] = $("#checkpointSubmitButton").html(); //'Continue';
1233
+ var prResolve,prReject;
1234
+ var rtPromise = new Promise((resolve, reject) => { prResolve = resolve; prReject = reject; });
1235
+ if (typeof code == "string") {
1236
+ utils
1237
+ .post(nextURL, jar, form, loginOptions)
1238
+ .then(utils.saveCookies(jar))
1239
+ .then(function(/** @type {{ body: string | Buffer; }} */res) {
1240
+ var $ = cheerio.load(res.body);
1241
+ var error = $("#approvals_code").parent().attr("data-xui-error");
1242
+ if (error) {
1243
+ throw {
1244
+ error: 'login-approval',
1245
+ errordesc: Language.InvaildTwoAuthCode,
1246
+ lerror: error,
1247
+ continue: submit2FA
1248
+ };
1249
+ }
1250
+ })
1251
+ .then(function() {
1252
+ delete form.no_fido;delete form.approvals_code;
1253
+ form.name_action_selected = 'dont_save'; //'save_device' || 'dont_save;
1254
+ return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
1255
+ })
1256
+ .then(function(/** @type {{ headers: any; body: string | string[]; }} */res) {
1257
+ var headers = res.headers;
1258
+ if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) throw { error: Language.ApprovalsErr };
1259
+ var appState = utils.getAppState(jar,false);
1260
+ if (callback === prCallback) {
1261
+ callback = function(/** @type {any} */err, /** @type {any} */api) {
1262
+ if (err) return prReject(err);
1263
+ return prResolve(api);
1264
+ };
1265
+ }
1266
+ return loginHelper(appState, email, password, loginOptions, callback);
1267
+ })
1268
+ .catch(function(/** @type {any} */err) {
1269
+ if (callback === prCallback) prReject(err);
1270
+ else callback(err);
1271
+ });
1272
+ } else {
1273
+ utils
1274
+ .post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php", jar, form, loginOptions, null, { "Referer": "https://www.facebook.com/checkpoint/?next" })
1275
+ .then(utils.saveCookies(jar))
1276
+ .then((/** @type {{ body: string; }} */res) => {
1277
+ try {
1278
+ JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, ""));
1279
+ } catch (ex) {
1280
+ clearInterval(checkVerified);
1281
+ logger.Warning(Language.VerifiedCheck);
1282
+ if (callback === prCallback) {
1283
+ callback = function(/** @type {any} */err, /** @type {any} */api) {
1284
+ if (err) return prReject(err);
1285
+ return prResolve(api);
1286
+ };
1287
+ }
1288
+ return loginHelper(utils.getAppState(jar,false), email, password, loginOptions, callback);
1289
+ }
1290
+ })
1291
+ .catch((/** @type {any} */ex) => {
1292
+ log.error("login", ex);
1293
+ if (callback === prCallback) prReject(ex);
1294
+ else callback(ex);
1295
+ });
1296
+ }
1297
+ return rtPromise;
1298
+ }
1299
+ };
1300
+ }
1301
+ }
1302
+ } else {
1303
+ if (!loginOptions.forceLogin) throw { error: Language.ForceLoginNotEnable };
1304
+
1305
+ if (html.indexOf("Suspicious Login Attempt") > -1) form['submit[This was me]'] = "This was me";
1306
+ else form['submit[This Is Okay]'] = "This Is Okay";
1307
+
1308
+ return utils
1309
+ .post(nextURL, jar, form, loginOptions)
1310
+ .then(utils.saveCookies(jar))
1311
+ .then(function() {
1312
+ form.name_action_selected = 'dont_save';
1313
+
1314
+ return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
1315
+ })
1316
+ .then(function(/** @type {{ headers: any; body: string | string[]; }} */res) {
1317
+ var headers = res.headers;
1318
+
1319
+ if (!headers.location && res.body.indexOf('Review Recent Login') > -1) throw { error: "Something went wrong with review recent login." };
1320
+
1321
+ var appState = utils.getAppState(jar,false);
1322
+
1323
+ return loginHelper(appState, email, password, loginOptions, callback);
1324
+ })
1325
+ .catch((/** @type {any} */e) => callback(e));
1326
+ }
1327
+ });
1328
+ }
1329
+ return utils.get('https://www.facebook.com/', jar, null, loginOptions).then(utils.saveCookies(jar));
1330
+ });
1331
+ };
1332
+ }
1333
+
1334
+ /!-[ Function backup ]-!/
1335
+
1336
+ /**
1337
+ * @param {string} data
1338
+ * @param {any} globalOptions
1339
+ * @param {any} callback
1340
+ * @param {any} prCallback
1341
+ */
1342
+
1343
+ function backup(data,globalOptions, callback, prCallback) {
1344
+ try {
1345
+ var appstate;
1346
+ try {
1347
+ appstate = JSON.parse(data)
1348
+ }
1349
+ catch(e) {
1350
+ appstate = data;
1351
+ }
1352
+ logger.Warning(Language.BackupNoti);
1353
+ try {
1354
+ loginHelper(appstate,null,null,globalOptions, callback, prCallback)
1355
+ }
1356
+ catch (e) {
1357
+ logger.Error(Language.ErrBackup);
1358
+ process.exit(0);
1359
+ }
1360
+ }
1361
+ catch (e) {
1362
+ return logger.Error();
1363
+ }
1364
+ }
1365
+
1366
+ /!-[ async function loginHelper ]-!/
1367
+
1368
+ /**
1369
+ * @param {string | any[]} appState
1370
+ * @param {any} email
1371
+ * @param {any} password
1372
+ * @param {{ selfListen?: boolean; listenEvents?: boolean; listenTyping?: boolean; updatePresence?: boolean; forceLogin?: boolean; autoMarkDelivery?: boolean; autoMarkRead?: boolean; autoReconnect?: boolean; logRecordSize?: number; online?: boolean; emitReady?: boolean; userAgent?: string; pageID?: any; }} globalOptions
1373
+ * @param {(arg0: any, arg1: undefined) => void} callback
1374
+ * @param {(error: any, api: any) => any} [prCallback]
1375
+ */
1376
+
1377
+ async function loginHelper(appState, email, password, globalOptions, callback, prCallback) {
1378
+ var mainPromise = null;
1379
+ var jar = utils.getJar();
1380
+
1381
+ if (fs.existsSync('./backupappstate.json')) {
1382
+ fs.unlinkSync('./backupappstate.json');
1383
+ }
1384
+
1385
+ try {
1386
+ if (appState) {
1387
+ logger.Normal(Language.OnProcess);
1388
+ switch (await Database.has("FBKEY")) {
1389
+ case true: {
1390
+ process.env.FBKEY = await Database.get("FBKEY");
1391
+ }
1392
+ break;
1393
+ case false: {
1394
+ const SecurityKey = global.Fca.Require.Security.create().apiKey;
1395
+ process.env['FBKEY'] = SecurityKey;
1396
+ await Database.set('FBKEY', SecurityKey);
1397
+ }
1398
+ break;
1399
+ default: {
1400
+ const SecurityKey = global.Fca.Require.Security.create().apiKey;
1401
+ process.env['FBKEY'] = SecurityKey;
1402
+ await Database.set('FBKEY', SecurityKey);
1403
+ }
1404
+ }
1405
+ try {
1406
+ switch (global.Fca.Require.Priyansh.EncryptFeature) {
1407
+ case true: {
1408
+ appState = JSON.parse(JSON.stringify(appState, null, "\t"));
1409
+ switch (utils.getType(appState)) {
1410
+ case "Array": {
1411
+ switch (utils.getType(appState[0])) {
1412
+ case "Object": {
1413
+ logger.Normal(Language.NotReadyToDecrypt);
1414
+ }
1415
+ break;
1416
+ case "String": {
1417
+ appState = Security(appState,process.env['FBKEY'],'Decrypt');
1418
+ logger.Normal(Language.DecryptSuccess);
1419
+ }
1420
+ }
1421
+ }
1422
+ break;
1423
+ case "Object": {
1424
+ try {
1425
+ appState = StateCrypt.decryptState(appState, process.env['FBKEY']);
1426
+ logger.Normal(Language.DecryptSuccess);
1427
+ }
1428
+ catch (e) {
1429
+ if (process.env.Backup != undefined && process.env.Backup) {
1430
+ await backup(process.env.Backup,globalOptions, callback, prCallback);
1431
+ }
1432
+ else {
1433
+ try {
1434
+ if (await Database.has('Backup')) {
1435
+ return await backup(await Database.get('Backup'),globalOptions, callback, prCallback);
1436
+ }
1437
+ else {
1438
+ logger.Normal(Language.ErrBackup);
1439
+ process.exit(0);
1440
+ }
1441
+ }
1442
+ catch (e) {
1443
+ logger.Warning(Language.ErrBackup);
1444
+ logger.Error();
1445
+ process.exit(0);
1446
+ }
1447
+ }
1448
+ logger.Warning(Language.DecryptFailed);
1449
+ return logger.Error();
1450
+ }
1451
+ }
1452
+ break;
1453
+ case "String": {
1454
+ try {
1455
+ appState = StateCrypt.decryptState(appState, process.env['FBKEY']);
1456
+ logger.Normal(Language.DecryptSuccess);
1457
+ }
1458
+ catch (e) {
1459
+ if (process.env.Backup != undefined && process.env.Backup) {
1460
+ await backup(process.env.Backup,globalOptions, callback, prCallback);
1461
+ }
1462
+ else {
1463
+ try {
1464
+ if (await Database.has('Backup')) {
1465
+ return await backup(await Database.get('Backup'),globalOptions, callback, prCallback);
1466
+ }
1467
+ else {
1468
+ logger.Normal(Language.ErrBackup);
1469
+ process.exit(0);
1470
+ }
1471
+ }
1472
+ catch (e) {
1473
+ logger.Warning(Language.ErrBackup);
1474
+ logger.Error();
1475
+ process.exit(0);
1476
+ }
1477
+ }
1478
+ logger.Warning(Language.DecryptFailed);
1479
+ return logger.Error();
1480
+ }
1481
+ }
1482
+ break;
1483
+ default: {
1484
+ logger.Warning(Language.InvaildAppState);
1485
+ process.exit(0)
1486
+ }
1487
+ }
1488
+ }
1489
+ break;
1490
+ case false: {
1491
+ switch (utils.getType(appState)) {
1492
+ case "Array": {
1493
+ logger.Normal(Language.EncryptStateOff);
1494
+ }
1495
+ break;
1496
+ case "Object": {
1497
+ logger.Normal(Language.EncryptStateOff);
1498
+ try {
1499
+ appState = StateCrypt.decryptState(appState, process.env['FBKEY']);
1500
+ logger.Normal(Language.DecryptSuccess);
1501
+ }
1502
+ catch (e) {
1503
+ if (process.env.Backup != undefined && process.env.Backup) {
1504
+ await backup(process.env.Backup,globalOptions, callback, prCallback);
1505
+ }
1506
+ else {
1507
+ try {
1508
+ if (await Database.has('Backup')) {
1509
+ return await backup(await Database.get('Backup'),globalOptions, callback, prCallback);
1510
+ }
1511
+ else {
1512
+ logger.Warning(Language.ErrBackup);
1513
+ process.exit(0);
1514
+ }
1515
+ }
1516
+ catch (e) {
1517
+ logger.Warning(Language.ErrBackup);
1518
+ logger.Error();
1519
+ process.exit(0);
1520
+ }
1521
+ }
1522
+ logger.Warning(Language.DecryptFailed);
1523
+ return logger.Error();
1524
+ }
1525
+ }
1526
+ break;
1527
+ default: {
1528
+ logger.Warning(Language.InvaildAppState);
1529
+ process.exit(0)
1530
+ }
1531
+ }
1532
+ }
1533
+ break;
1534
+ default: {
1535
+ logger.Warning(getText(Language.IsNotABoolean,global.Fca.Require.Priyansh.EncryptFeature))
1536
+ process.exit(0);
1537
+ }
1538
+ }
1539
+ }
1540
+ catch (e) {
1541
+ console.log(e);
1542
+ }
1543
+
1544
+ try {
1545
+ appState = JSON.parse(appState);
1546
+ }
1547
+ catch (e) {
1548
+ try {
1549
+ appState = appState;
1550
+ }
1551
+ catch (e) {
1552
+ return logger.Error();
1553
+ }
1554
+ }
1555
+ try {
1556
+ global.Fca.Data.AppState = appState;
1557
+ appState.map(function(/** @type {{ key: string; value: string; expires: string; domain: string; path: string; }} */c) {
1558
+ var str = c.key + "=" + c.value + "; expires=" + c.expires + "; domain=" + c.domain + "; path=" + c.path + ";";
1559
+ jar.setCookie(str, "http://" + c.domain);
1560
+ });
1561
+ process.env.Backup = appState;
1562
+ await Database.set('Backup', appState);
1563
+ mainPromise = utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
1564
+ } catch (e) {
1565
+ console.log(e)
1566
+ if (process.env.Backup != undefined && process.env.Backup) {
1567
+ return await backup(process.env.Backup,globalOptions, callback, prCallback);
1568
+ }
1569
+ try {
1570
+ if (await Database.has('Backup')) {
1571
+ return await backup(await Database.get('Backup'),globalOptions, callback, prCallback);
1572
+ }
1573
+ else {
1574
+ logger.Warning(Language.ErrBackup);
1575
+ process.exit(0);
1576
+ }
1577
+ }
1578
+ catch (e) {
1579
+ logger.Warning(Language.ErrBackup);
1580
+ process.exit(0);
1581
+ }
1582
+ return logger.Warning(Language.ErrBackup); // unreachable 👑
1583
+ }
1584
+ } else {
1585
+ mainPromise = utils
1586
+ .get("https://www.facebook.com/", null, null, globalOptions, { noRef: true })
1587
+ .then(utils.saveCookies(jar))
1588
+ .then(makeLogin(jar, email, password, globalOptions, callback, prCallback))
1589
+ .then(function() {
1590
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions).then(utils.saveCookies(jar));
1591
+ });
1592
+ }
1593
+ } catch (e) {
1594
+ console.log(e);
1595
+ }
1596
+ var ctx,api;
1597
+ mainPromise = mainPromise
1598
+ .then(function(/** @type {{ body: string; }} */res) {
1599
+ var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/,redirect = reg.exec(res.body);
1600
+ if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1601
+ return res;
1602
+ })
1603
+ .then(function(/** @type {{ body: any; }} */res) {
1604
+ var html = res.body,Obj = buildAPI(globalOptions, html, jar);
1605
+ ctx = Obj.ctx;
1606
+ api = Obj.api;
1607
+ process.env.api = Obj.api;
1608
+ return res;
1609
+ });
1610
+ if (globalOptions.pageID) {
1611
+ mainPromise = mainPromise
1612
+ .then(function() {
1613
+ return utils.get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
1614
+ })
1615
+ .then(function(/** @type {{ body: any; }} */resData) {
1616
+ var url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
1617
+ url = url.substring(0, url.length - 1);
1618
+ return utils.get('https://www.facebook.com' + url, ctx.jar, null, globalOptions);
1619
+ });
1620
+ }
1621
+ mainPromise
1622
+ .then(function() {
1623
+ const { execSync } = require('child_process');
1624
+ Fetch('https://raw.githubusercontent.com/corazoncary/fca/main/package.json').then(async (/** @type {{ body: { toString: () => string; }; }} */res) => {
1625
+ const localVersion = global.Fca.Version;
1626
+ if (Number(localVersion.replace(/\./g,"")) < Number(JSON.parse(res.body.toString()).version.replace(/\./g,"")) ) {
1627
+ log.warn("[ FCA-PRIYANSH ] •",getText(Language.NewVersionFound,global.Fca.Version,JSON.parse(res.body.toString()).version));
1628
+ if (global.Fca.Require.Priyansh.AutoUpdate == true) {
1629
+ log.warn("[ FCA-PRIYANSH ] •",Language.AutoUpdate);
1630
+ try {
1631
+ execSync('npm install fca-priyansh@latest', { stdio: 'inherit' });
1632
+ logger.Success(Language.UpdateSuccess)
1633
+ logger.Normal(Language.RestartAfterUpdate);
1634
+ await new Promise(resolve => setTimeout(resolve,5*1000));
1635
+ console.clear();process.exit(1);
1636
+ }
1637
+ catch (err) {
1638
+ log.warn('Error Update: ' + err);
1639
+ logger.Normal(Language.UpdateFailed);
1640
+ try {
1641
+ const fs = require('fs-extra')
1642
+ try {
1643
+ logger.Error('succeess Package');
1644
+ execSync('npm cache clean --force', { stdio: 'ignore'})
1645
+ await new Promise(resolve => setTimeout(resolve, 2*1000))
1646
+ fs.removeSync('../fca-priyansh');
1647
+ // why stdio is not studio :v
1648
+ await new Promise(resolve => setTimeout(resolve, 2*1000))
1649
+ execSync('npm i fca-priyansh@latest', { stdio: 'inherit'})
1650
+ logger.Success("success Restart");
1651
+ process.exit(1);
1652
+ }
1653
+ catch (e) {
1654
+ logger.Warning("Error Please Enter The Following Code In Console To Fix !");
1655
+ logger.Warning("rmdir -rf ./node_modules/fca-priyansh && npm i fca-priyansh@latest && npm start");
1656
+ logger.Warning("Please Copy All The Above Words, Need To Do It 100% Correctly Otherwise Your File Will Be Discolored ✨")
1657
+ process.exit(0);
1658
+ }
1659
+ }
1660
+ catch (e) {
1661
+ logger.Error(Language.NotiAfterUseToolFail)
1662
+ logger.Warning("rmdir ./node_modules after type npm i && npm start");
1663
+ process.exit(0);
1664
+ }
1665
+ }
1666
+ }
1667
+ }
1668
+ else {
1669
+ logger.Normal(getText(Language.LocalVersion,localVersion));
1670
+ logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1671
+ logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
1672
+ require('./Extra/ExtraUptimeRobot')();
1673
+ DataLanguageSetting.HTML.HTML==true? global.Fca.Require.Web.listen(global.Fca.Require.Web.get('DFP')) : global.Fca.Require.Web = null;
1674
+ callback(null, api);
1675
+ };
1676
+ }).catch(async function(e) {
1677
+ console.log(e)
1678
+ logger.Warning(Language.AutoCheckUpdateFailure)
1679
+ logger.Normal(getText(Language.LocalVersion,global.Fca.Version));
1680
+ logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1681
+ logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
1682
+ require('./Extra/ExtraUptimeRobot')();
1683
+ DataLanguageSetting.HTML.HTML==true? global.Fca.Require.Web.listen(global.Fca.Require.Web.get('DFP')) : global.Fca.Require.Web = null;
1684
+ callback(null, api);
1685
+ });
1686
+ }).catch(function(/** @type {{ error: any; }} */e) {
1687
+ log.error("login", e.error || e);
1688
+ callback(e);
1689
+ });
1690
+ }
1691
+
1692
+ /**
1693
+ * It asks the user for their account and password, and then saves it to the database.
1694
+ */
1695
+
1696
+ /*async function setUserNameAndPassWord() {
1697
+ let rl = readline.createInterface({
1698
+ input: process.stdin,
1699
+ output: process.stdout
1700
+ });
1701
+ let localbrand2 = global.Fca.Version
1702
+ console.clear();
1703
+ console.log(figlet.textSync('Horizon', {font: 'ANSI Shadow',horizontalLayout: 'default',verticalLayout: 'default',width: 0,whitespaceBreak: true }));
1704
+ console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Operating System: " + chalk.bold.red(os.type()));
1705
+ console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Machine Version: " + chalk.bold.red(os.version()));
1706
+ console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Fca Version: " + chalk.bold.red(localbrand2) + '\n');
1707
+ try {
1708
+ const configPath = process.argv[2] || "./acc.json";
1709
+ const config = require(configPath);
1710
+ const Account = config.EMAIL;
1711
+ const Password = config.PASSWORD;
1712
+
1713
+ try {
1714
+ await Database.set("Account", Account);
1715
+ await Database.set("Password", Password);
1716
+ }
1717
+ catch (e) {
1718
+ logger.Warning(Language.ErrDataBase);
1719
+ logger.Error();
1720
+ process.exit(0);
1721
+ }
1722
+ if (global.Fca.Require.Priyansh.ResetDataLogin) {
1723
+ global.Fca.Require.Priyansh.ResetDataLogin = false;
1724
+ global.Fca.Require.fs.writeFileSync(process.cwd() + '/PriyanshFca.json', JSON.stringify(global.Fca.Require.Priyansh, null, 4));
1725
+ }
1726
+ logger.Success(Language.SuccessSetData);
1727
+ process.exit(1);
1728
+ }
1729
+ catch (e) {
1730
+ logger.Error(e)
1731
+ }
1732
+ }
1733
+
1734
+ module.exports = setUserNameAndPassWord;
1735
+ */
1736
+
1737
+ const config = require('./../../config.json');
1738
+
1739
+ function setUserNameAndPassWord() {
1740
+ let rl = readline.createInterface({
1741
+ input: process.stdin,
1742
+ output: process.stdout
1743
+ });
1744
+ let localbrand2 = global.Fca.Version;
1745
+ console.clear();
1746
+ console.log(figlet.textSync('Horizon', {font: 'ANSI Shadow', horizontalLayout: 'default', verticalLayout: 'default', width: 0, whitespaceBreak: true }));
1747
+ console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Operating System: " + chalk.bold.red(os.type()));
1748
+ console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Machine Version: " + chalk.bold.red(os.version()));
1749
+ console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Fca Version: " + chalk.bold.red(localbrand2) + '\n');
1750
+
1751
+ try {
1752
+ const Account = config.EMAIL; // Fetch account from config
1753
+ const Password = config.PASSWORD; // Fetch password from config
1754
+ // Wrap the following code in a Promise to use async/await
1755
+ new Promise(async (resolve, reject) => {
1756
+ try {
1757
+ // Save account and password to database
1758
+ await Database.set("Account", Account);
1759
+ await Database.set("Password", Password);
1760
+ resolve();
1761
+ } catch (e) {
1762
+ reject(e);
1763
+ }
1764
+ }).then(() => {
1765
+ if (global.Fca.Require.Priyansh.ResetDataLogin) {
1766
+ global.Fca.Require.Priyansh.ResetDataLogin = false;
1767
+ global.Fca.Require.fs.writeFileSync(process.cwd() + '/PriyanshFca.json', JSON.stringify(global.Fca.Require.Priyansh, null, 4));
1768
+ }
1769
+ logger.Success(Language.SuccessSetData);
1770
+ process.exit(1);
1771
+ }).catch((error) => {
1772
+ logger.Warning(Language.ErrDataBase);
1773
+ logger.Error();
1774
+ process.exit(0);
1775
+ });
1776
+ } catch (e) {
1777
+ logger.Error(e);
1778
+ }
1779
+ }
1780
+
1781
+ /**
1782
+ * @param {{ email: any; password: any; appState: any; }} loginData
1783
+ * @param {{}} options
1784
+ * @param {(error: any, api: any) => any} callback
1785
+ */
1786
+
1787
+ function login(loginData, options, callback) {
1788
+
1789
+ if (utils.getType(loginData) == "Array") {
1790
+ if (loginData.length == 3) {
1791
+ options = loginData[1];
1792
+ callback = loginData[2];
1793
+ loginData = loginData[0]
1794
+ }
1795
+ else if (loginData.length == 2) {
1796
+ options = loginData[1];
1797
+ loginData = loginData[0]
1798
+ }
1799
+ else {
1800
+ loginData = loginData[0]
1801
+ }
1802
+ }
1803
+
1804
+ if (utils.getType(options) === 'Function' || utils.getType(options) === 'AsyncFunction') {
1805
+ callback = options;
1806
+ options = {};
1807
+ }
1808
+
1809
+ var globalOptions = {
1810
+ selfListen: true,
1811
+ listenEvents: true,
1812
+ listenTyping: true,
1813
+ updatePresence: false,
1814
+ forceLogin: false,
1815
+ autoMarkDelivery: true,
1816
+ autoMarkRead: true,
1817
+ autoReconnect: true,
1818
+ logRecordSize: 100,
1819
+ online: true,
1820
+ emitReady: false,
1821
+ 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"
1822
+ };
1823
+
1824
+ if (loginData.email && loginData.password) {
1825
+ setOptions(globalOptions, {
1826
+ logLevel: "silent",
1827
+ forceLogin: true,
1828
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36"
1829
+ });
1830
+ }
1831
+ else if (loginData.appState) {
1832
+ setOptions(globalOptions, options);
1833
+ }
1834
+
1835
+ var prCallback = null;
1836
+ if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
1837
+ var rejectFunc = null;
1838
+ var resolveFunc = null;
1839
+ var returnPromise = new Promise(function(resolve, reject) {
1840
+ resolveFunc = resolve;
1841
+ rejectFunc = reject;
1842
+ });
1843
+ prCallback = function(/** @type {any} */error, /** @type {any} */api) {
1844
+ if (error) return rejectFunc(error);
1845
+ return resolveFunc(api);
1846
+ };
1847
+ callback = prCallback;
1848
+ }
1849
+
1850
+ (async function() {
1851
+ var Premium = require("./Extra/Src/Premium");
1852
+ global.Fca.Data.PremText = await Premium(global.Fca.Require.Security.create().uuid) || "Bạn Đang Sài Phiên Bản: Free !";
1853
+ if (!loginData.email && !loginData.password) {
1854
+ switch (global.Fca.Require.Priyansh.AutoLogin) {
1855
+ case true: {
1856
+ if (global.Fca.Require.Priyansh.ResetDataLogin) return setUserNameAndPassWord();
1857
+ else {
1858
+ try {
1859
+ if (await Database.get("TempState")) {
1860
+ try {
1861
+ loginData.appState = JSON.parse(await Database.get("TempState"));
1862
+ }
1863
+ catch (_) {
1864
+ loginData.appState = await Database.get("TempState");
1865
+ }
1866
+ await Database.delete("TempState");
1867
+ }
1868
+ }
1869
+ catch (e) {
1870
+ console.log(e)
1871
+ await Database.delete("TempState");
1872
+ logger.Warning(Language.ErrDataBase);
1873
+ logger.Error();
1874
+ process.exit(0);
1875
+ }
1876
+ try {
1877
+ if (await Database.has('Account') && await Database.has('Password')) return loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
1878
+ else return setUserNameAndPassWord();
1879
+ }
1880
+ catch (e) {
1881
+ console.log(e)
1882
+ logger.Warning(Language.ErrDataBase);
1883
+ logger.Error();
1884
+ process.exit(0);
1885
+ }
1886
+ }
1887
+ }
1888
+ case false: {
1889
+ loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
1890
+ }
1891
+ }
1892
+ }
1893
+ else loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
1894
+ })()
1895
+ return returnPromise;
1896
+ }
1897
+
1898
+ module.exports = login;