isoy 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.gitattributes +2 -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/AES_256_GCM/index.js +0 -0
- package/Extra/Security/Base/Step_1.js +6 -0
- package/Extra/Security/Base/Step_2.js +22 -0
- package/Extra/Security/Base/Step_3.js +22 -0
- package/Extra/Security/Base/index.js +173 -0
- package/Extra/Security/Index.js +5 -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 +66 -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/Websocket.js +213 -0
- package/Extra/Src/image/checkmate.jpg +0 -0
- package/Extra/Src/uuid.js +137 -0
- package/Func/AcceptAgreement.js +31 -0
- package/Func/ClearCache.js +64 -0
- package/Func/ReportV1.js +54 -0
- package/LICENSE +674 -0
- package/Language/index.json +217 -0
- package/Main.js +1216 -0
- package/README.md +140 -0
- package/SECURITY.md +18 -0
- package/broadcast.js +40 -0
- package/index.js +386 -0
- package/logger.js +67 -0
- package/package.json +93 -0
- package/src/Dev_Horizon_Data.js +125 -0
- package/src/Premium.js +25 -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 +425 -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 +787 -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 +440 -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/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/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 +1683 -0
package/README.md
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
[![Socket Badge](https://socket.dev/api/badge/npm/package/fca-project-orion)](https://socket.dev/npm/package/fca-project-orion)
|
2
|
+
[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/JustKemForFun/JustKemForFun)
|
3
|
+
|
4
|
+
## Important !
|
5
|
+
|
6
|
+
[ ENG ]: This package require NodeJS 14.17.0 to work properly.
|
7
|
+
|
8
|
+
[ VIE ]: Gói này yêu cầu NodeJS 14.17.0 để hoạt động bình thường.
|
9
|
+
|
10
|
+
## Notification !
|
11
|
+
|
12
|
+
+ Original Project(Deprecated): https://github.com/Schmavery/facebook-chat-api
|
13
|
+
+ This is The Defunct Project and Redeveloped By KanzuXHorizon
|
14
|
+
|
15
|
+
## Support Language :
|
16
|
+
|
17
|
+
+ English
|
18
|
+
+ VietNamese
|
19
|
+
+ Tagalog
|
20
|
+
+ Cebuano(Bisaya)
|
21
|
+
|
22
|
+
# Api For ChatBot Messenger
|
23
|
+
|
24
|
+
Facebook already exists and allows users to create Api for Chatbots 😪 Here => [Here](https://developers.facebook.com/docs/messenger-platform).
|
25
|
+
|
26
|
+
### This Api Can Make You Payy Acc Like You Never Had Acc, Please Pay Attention =))
|
27
|
+
|
28
|
+
Note ! If You Want To Use This Api Please See Document At [Here](https://github.com/Schmavery/facebook-chat-api).
|
29
|
+
|
30
|
+
## Download
|
31
|
+
|
32
|
+
If You Want To Use It, Download It By:
|
33
|
+
```bash
|
34
|
+
npm i fca_isoy
|
35
|
+
```
|
36
|
+
or
|
37
|
+
```bash
|
38
|
+
npm install fca_isoy
|
39
|
+
```
|
40
|
+
|
41
|
+
It Will Download To node_modules (Your Lib) - Note Replit Will Not Show Anywhere To Find 😪
|
42
|
+
|
43
|
+
### Download Latest Version Or Update
|
44
|
+
|
45
|
+
If You Want To Use The Latest Or Updated Version Then Go To Terminal Or Command Promt Type:
|
46
|
+
```bash
|
47
|
+
npm install fca_isoy@latest
|
48
|
+
```
|
49
|
+
Or
|
50
|
+
```bash
|
51
|
+
npm i fca_isoy@latest
|
52
|
+
```
|
53
|
+
|
54
|
+
## If You Want To Test Api
|
55
|
+
|
56
|
+
The benefit of this is that you won't waste time paying and having an account 😪
|
57
|
+
Please Use With Test Account => [Facebook Whitehat Accounts](https://www.facebook.com/whitehat/accounts/).
|
58
|
+
|
59
|
+
## Using
|
60
|
+
|
61
|
+
```javascript
|
62
|
+
const login = require("fca-project-orion"); // get it from lib
|
63
|
+
|
64
|
+
// log in
|
65
|
+
login({email: "Gmail Account", password: "Your Facebook Password"}, (err, api) => {
|
66
|
+
|
67
|
+
if(err) return console.error(err); // error case
|
68
|
+
|
69
|
+
// create a bot that automatically imitates you:
|
70
|
+
api.listenMqtt((err, message) => {
|
71
|
+
api.sendMessage(message.body, message.threadID);
|
72
|
+
});
|
73
|
+
|
74
|
+
});
|
75
|
+
```
|
76
|
+
|
77
|
+
As a result, it will imitate you as shown below:
|
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
|
+
If You Want Advanced Use Then Use The Bot Types Listed Above!
|
81
|
+
|
82
|
+
## List
|
83
|
+
|
84
|
+
You Can Read Full Api At => [here](DOCS.md).
|
85
|
+
|
86
|
+
## Settings For Mirai:
|
87
|
+
|
88
|
+
You Need To Go To File Mirai.js, Then Find Line
|
89
|
+
```js
|
90
|
+
var login = require('depend on bot');
|
91
|
+
/* Maybe :
|
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
|
+
And Replace It With:
|
100
|
+
|
101
|
+
```js
|
102
|
+
var login = require('fca-project-orion')
|
103
|
+
```
|
104
|
+
|
105
|
+
After that, run normally!
|
106
|
+
|
107
|
+
## Self-study
|
108
|
+
|
109
|
+
If You Want To Research Or Create Your Own Bot, Go To This To Read Its Functions And How To Use => [Link](https://github.com/Schmavery/facebook-chat-api#Unofficial %20Facebook%20Chat%20API)
|
110
|
+
|
111
|
+
------------------------------------
|
112
|
+
|
113
|
+
### Save Login Information.
|
114
|
+
|
115
|
+
To Save, You Need 1 Apstate Type (Cookie, etc,..) To Save Or Use Login Code As Above To Log In!
|
116
|
+
|
117
|
+
And this mode is already available in some Vietnamese bots, so you can rest assured!
|
118
|
+
|
119
|
+
__Instructions With Appstate__
|
120
|
+
|
121
|
+
```js
|
122
|
+
const fs = require("fs");
|
123
|
+
const login = require("fca-project-orion");
|
124
|
+
|
125
|
+
var credentials = {email: "FB_EMAIL", password: "FB_PASSWORD"}; // account information
|
126
|
+
|
127
|
+
login(credentials, (err, api) => {
|
128
|
+
if(err) return console.error(err);
|
129
|
+
// log in
|
130
|
+
fs.writeFileSync('appstate.json', JSON.stringify(api.getAppState(), null,'\t')); //create appstate
|
131
|
+
});
|
132
|
+
```
|
133
|
+
|
134
|
+
Or Easier (Professional) You Can Use => [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate) To Get Fbstate And Rename It Back To Apstate! (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,18 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
+ if have any Vulnerability finded contact: Author(KanzuWakazaki.Main@proton.me) or (Facebook.com/Lazic.Kanzu). Thanks!
|
4
|
+
|
5
|
+
## Supported Versions
|
6
|
+
|
7
|
+
Use this section to tell people about which versions of your project are
|
8
|
+
currently being supported with security updates.
|
9
|
+
|
10
|
+
| Version | Supported |
|
11
|
+
| ------- | ------------------ |
|
12
|
+
| StableVersion | :white_check_mark: |
|
13
|
+
| AutoUpdate | :white_check_mark:|
|
14
|
+
| Modified | :x:
|
15
|
+
|
16
|
+
## Reporting a Vulnerability
|
17
|
+
|
18
|
+
Contact Author or create pull!
|
package/broadcast.js
ADDED
@@ -0,0 +1,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/Bucky-26/Global_fca-project-orion/main/Fca_BroadCast.json").then(async (/** @type {{ body: { toString: () => string; }; }} */ res) => {
|
9
|
+
global.Fca.Data.BroadCast = JSON.parse(res.body.toString())
|
10
|
+
var random = JSON.parse(res.body.toString())[Math.floor(Math.random() * JSON.parse(res.body.toString()).length)] || "Ae Zui Zẻ Nhé !";
|
11
|
+
logger.Normal(random);
|
12
|
+
});
|
13
|
+
}
|
14
|
+
catch (e) {
|
15
|
+
console.log(e);
|
16
|
+
}
|
17
|
+
return setInterval(() => {
|
18
|
+
try {
|
19
|
+
try {
|
20
|
+
var logger = global.Fca.Require.logger;
|
21
|
+
var random = global.Fca.Data.BroadCast[Math.floor(Math.random() * global.Fca.Data.BroadCast.length)] || "Ae Zui Zẻ Nhé !";
|
22
|
+
logger.Normal(random);
|
23
|
+
}
|
24
|
+
catch (e) {
|
25
|
+
console.log(e);
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
catch (e) {
|
30
|
+
console.log(e);
|
31
|
+
}
|
32
|
+
},3600 * 1000);
|
33
|
+
}
|
34
|
+
case false: {
|
35
|
+
break;
|
36
|
+
}
|
37
|
+
default: {
|
38
|
+
break;
|
39
|
+
}
|
40
|
+
}
|
package/index.js
ADDED
@@ -0,0 +1,386 @@
|
|
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": false,
|
29
|
+
"MainColor": "#FFFF00",
|
30
|
+
"MainName": "[ FCA-PROJECT-ORION ]",
|
31
|
+
"Uptime": false,
|
32
|
+
"Config": "default",
|
33
|
+
"DevMode": false,
|
34
|
+
"Login2Fa": false,
|
35
|
+
"AutoLogin": false,
|
36
|
+
"BroadCast": true,
|
37
|
+
"AuthString": "SD4S XQ32 O2JA WXB3 FUX2 OPJ7 Q7JZ 4R6Z | https://i.imgur.com/RAg3rvw.png Please remove this !, Recommend If You Using getUserInfoV2",
|
38
|
+
"EncryptFeature": true,
|
39
|
+
"ResetDataLogin": false,
|
40
|
+
"AutoInstallNode": false,
|
41
|
+
"AntiSendAppState": true,
|
42
|
+
"AutoRestartMinutes": 0,
|
43
|
+
"RestartMQTT_Minutes": 0,
|
44
|
+
"Websocket_Extension": {
|
45
|
+
"Status": false,
|
46
|
+
"ResetData": false,
|
47
|
+
"AppState_Path": "appstate.json"
|
48
|
+
},
|
49
|
+
"HTML": {
|
50
|
+
"HTML": true,
|
51
|
+
"UserName": "Guest",
|
52
|
+
"MusicLink": ""
|
53
|
+
},
|
54
|
+
"AntiGetInfo": {
|
55
|
+
"Database_Type": "default", //json or default
|
56
|
+
"AntiGetThreadInfo": true,
|
57
|
+
"AntiGetUserInfo": true
|
58
|
+
},
|
59
|
+
"Stable_Version": {
|
60
|
+
"Accept": false,
|
61
|
+
"Version": ""
|
62
|
+
}
|
63
|
+
},
|
64
|
+
CountTime: function() {
|
65
|
+
var fs = global.Fca.Require.fs;
|
66
|
+
if (fs.existsSync(__dirname + '/CountTime.json')) {
|
67
|
+
try {
|
68
|
+
var data = Number(fs.readFileSync(__dirname + '/CountTime.json', 'utf8')),
|
69
|
+
hours = Math.floor(data / (60 * 60));
|
70
|
+
}
|
71
|
+
catch (e) {
|
72
|
+
fs.writeFileSync(__dirname + '/CountTime.json', 0);
|
73
|
+
hours = 0;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
hours = 0;
|
78
|
+
}
|
79
|
+
return `${hours} Hours`;
|
80
|
+
}
|
81
|
+
}),
|
82
|
+
Action: function(Type) {
|
83
|
+
switch (Type) {
|
84
|
+
case "AutoLogin": {
|
85
|
+
var Database = require('./Extra/Database');
|
86
|
+
var logger = global.Fca.Require.logger;
|
87
|
+
var Email = (Database().get('Account')).replace(RegExp('"', 'g'), ''); //hmm IDK
|
88
|
+
var PassWord = (Database().get('Password')).replace(RegExp('"', 'g'), '');
|
89
|
+
require('./Main')({ email: Email, password: PassWord},async (error, api) => {
|
90
|
+
if (error) {
|
91
|
+
logger.Error(JSON.stringify(error,null,2), function() { logger.Error("AutoLogin Failed!", function() { process.exit(0); }) });
|
92
|
+
}
|
93
|
+
try {
|
94
|
+
Database().set("TempState", Database().get('Through2Fa'));
|
95
|
+
}
|
96
|
+
catch(e) {
|
97
|
+
logger.Warning(global.Fca.Require.Language.Index.ErrDatabase);
|
98
|
+
logger.Error();
|
99
|
+
process.exit(0);
|
100
|
+
}
|
101
|
+
process.exit(1);
|
102
|
+
});
|
103
|
+
}
|
104
|
+
break;
|
105
|
+
default: {
|
106
|
+
require('npmlog').Error("Invalid Message!");
|
107
|
+
};
|
108
|
+
}
|
109
|
+
}
|
110
|
+
});
|
111
|
+
|
112
|
+
try {
|
113
|
+
let Boolean_Fca = ["AntiSendAppState","AutoUpdate","Uptime","BroadCast","EncryptFeature","AutoLogin","ResetDataLogin","Login2Fa", "DevMode","AutoInstallNode"];
|
114
|
+
let String_Fca = ["MainName","PreKey","Language","AuthString","Config"]
|
115
|
+
let Number_Fca = ["AutoRestartMinutes","RestartMQTT_Minutes"];
|
116
|
+
let Object_Fca = ["HTML","Stable_Version","AntiGetInfo","Websocket_Extension"];
|
117
|
+
let All_Variable = Boolean_Fca.concat(String_Fca,Number_Fca,Object_Fca);
|
118
|
+
|
119
|
+
|
120
|
+
if (!global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
|
121
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
|
122
|
+
process.exit(1);
|
123
|
+
}
|
124
|
+
|
125
|
+
try {
|
126
|
+
var Data_Setting = require(process.cwd() + "/FastConfigFca.json");
|
127
|
+
}
|
128
|
+
catch (e) {
|
129
|
+
global.Fca.Require.logger.Error('Detect Your FastConfigFca Settings Invalid!, Carry out default restoration');
|
130
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
|
131
|
+
process.exit(1)
|
132
|
+
}
|
133
|
+
if (global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
|
134
|
+
|
135
|
+
for (let i of All_Variable) {
|
136
|
+
if (Data_Setting[i] == undefined) {
|
137
|
+
Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
|
138
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
|
139
|
+
}
|
140
|
+
else continue;
|
141
|
+
} //Check Variable
|
142
|
+
|
143
|
+
for (let i in Data_Setting) {
|
144
|
+
if (Boolean_Fca.includes(i)) {
|
145
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Boolean") logger.Error(i + " Is Not A Boolean, Need To Be true Or false !", function() { process.exit(0) });
|
146
|
+
else continue;
|
147
|
+
}
|
148
|
+
else if (String_Fca.includes(i)) {
|
149
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "String") logger.Error(i + " Is Not A String, Need To Be String!", function() { process.exit(0) });
|
150
|
+
else continue;
|
151
|
+
}
|
152
|
+
else if (Number_Fca.includes(i)) {
|
153
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Number") logger.Error(i + " Is Not A Number, Need To Be Number !", function() { process.exit(0) });
|
154
|
+
else continue;
|
155
|
+
}
|
156
|
+
else if (Object_Fca.includes(i)) {
|
157
|
+
if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Object") {
|
158
|
+
Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
|
159
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
|
160
|
+
}
|
161
|
+
else continue;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
for (let i of Object_Fca) {
|
166
|
+
const All_Paths = utils.getPaths(global.Fca.Data.ObjFastConfig[i]);
|
167
|
+
const Mission = { Main_Path: i, Data_Path: All_Paths }
|
168
|
+
for (let i of Mission.Data_Path) {
|
169
|
+
if (Data_Setting[Mission.Main_Path] == undefined) {
|
170
|
+
Data_Setting[Mission.Main_Path] = global.Fca.Data.ObjFastConfig[Mission.Main_Path];
|
171
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
|
172
|
+
}
|
173
|
+
const User_Data = (utils.getData_Path(Data_Setting[Mission.Main_Path], i, 0))
|
174
|
+
const User_Data_Type = utils.getType(User_Data);
|
175
|
+
if (User_Data_Type == "Number") {
|
176
|
+
const Mission_Path = User_Data == 0 ? i : i.slice(0, User_Data);
|
177
|
+
const Mission_Obj = utils.getData_Path(global.Fca.Data.ObjFastConfig[Mission.Main_Path], Mission_Path, 0);
|
178
|
+
Data_Setting[Mission.Main_Path] = utils.setData_Path(Data_Setting[Mission.Main_Path], Mission_Path, Mission_Obj)
|
179
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
if (!global.Fca.Require.languageFile.some((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language)) {
|
185
|
+
global.Fca.Require.logger.Warning("Not Support Language: " + Data_Setting.Language + " Only 'en' and 'vi'");
|
186
|
+
process.exit(0);
|
187
|
+
}
|
188
|
+
global.Fca.Require.Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == Data_Setting.Language).Folder;
|
189
|
+
} else process.exit(1);
|
190
|
+
global.Fca.Require.FastConfig = Data_Setting;
|
191
|
+
}
|
192
|
+
catch (e) {
|
193
|
+
console.log(e);
|
194
|
+
global.Fca.Require.logger.Error();
|
195
|
+
}
|
196
|
+
|
197
|
+
// if (global.Fca.Require.FastConfig.Websocket_Extension.Status) {
|
198
|
+
// console.history = new Array();
|
199
|
+
// var Convert = require('ansi-to-html');
|
200
|
+
// var convert = new Convert();
|
201
|
+
// console.__log = console.log;
|
202
|
+
// console.log = function (data) {
|
203
|
+
// const log = convert.toHtml(data)
|
204
|
+
// console.history.push(log)
|
205
|
+
// console.__log.apply(console,arguments)
|
206
|
+
// if (console.history.length > 80) {
|
207
|
+
// console.history.shift();
|
208
|
+
// }
|
209
|
+
// }
|
210
|
+
// }
|
211
|
+
|
212
|
+
module.exports = function(loginData, options, callback) {
|
213
|
+
const Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == global.Fca.Require.FastConfig.Language).Folder.Index;
|
214
|
+
const login = require('./Main');
|
215
|
+
const fs = require('fs-extra');
|
216
|
+
const got = require('got');
|
217
|
+
const log = require('npmlog');
|
218
|
+
const { execSync } = require('child_process');
|
219
|
+
const Database = require('./Extra/Database');
|
220
|
+
|
221
|
+
if (global.Fca.Require.FastConfig.DevMode) {
|
222
|
+
require('./Extra/Src/Release_Memory');
|
223
|
+
}
|
224
|
+
|
225
|
+
return got.get('https://raw.githubusercontent.com/ivancotacte/Global_fca-project-orion/main/InstantAction.json').then(async function(res) {
|
226
|
+
if (global.Fca.Require.FastConfig.AutoInstallNode) {
|
227
|
+
switch (fs.existsSync(process.cwd() + "/replit.nix") && process.env["REPL_ID"] != undefined) {
|
228
|
+
case true: {
|
229
|
+
await require('./Extra/Src/Change_Environment.js')();
|
230
|
+
break;
|
231
|
+
}
|
232
|
+
case false: {
|
233
|
+
const NodeVersion = execSync('node -v').toString().replace(/(\r\n|\n|\r)/gm, "");
|
234
|
+
if (!NodeVersion.includes("v14") && !NodeVersion.includes("v16") && !Database(true).has('SkipReplitNix')) {
|
235
|
+
log.warn("[ FCA-UPDATE ] •",global.Fca.getText(Language.NodeVersionNotSupported, NodeVersion));
|
236
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
237
|
+
try {
|
238
|
+
switch (process.platform) {
|
239
|
+
case "win32": {
|
240
|
+
try {
|
241
|
+
//check if user using nvm
|
242
|
+
if (fs.existsSync(process.env.APPDATA + "/nvm/nvm.exe")) {
|
243
|
+
log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
|
244
|
+
process.exit(0);
|
245
|
+
}
|
246
|
+
//download NodeJS v14 for Windows and slient install
|
247
|
+
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"));
|
248
|
+
log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
|
249
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
250
|
+
execSync('msiexec /i node-v14.17.0-x64.msi /qn');
|
251
|
+
log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
|
252
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
253
|
+
log.info("[ FCA-UPDATE ] •", Language.RestartRequire);
|
254
|
+
Database(true).set("NeedRebuild", true);
|
255
|
+
process.exit(0);
|
256
|
+
}
|
257
|
+
catch (e) {
|
258
|
+
log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
|
259
|
+
process.exit(0);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
case "linux": {
|
263
|
+
|
264
|
+
try {
|
265
|
+
if (process.env["REPL_ID"] != undefined) {
|
266
|
+
log.warn("[ FCA-UPDATE ] •", "Look like you are using Replit, and didn't have replit.nix file in your project, i don't know how to help you, hmm i will help you pass this step, but you need to install NodeJS v14 by yourself, and restart your repl");
|
267
|
+
Database(true).set('SkipReplitNix', true);
|
268
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
269
|
+
process.exit(1);
|
270
|
+
}
|
271
|
+
//check if user using nvm
|
272
|
+
if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
|
273
|
+
log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
|
274
|
+
process.exit(0);
|
275
|
+
}
|
276
|
+
//download NodeJS v14 for Linux and slient install
|
277
|
+
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"));
|
278
|
+
log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
|
279
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
280
|
+
execSync('tar -xf node-v14.17.0-linux-x64.tar.xz');
|
281
|
+
execSync('cd node-v14.17.0-linux-x64');
|
282
|
+
execSync('sudo cp -R * /usr/local/');
|
283
|
+
log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
|
284
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
285
|
+
log.info("[ FCA-UPDATE ] •",Language.RestartingN);
|
286
|
+
Database(true).set("NeedRebuild", true);
|
287
|
+
process.exit(1);
|
288
|
+
}
|
289
|
+
catch (e) {
|
290
|
+
log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
|
291
|
+
process.exit(0);
|
292
|
+
}
|
293
|
+
}
|
294
|
+
case "darwin": {
|
295
|
+
try {
|
296
|
+
//check if user using nvm
|
297
|
+
if (fs.existsSync(process.env.HOME + "/.nvm/nvm.sh")) {
|
298
|
+
log.warn("[ FCA-UPDATE ] •", Language.UsingNVM);
|
299
|
+
process.exit(0);
|
300
|
+
}
|
301
|
+
//download NodeJS v14 for MacOS and slient install
|
302
|
+
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"));
|
303
|
+
log.info("[ FCA-UPDATE ] •", Language.DownloadingNode);
|
304
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
305
|
+
execSync('tar -xf node-v14.17.0-darwin-x64.tar.gz');
|
306
|
+
execSync('cd node-v14.17.0-darwin-x64');
|
307
|
+
execSync('sudo cp -R * /usr/local/');
|
308
|
+
log.info("[ FCA-UPDATE ] •", Language.NodeDownloadingComplete);
|
309
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
310
|
+
log.info("[ FCA-UPDATE ] •",Language.RestartingN);
|
311
|
+
Database(true).set("NeedRebuild", true);
|
312
|
+
process.exit(1);
|
313
|
+
}
|
314
|
+
catch (e) {
|
315
|
+
log.error("[ FCA-UPDATE ] •",Language.ErrNodeDownload);
|
316
|
+
process.exit(0);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
321
|
+
catch (e) {
|
322
|
+
console.log(e);
|
323
|
+
log.error("[ FCA-UPDATE ] •","NodeJS v14 Installation Failed, Please Try Again and Contact fb.com/Lazic.Kanzu!");
|
324
|
+
process.exit(0);
|
325
|
+
}
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
if ((Database(true).get("NeedRebuild")) == true) {
|
331
|
+
Database(true).set("NeedRebuild", false);
|
332
|
+
log.info("[ FCA-UPDATE ] •",Language.Rebuilding);
|
333
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
334
|
+
try {
|
335
|
+
execSync('npm rebuild', {stdio: 'inherit'});
|
336
|
+
}
|
337
|
+
catch (e) {
|
338
|
+
console.log(e);
|
339
|
+
log.error("[ FCA-UPDATE ] •",Language.ErrRebuilding);
|
340
|
+
}
|
341
|
+
log.info("[ FCA-UPDATE ] •",Language.SuccessRebuilding);
|
342
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
343
|
+
log.info("[ FCA-UPDATE ] •",Language.RestartingN);
|
344
|
+
process.exit(1);
|
345
|
+
}
|
346
|
+
|
347
|
+
let Data = JSON.parse(res.body);
|
348
|
+
if (global.Fca.Require.FastConfig.Stable_Version.Accept == true) {
|
349
|
+
if (Data.Stable_Version.Valid_Version.includes(global.Fca.Require.FastConfig.Stable_Version.Version)) {
|
350
|
+
let TimeStamp = Database(true).get('Check_Update');
|
351
|
+
if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
|
352
|
+
var Check_Update = require('./Extra/Src/Check_Update.js');
|
353
|
+
await Check_Update(global.Fca.Require.FastConfig.Stable_Version.Version);
|
354
|
+
}
|
355
|
+
}
|
356
|
+
else {
|
357
|
+
log.warn("[ FCA-UPDATE ] •", "Error Stable Version, Please Check Your Stable Version in FastConfig.json, Automatically turn off Stable Version!");
|
358
|
+
global.Fca.Require.FastConfig.Stable_Version.Accept = false;
|
359
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
|
360
|
+
process.exit(1);
|
361
|
+
}
|
362
|
+
}
|
363
|
+
else {
|
364
|
+
if (Data.HasProblem == true || Data.ForceUpdate == true) {
|
365
|
+
let TimeStamp = Database(true).get('Instant_Update');
|
366
|
+
if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 500) {
|
367
|
+
var Instant_Update = require('./Extra/Src/Instant_Update.js');
|
368
|
+
await Instant_Update()
|
369
|
+
}
|
370
|
+
}
|
371
|
+
else {
|
372
|
+
let TimeStamp = Database(true).get('Check_Update');
|
373
|
+
if (TimeStamp == null || TimeStamp == undefined || Date.now() - TimeStamp > 300000) {
|
374
|
+
var Check_Update = require('./Extra/Src/Check_Update.js');
|
375
|
+
await Check_Update()
|
376
|
+
}
|
377
|
+
}
|
378
|
+
}
|
379
|
+
return login(loginData, options, callback);
|
380
|
+
}).catch(function(err) {
|
381
|
+
console.log(err)
|
382
|
+
log.error("[ FCA-UPDATE ] •",Language.UnableToConnect);
|
383
|
+
log.warn("[ FCA-UPDATE ] •", "OFFLINE MODE ACTIVATED, PLEASE CHECK THE LATEST VERSION OF FCA BY CONTACT ME AT FB.COM/LAZIC.KANZU");
|
384
|
+
return login(loginData, options, callback);
|
385
|
+
});
|
386
|
+
};
|
package/logger.js
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
'use strict';
|
2
|
+
/* eslint-disable linebreak-style */
|
3
|
+
|
4
|
+
const chalk = require('chalk');
|
5
|
+
const gradient = require('gradient-string');
|
6
|
+
var isHexcolor = require('is-hexcolor');
|
7
|
+
var getText = function(/** @type {string[]} */ ...Data) {
|
8
|
+
var Main = (Data.splice(0,1)).toString();
|
9
|
+
for (let i = 0; i < Data.length; i++) Main = Main.replace(RegExp(`%${i + 1}`, 'g'), Data[i]);
|
10
|
+
return Main;
|
11
|
+
};
|
12
|
+
/**
|
13
|
+
* @param {any} obj
|
14
|
+
*/
|
15
|
+
function getType(obj) {
|
16
|
+
return Object.prototype.toString.call(obj).slice(8, -1);
|
17
|
+
}
|
18
|
+
|
19
|
+
module.exports = {
|
20
|
+
Normal: function(/** @type {string} */ Str, /** @type {() => any} */ Data ,/** @type {() => void} */ Callback) {
|
21
|
+
if (isHexcolor(global.Fca.Require.FastConfig.MainColor) != true) {
|
22
|
+
this.Warning(getText(global.Fca.Require.Language.Index.InvaildMainColor,global.Fca.Require.FastConfig.MainColor),process.exit(0));
|
23
|
+
}
|
24
|
+
console.log(gradient('orange', 'yellow')(`${global.Fca.Require.FastConfig.MainName || '[ FCA-PROJECT-ORION ]'} > `) + Str);
|
25
|
+
if (getType(Data) == 'Function' || getType(Data) == 'AsyncFunction') {
|
26
|
+
return Data();
|
27
|
+
}
|
28
|
+
if (Data) {
|
29
|
+
return Data;
|
30
|
+
}
|
31
|
+
if (getType(Callback) == 'Function' || getType(Callback) == 'AsyncFunction') {
|
32
|
+
Callback();
|
33
|
+
}
|
34
|
+
else return Callback;
|
35
|
+
},
|
36
|
+
Warning: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
37
|
+
console.log(gradient('orange', 'yellow')('[ FCA-WARNING ] > ') + chalk.yellow(str));
|
38
|
+
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
39
|
+
callback();
|
40
|
+
}
|
41
|
+
else return callback;
|
42
|
+
},
|
43
|
+
Error: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
44
|
+
if (!str) {
|
45
|
+
console.log(gradient('orange', 'yellow')('[ FCA-ERROR ] > ') + chalk.red("Already Faulty, Please Contact: Facebook.com/Lazic.Kanzu"));
|
46
|
+
}
|
47
|
+
console.log(gradient('orange', 'yellow')('[ FCA-ERROR ] > ') + chalk.red(str));
|
48
|
+
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
49
|
+
callback();
|
50
|
+
}
|
51
|
+
else return callback;
|
52
|
+
},
|
53
|
+
Success: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
54
|
+
console.log(chalk.hex('#9900FF').bold(`${global.Fca.Require.FastConfig.MainName || '[ ISOY_FCA ]'} > `) + chalk.green(str));
|
55
|
+
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
56
|
+
callback();
|
57
|
+
}
|
58
|
+
else return callback;
|
59
|
+
},
|
60
|
+
Info: function(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
|
61
|
+
console.log(chalk.hex('#9900FF').bold(`${global.Fca.Require.FastConfig.MainName || '[ ISOY_FCA ]'} > `) + chalk.blue(str));
|
62
|
+
if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
|
63
|
+
callback();
|
64
|
+
}
|
65
|
+
else return callback;
|
66
|
+
}
|
67
|
+
};
|