fca-nayan-r 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fca-nayan-r might be problematic. Click here for more details.
- package/.cache/replit/__replit_disk_meta.json +1 -0
- package/.cache/replit/nix/env.json +1 -0
- package/.config/configstore/update-notifier-npm.json +4 -0
- package/.config/configstore/update-notifier-npm.json.1735545094 +4 -0
- package/.gitattributes +2 -0
- package/.replit +80 -0
- package/.upm/store.json +1 -0
- package/Extra/Database/index.js +469 -0
- package/Extra/ExtraAddons.js +82 -0
- package/Extra/ExtraFindUID.js +62 -0
- package/Extra/ExtraGetThread.js +340 -0
- package/Extra/ExtraScreenShot.js +430 -0
- package/Extra/ExtraUptimeRobot.js +38 -0
- package/Extra/Html/Classic/script.js +119 -0
- package/Extra/Html/Classic/style.css +8 -0
- package/Extra/Security/Index.js +146 -0
- package/Extra/Security/Step_1.js +6 -0
- package/Extra/Security/Step_2.js +22 -0
- package/Extra/Security/Step_3.js +22 -0
- package/Extra/Src/Change_Environment.js +24 -0
- package/Extra/Src/Check_Update.js +67 -0
- package/Extra/Src/History.js +115 -0
- package/Extra/Src/Instant_Update.js +65 -0
- package/Extra/Src/Last-Run.js +65 -0
- package/Extra/Src/Premium.js +81 -0
- package/Extra/Src/Release_Memory.js +41 -0
- package/Extra/Src/uuid.js +137 -0
- package/Func/AcceptAgreement.js +32 -0
- package/Func/ClearCache.js +64 -0
- package/Func/ReportV1.js +54 -0
- package/LICENSE +21 -0
- package/Language/index.json +207 -0
- package/Main.js +1095 -0
- package/README.md +140 -0
- package/SECURITY.md +17 -0
- package/broadcast.js +40 -0
- package/index.js +351 -0
- package/logger.js +66 -0
- package/package.json +94 -0
- package/replit.nix +8 -0
- package/src/Dev_Horizon_Data.js +125 -0
- package/src/Premium.js +30 -0
- package/src/Screenshot.js +83 -0
- package/src/addExternalModule.js +16 -0
- package/src/addUserToGroup.js +79 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +41 -0
- package/src/changeAvt.js +85 -0
- package/src/changeBio.js +65 -0
- package/src/changeBlockedStatus.js +36 -0
- package/src/changeGroupImage.js +106 -0
- package/src/changeNickname.js +45 -0
- package/src/changeThreadColor.js +62 -0
- package/src/changeThreadEmoji.js +42 -0
- package/src/createNewGroup.js +70 -0
- package/src/createPoll.js +60 -0
- package/src/deleteMessage.js +45 -0
- package/src/deleteThread.js +43 -0
- package/src/forwardAttachment.js +48 -0
- package/src/getAccessToken.js +28 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +27 -0
- package/src/getFriendsList.js +73 -0
- package/src/getMessage.js +80 -0
- package/src/getThreadHistory.js +537 -0
- package/src/getThreadInfo.js +440 -0
- package/src/getThreadList.js +213 -0
- package/src/getThreadMain.js +220 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getUID.js +59 -0
- package/src/getUserID.js +62 -0
- package/src/getUserInfo.js +113 -0
- package/src/getUserInfoMain.js +65 -0
- package/src/getUserInfoV2.js +32 -0
- package/src/getUserInfoV3.js +63 -0
- package/src/getUserInfoV4.js +55 -0
- package/src/getUserInfoV5.js +61 -0
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +49 -0
- package/src/httpGet.js +49 -0
- package/src/httpPost.js +48 -0
- package/src/httpPostFormData.js +41 -0
- package/src/listenMqtt.js +790 -0
- package/src/logout.js +68 -0
- package/src/markAsDelivered.js +48 -0
- package/src/markAsRead.js +70 -0
- package/src/markAsReadAll.js +43 -0
- package/src/markAsSeen.js +51 -0
- package/src/muteThread.js +47 -0
- package/src/removeUserFromGroup.js +49 -0
- package/src/resolvePhotoUrl.js +37 -0
- package/src/searchForThread.js +43 -0
- package/src/sendMessage.js +334 -0
- package/src/sendTypingIndicator.js +80 -0
- package/src/setMessageReaction.js +109 -0
- package/src/setPostReaction.js +102 -0
- package/src/setTitle.js +74 -0
- package/src/threadColors.js +39 -0
- package/src/unfriend.js +43 -0
- package/src/unsendMessage.js +40 -0
- package/test/Database_Test.js +4 -0
- package/test/Db2.js +530 -0
- package/test/Horizon_Database/A_README.md +1 -0
- package/test/Horizon_Database/Database.db +0 -0
- package/test/Nayan_Database/A_README.md +1 -0
- package/test/Nayan_Database/Database.db +0 -0
- package/test/Nayan_Database/N +1 -0
- package/test/data/shareAttach.js +146 -0
- package/test/data/something.mov +0 -0
- package/test/data/test.png +0 -0
- package/test/data/test.txt +7 -0
- package/test/env/.env +0 -0
- package/test/env.env +0 -0
- package/test/example-config.json +18 -0
- package/test/example-db.db +0 -0
- package/test/memoryleak.js +18 -0
- package/test/test-page.js +140 -0
- package/test/test.js +385 -0
- package/test/testv2.js +18 -0
- package/utils.js +1639 -0
package/README.md
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
[![Socket Badge](https://socket.dev/api/badge/npm/package/fca-horizon-remastered)](https://socket.dev/npm/package/fca-horizon-remastered)
|
2
|
+
|
3
|
+
## Important !
|
4
|
+
|
5
|
+
This package require NodeJS 14.17.0 to work properly.
|
6
|
+
|
7
|
+
## Notification !
|
8
|
+
|
9
|
+
+ We will have Example Video on Channel "Nguyễn Thái Hảo Official"
|
10
|
+
|
11
|
+
Original Project(Deprecated): https://github.com/Schmavery/facebook-chat-api
|
12
|
+
|
13
|
+
Chúc các bạn một ngày tốt lành!, cảm ơn vì đã sài Sản phẩm của HZI, thân ái
|
14
|
+
|
15
|
+
KANZUWAKAZAKI(15/04/2023)
|
16
|
+
|
17
|
+
## Support For :
|
18
|
+
|
19
|
+
+ Support English, VietNamese !,
|
20
|
+
+ All bot if using listenMqtt first.
|
21
|
+
|
22
|
+
# Api Cho ChatBot Messenger
|
23
|
+
|
24
|
+
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).
|
25
|
+
|
26
|
+
### 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é =))
|
27
|
+
|
28
|
+
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).
|
29
|
+
|
30
|
+
## Tải Về
|
31
|
+
|
32
|
+
Nếu Bạn Muốn Sử Dụng, Hãy Tải Nó Bằng Cách:
|
33
|
+
```bash
|
34
|
+
npm i fca-horizon-remastered
|
35
|
+
```
|
36
|
+
or
|
37
|
+
```bash
|
38
|
+
npm install fca-horizon-remastered
|
39
|
+
```
|
40
|
+
|
41
|
+
Nó Sẽ Tải Vô node_modules (Lib Của Bạn) - Lưu Ý Replit Sẽ Không Hiện Đâu Mà Tìm 😪
|
42
|
+
|
43
|
+
### Tải Bản Mới Nhất Hoặc Update
|
44
|
+
|
45
|
+
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 :
|
46
|
+
```bash
|
47
|
+
npm install fca-horizon-remastered@latest
|
48
|
+
```
|
49
|
+
Hoặc
|
50
|
+
```bash
|
51
|
+
npm i fca-horizon-remastered@latest
|
52
|
+
```
|
53
|
+
|
54
|
+
## Nếu Bạn Muốn Test Api
|
55
|
+
|
56
|
+
Lợi Ích Cho Việc Này Thì Bạn Sẽ Không Tốn Thời Gian Pay Acc Và Có Acc 😪
|
57
|
+
Hãy Sử Dụng Với Tài Khoản Thử Nghiệm => [Facebook Whitehat Accounts](https://www.facebook.com/whitehat/accounts/).
|
58
|
+
|
59
|
+
## Cách Sử Dụng
|
60
|
+
|
61
|
+
```javascript
|
62
|
+
const login = require("fca-horizon-remastered"); // lấy từ lib ra
|
63
|
+
|
64
|
+
// đăng nhập
|
65
|
+
login({email: "Gmail Account", password: "Mật Khẩu Facebook Của Bạn"}, (err, api) => {
|
66
|
+
|
67
|
+
if(err) return console.error(err); // trường hợp lỗi
|
68
|
+
|
69
|
+
// tạo bot tự động nhái theo bạn:
|
70
|
+
api.listenMqtt((err, message) => {
|
71
|
+
api.sendMessage(message.body, message.threadID);
|
72
|
+
});
|
73
|
+
|
74
|
+
});
|
75
|
+
```
|
76
|
+
|
77
|
+
Kết Quả Là Nó Sẽ Nhái Bạn Như Hình Dưới:
|
78
|
+
<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">
|
79
|
+
|
80
|
+
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 !
|
81
|
+
|
82
|
+
## Danh Sách
|
83
|
+
|
84
|
+
Bạn Có Thể Đọc Full Api Tại => [here](DOCS.md).
|
85
|
+
|
86
|
+
## Cài Đặt Cho Mirai:
|
87
|
+
|
88
|
+
Bạn Cần Vô File Mirai.js,Sau Đó Tìm Đến Dòng
|
89
|
+
```js
|
90
|
+
var login = require('tùy bot');
|
91
|
+
/* Có thể là :
|
92
|
+
var login = require('@maihuybao/fca-Unofficial');
|
93
|
+
var login = require('fca-xuyen-get');
|
94
|
+
var login = require('fca-unofficial-force');
|
95
|
+
...
|
96
|
+
*/
|
97
|
+
```
|
98
|
+
|
99
|
+
Và Thay Nó Bằng:
|
100
|
+
|
101
|
+
```js
|
102
|
+
var login = require('fca-horizon-remastered')
|
103
|
+
```
|
104
|
+
|
105
|
+
Sau Đó Thì Chạy Bình Thường Thôi !
|
106
|
+
|
107
|
+
## Tự Nghiên Cứu
|
108
|
+
|
109
|
+
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)
|
110
|
+
|
111
|
+
------------------------------------
|
112
|
+
|
113
|
+
### Lưu Lại Thông Tin Đăng Nhập.
|
114
|
+
|
115
|
+
Để 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 !
|
116
|
+
|
117
|
+
Và Chế Độ Này Đã Có Sẵn Trong 1 Số Bot Việt Nam Nên Bạn Cứ Yên Tâm Nhé !
|
118
|
+
|
119
|
+
__Hướng Dẫn Với Appstate__
|
120
|
+
|
121
|
+
```js
|
122
|
+
const fs = require("fs");
|
123
|
+
const login = require("fca-horizon-remastered");
|
124
|
+
|
125
|
+
var credentials = {email: "FB_EMAIL", password: "FB_PASSWORD"}; // thông tin tk
|
126
|
+
|
127
|
+
login(credentials, (err, api) => {
|
128
|
+
if(err) return console.error(err);
|
129
|
+
// đăng nhập
|
130
|
+
fs.writeFileSync('appstate.json', JSON.stringify(api.getAppState(), null,'\t')); //tạo appstate
|
131
|
+
});
|
132
|
+
```
|
133
|
+
|
134
|
+
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)
|
135
|
+
|
136
|
+
------------------------------------
|
137
|
+
|
138
|
+
## FAQS
|
139
|
+
|
140
|
+
FAQS => [Link](https://github.com/Schmavery/facebook-chat-api#FAQS)
|
package/SECURITY.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
+ if have any Vulnerability finded contact: Author(KanzuWakazaki.Main@proton.me) or (Facebook.com/Lazic.Kanzu). Thanks!
|
4
|
+
|
5
|
+
## Supported Versions
|
6
|
+
|
7
|
+
Use this section to tell people about which versions of your project are
|
8
|
+
currently being supported with security updates.
|
9
|
+
|
10
|
+
| Version | Supported |
|
11
|
+
| ------- | ------------------ |
|
12
|
+
| Main Version With Autoupdate | :white_check_mark: |
|
13
|
+
| Old Version | :x:|
|
14
|
+
|
15
|
+
## Reporting a Vulnerability
|
16
|
+
|
17
|
+
Contact Author
|
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/KanzuXHorizon/Global_Horizon/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
|
+
},1800 * 1000);
|
33
|
+
}
|
34
|
+
case false: {
|
35
|
+
break;
|
36
|
+
}
|
37
|
+
default: {
|
38
|
+
break;
|
39
|
+
}
|
40
|
+
}
|
package/index.js
ADDED
@@ -0,0 +1,351 @@
|
|
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": "en",
|
27
|
+
"PreKey": "",
|
28
|
+
"AutoUpdate": true,
|
29
|
+
"MainColor": "#9900FF",
|
30
|
+
"MainName": "[ NAYAN ]",
|
31
|
+
"Uptime": false,
|
32
|
+
"Config": "default",
|
33
|
+
"Login2Fa": false,
|
34
|
+
"AutoLogin": false,
|
35
|
+
"BroadCast": true,
|
36
|
+
"AuthString": "SD4S XQ32 O2JA WXB3 FUX2 OPJ7 Q7JZ 4R6Z | https://i.imgur.com/RAg3rvw.png Please remove this !, Recommend If You Using getUserInfoV2",
|
37
|
+
"EncryptFeature": true,
|
38
|
+
"ResetDataLogin": false,
|
39
|
+
"AutoRestartMinutes": 0,
|
40
|
+
"RestartMQTT_Minutes": 0,
|
41
|
+
"DevMode": false,
|
42
|
+
"HTML": {
|
43
|
+
"HTML": true,
|
44
|
+
"UserName": "Guest",
|
45
|
+
"MusicLink": "https://drive.google.com/uc?id=1zlAALlxk1TnO7jXtEP_O6yvemtzA2ukA&export=download"
|
46
|
+
},
|
47
|
+
"AntiGetInfo": {
|
48
|
+
"Database_Type": "default", //json or default
|
49
|
+
"AntiGetThreadInfo": true,
|
50
|
+
"AntiGetUserInfo": true
|
51
|
+
},
|
52
|
+
"Stable_Version": {
|
53
|
+
"Accept": false,
|
54
|
+
"Version": ""
|
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
|
+
Action: function(Type) {
|
76
|
+
switch (Type) {
|
77
|
+
case "AutoLogin": {
|
78
|
+
var Database = require('./Extra/Database');
|
79
|
+
var logger = global.Fca.Require.logger;
|
80
|
+
var Email = (Database().get('Account')).replace(RegExp('"', 'g'), ''); //hmm IDK
|
81
|
+
var PassWord = (Database().get('Password')).replace(RegExp('"', 'g'), '');
|
82
|
+
require('./Main')({ email: Email, password: PassWord},async (error, api) => {
|
83
|
+
if (error) {
|
84
|
+
logger.Error(JSON.stringify(error,null,2), function() { logger.Error("AutoLogin Failed!", function() { process.exit(0); }) });
|
85
|
+
}
|
86
|
+
try {
|
87
|
+
Database().set("TempState", api.getAppState());
|
88
|
+
}
|
89
|
+
catch(e) {
|
90
|
+
logger.Warning(global.Fca.Require.Language.Index.ErrDatabase);
|
91
|
+
logger.Error();
|
92
|
+
process.exit(0);
|
93
|
+
}
|
94
|
+
process.exit(1);
|
95
|
+
});
|
96
|
+
}
|
97
|
+
break;
|
98
|
+
default: {
|
99
|
+
require('npmlog').Error("Invalid Message!");
|
100
|
+
};
|
101
|
+
}
|
102
|
+
}
|
103
|
+
});
|
104
|
+
|
105
|
+
try {
|
106
|
+
let Boolean_Fca = ["AutoUpdate","Uptime","BroadCast","EncryptFeature","AutoLogin","ResetDataLogin","Login2Fa", "DevMode"];
|
107
|
+
let String_Fca = ["MainName","PreKey","Language","AuthString","Config"]
|
108
|
+
let Number_Fca = ["AutoRestartMinutes","RestartMQTT_Minutes"];
|
109
|
+
let Object_Fca = ["HTML","Stable_Version","AntiGetInfo"];
|
110
|
+
let All_Variable = Boolean_Fca.concat(String_Fca,Number_Fca,Object_Fca);
|
111
|
+
|
112
|
+
|
113
|
+
if (!global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigNayan.json')) {
|
114
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigNayan.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
|
115
|
+
process.exit(1);
|
116
|
+
}
|
117
|
+
|
118
|
+
try {
|
119
|
+
var Data_Setting = require(process.cwd() + "/FastConfigNayan.json");
|
120
|
+
}
|
121
|
+
catch (e) {
|
122
|
+
global.Fca.Require.logger.Error('Detect Your FastConfigNayan Settings Invalid!, Carry out default restoration');
|
123
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigNayan.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
|
124
|
+
process.exit(1)
|
125
|
+
}
|
126
|
+
if (global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigNayan.json')) {
|
127
|
+
try {
|
128
|
+
if (Data_Setting.AntiGetInfo != undefined && Data_Setting.AntiGetInfo.Database_Type == undefined) {
|
129
|
+
Data_Setting.AntiGetInfo.Database_Type = "default";
|
130
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigNayan.json", JSON.stringify(Data_Setting, null, "\t"));
|
131
|
+
}
|
132
|
+
}
|
133
|
+
catch (e) {
|
134
|
+
console.log(e);
|
135
|
+
}
|
136
|
+
if (!global.Fca.Require.languageFile.some((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language)) {
|
137
|
+
global.Fca.Require.logger.Warning("Not Support Language: " + Data_Setting.Language + " Only 'en' and 'vi'");
|
138
|
+
process.exit(0);
|
139
|
+
}
|
140
|
+
for (let i of All_Variable) {
|
141
|
+
if (Data_Setting[i] == undefined) {
|
142
|
+
Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
|
143
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigNayan.json", JSON.stringify(Data_Setting, null, "\t"));
|
144
|
+
}
|
145
|
+
else continue;
|
146
|
+
}
|
147
|
+
for (let i in Data_Setting) {
|
148
|
+
if (Boolean_Fca.includes(i)) {
|
149
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Boolean") return logger.Error(i + " Is Not A Boolean, Need To Be true Or false !", function() { process.exit(0) });
|
150
|
+
else continue;
|
151
|
+
}
|
152
|
+
else if (String_Fca.includes(i)) {
|
153
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "String") return logger.Error(i + " Is Not A String, Need To Be String!", function() { process.exit(0) });
|
154
|
+
else continue;
|
155
|
+
}
|
156
|
+
else if (Number_Fca.includes(i)) {
|
157
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Number") return logger.Error(i + " Is Not A Number, Need To Be Number !", function() { process.exit(0) });
|
158
|
+
else continue;
|
159
|
+
}
|
160
|
+
else if (Object_Fca.includes(i)) {
|
161
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Object") {
|
162
|
+
Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
|
163
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigNayan.json", JSON.stringify(Data_Setting, null, "\t"));
|
164
|
+
}
|
165
|
+
else continue;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
global.Fca.Require.Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language).Folder;
|
169
|
+
} else process.exit(1);
|
170
|
+
global.Fca.Require.FastConfig = Data_Setting;
|
171
|
+
}
|
172
|
+
catch (e) {
|
173
|
+
console.log(e);
|
174
|
+
global.Fca.Require.logger.Error();
|
175
|
+
}
|
176
|
+
|
177
|
+
module.exports = function(loginData, options, callback) {
|
178
|
+
const Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == global.Fca.Require.FastConfig.Language).Folder.Index;
|
179
|
+
const login = require('./Main');
|
180
|
+
const fs = require('fs-extra');
|
181
|
+
const got = require('got');
|
182
|
+
const log = require('npmlog');
|
183
|
+
const { execSync } = require('child_process');
|
184
|
+
const Database = require('./Extra/Database');
|
185
|
+
|
186
|
+
if (global.Fca.Require.FastConfig.DevMode) {
|
187
|
+
require('./Extra/Src/Release_Memory');
|
188
|
+
}
|
189
|
+
|
190
|
+
return got.get('https://github.com/NAYAN-BOT69/Nayan-api/blob/main/Extra/Src/Instant_Update.js').then(async function(res) {
|
191
|
+
if (global.Fca.Require.FastConfig.DevMode) {
|
192
|
+
switch (fs.existsSync(process.cwd() + "/replit.nix") && process.env["REPL_ID"] != undefined) {
|
193
|
+
case true: {
|
194
|
+
await require('./Extra/Src/Change_Environment.js')();
|
195
|
+
break;
|
196
|
+
}
|
197
|
+
case false: {
|
198
|
+
const NodeVersion = execSync('node -v').toString().replace(/(\r\n|\n|\r)/gm, "");
|
199
|
+
if (!NodeVersion.includes("v14") && !NodeVersion.includes("v16") && !Database(true).has('SkipReplitNix')) {
|
200
|
+
log.warn("[ NAYAN-UPDATE ] •",global.Fca.getText(Language.NodeVersionNotSupported, NodeVersion));
|
201
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
202
|
+
try {
|
203
|
+
switch (process.platform) {
|
204
|
+
case "win32": {
|
205
|
+
try {
|
206
|
+
//check if user using nvm
|
207
|
+
if (fs.existsSync(process.env.APPDATA + "/nvm/nvm.exe")) {
|
208
|
+
log.warn("[ NAYAN-UPDATE ] •", Language.UsingNVM);
|
209
|
+
process.exit(0);
|
210
|
+
}
|
211
|
+
//download NodeJS v14 for Windows and slient install
|
212
|
+
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"));
|
213
|
+
log.info("[ NAYAN-UPDATE ] •", Language.DownloadingNode);
|
214
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
215
|
+
execSync('msiexec /i node-v14.17.0-x64.msi /qn');
|
216
|
+
log.info("[ NAYAN-UPDATE ] •", Language.NodeDownloadingComplete);
|
217
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
218
|
+
log.info("[ NAYAN-UPDATE ] •", Language.RestartRequire);
|
219
|
+
Database(true).set("NeedRebuild", true);
|
220
|
+
process.exit(0);
|
221
|
+
}
|
222
|
+
catch (e) {
|
223
|
+
log.error("[ NAYAN-UPDATE ] •",Language.ErrNodeDownload);
|
224
|
+
process.exit(0);
|
225
|
+
}
|
226
|
+
}
|
227
|
+
case "linux": {
|
228
|
+
|
229
|
+
try {
|
230
|
+
if (process.env["REPL_ID"] != undefined) {
|
231
|
+
log.warn("[ NAYAN-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");
|
232
|
+
Database(true).set('SkipReplitNix', true);
|
233
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
234
|
+
process.exit(1);
|
235
|
+
}
|
236
|
+
//check if user using nvm
|
237
|
+
if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
|
238
|
+
log.warn("[ NAYAN-UPDATE ] •", Language.UsingNVM);
|
239
|
+
process.exit(0);
|
240
|
+
}
|
241
|
+
//download NodeJS v14 for Linux and slient install
|
242
|
+
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"));
|
243
|
+
log.info("[ NAYAN-UPDATE ] •", Language.DownloadingNode);
|
244
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
245
|
+
execSync('tar -xf node-v14.17.0-linux-x64.tar.xz');
|
246
|
+
execSync('cd node-v14.17.0-linux-x64');
|
247
|
+
execSync('sudo cp -R * /usr/local/');
|
248
|
+
log.info("[ NAYAN-UPDATE ] •", Language.NodeDownloadingComplete);
|
249
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
250
|
+
log.info("[ NAYAN-UPDATE ] •",Language.RestartingN);
|
251
|
+
Database(true).set("NeedRebuild", true);
|
252
|
+
process.exit(1);
|
253
|
+
}
|
254
|
+
catch (e) {
|
255
|
+
log.error("[ NAYAN-UPDATE ] •",Language.ErrNodeDownload);
|
256
|
+
process.exit(0);
|
257
|
+
}
|
258
|
+
}
|
259
|
+
case "darwin": {
|
260
|
+
try {
|
261
|
+
//check if user using nvm
|
262
|
+
if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
|
263
|
+
log.warn("[ NAYAN-UPDATE ] •", Language.UsingNVM);
|
264
|
+
process.exit(0);
|
265
|
+
}
|
266
|
+
//download NodeJS v14 for MacOS and slient install
|
267
|
+
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"));
|
268
|
+
log.info("[ NAYAN-UPDATE ] •", Language.DownloadingNode);
|
269
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
270
|
+
execSync('tar -xf node-v14.17.0-darwin-x64.tar.gz');
|
271
|
+
execSync('cd node-v14.17.0-darwin-x64');
|
272
|
+
execSync('sudo cp -R * /usr/local/');
|
273
|
+
log.info("[ NAYAN-UPDATE ] •", Language.NodeDownloadingComplete);
|
274
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
275
|
+
log.info("[ NAYAN-UPDATE ] •",Language.RestartingN);
|
276
|
+
Database(true).set("NeedRebuild", true);
|
277
|
+
process.exit(1);
|
278
|
+
}
|
279
|
+
catch (e) {
|
280
|
+
log.error("[ NAYAN-UPDATE ] •",Language.ErrNodeDownload);
|
281
|
+
process.exit(0);
|
282
|
+
}
|
283
|
+
}
|
284
|
+
}
|
285
|
+
}
|
286
|
+
catch (e) {
|
287
|
+
console.log(e);
|
288
|
+
log.error("[ NAYAN-UPDATE ] •","NodeJS v14 Installation Failed, Please Try Again and Contact fb.com/www.xnxx.com07!");
|
289
|
+
process.exit(0);
|
290
|
+
}
|
291
|
+
}
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}
|
295
|
+
if ((Database(true).get("NeedRebuild")) == true) {
|
296
|
+
Database(true).set("NeedRebuild", false);
|
297
|
+
log.info("[ NAYAN-UPDATE ] •",Language.Rebuilding);
|
298
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
299
|
+
try {
|
300
|
+
execSync('npm rebuild', {stdio: 'inherit'});
|
301
|
+
}
|
302
|
+
catch (e) {
|
303
|
+
console.log(e);
|
304
|
+
log.error("[ NAYAN-UPDATE ] •",Language.ErrRebuilding);
|
305
|
+
}
|
306
|
+
log.info("[ NAYAN-UPDATE ] •",Language.SuccessRebuilding);
|
307
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
308
|
+
log.info("[ NAYAN-UPDATE ] •",Language.RestartingN);
|
309
|
+
process.exit(1);
|
310
|
+
}
|
311
|
+
|
312
|
+
let Data = JSON.parse(res.body);
|
313
|
+
if (global.Fca.Require.FastConfig.Stable_Version.Accept == true) {
|
314
|
+
if (Data.Stable_Version.Valid_Version.includes(global.Fca.Require.FastConfig.Stable_Version.Version)) {
|
315
|
+
let TimeStamp = Database(true).get('Check_Update');
|
316
|
+
if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
|
317
|
+
var Check_Update = require('./Extra/Src/Check_Update.js');
|
318
|
+
await Check_Update(global.Fca.Require.FastConfig.Stable_Version.Version);
|
319
|
+
}
|
320
|
+
}
|
321
|
+
else {
|
322
|
+
log.warn("[ NAYAN-UPDATE ] •", "Error Stable Version, Please Check Your Stable Version in FastConfig.json, Automatically turn off Stable Version!");
|
323
|
+
global.Fca.Require.FastConfig.Stable_Version.Accept = false;
|
324
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigNayan.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
|
325
|
+
process.exit(1);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
if (Data.HasProblem == true || Data.ForceUpdate == true) {
|
330
|
+
let TimeStamp = Database(true).get('Instant_Update');
|
331
|
+
if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 500) {
|
332
|
+
var Instant_Update = require('./Extra/Src/Instant_Update.js');
|
333
|
+
await Instant_Update()
|
334
|
+
}
|
335
|
+
}
|
336
|
+
else {
|
337
|
+
let TimeStamp = Database(true).get('Check_Update');
|
338
|
+
if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
|
339
|
+
var Check_Update = require('./Extra/Src/Check_Update.js');
|
340
|
+
await Check_Update()
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
return login(loginData, options, callback);
|
345
|
+
}).catch(function(err) {
|
346
|
+
console.log(err)
|
347
|
+
log.error("[ NAYAN-UPDATE ] •",Language.UnableToConnect);
|
348
|
+
log.warn("[ NAYAN-UPDATE ] •", "OFFLINE MODE ACTIVATED, PLEASE CHECK THE LATEST VERSION OF NAYAN BY CONTACT ME AT FB.COM/www.xnxx.com07");
|
349
|
+
return login(loginData, options, callback);
|
350
|
+
});
|
351
|
+
};
|
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 || '[ NAYAN ]'} > `) + 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('[ NAYAN-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('[ NAYAN-ERROR ] > ') + chalk.red("Already Faulty, Please Contact: Facebook.com/www.xnxx.com07"));
|
45
|
+
}
|
46
|
+
console.log(chalk.magenta.bold('[ NAYAN-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('#9900FF').bold(`${global.Fca.Require.FastConfig.MainName || '[ NAYAN ]'} > `) + 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('#9900FF').bold(`${global.Fca.Require.FastConfig.MainName || '[ NAYAN ]'} > `) + chalk.blue(str));
|
61
|
+
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
62
|
+
callback();
|
63
|
+
}
|
64
|
+
else return callback;
|
65
|
+
}
|
66
|
+
};
|