fca-priyansh 15.0.0 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Extra/Balancer.js +49 -0
- package/Extra/Bypass/956/index.js +234 -0
- package/Extra/Bypass/test/aaaa.json +170 -0
- package/Extra/Bypass/test/index.js +188 -0
- package/Extra/Database/index.js +249 -140
- package/Extra/ExtraAddons.js +35 -33
- package/Extra/ExtraFindUID.js +3 -1
- package/Extra/ExtraGetThread.js +303 -56
- package/Extra/ExtraUptimeRobot.js +15 -3
- package/Extra/Html/Classic/script.js +3 -3
- 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 +191 -0
- package/Extra/Security/Index.js +5 -146
- package/Extra/Security/Step_1.js +4 -9
- package/Extra/Security/Step_2.js +2 -0
- package/Extra/Security/Step_3.js +4 -2
- package/Extra/Src/Change_Environment.js +1 -1
- package/Extra/Src/Check_Update.js +67 -0
- package/Extra/Src/History.js +2 -2
- package/Extra/Src/Instant_Update.js +65 -0
- package/Extra/Src/Premium.js +35 -38
- package/Extra/Src/Release_Memory.js +160 -0
- package/Extra/Src/Websocket.js +213 -0
- package/Extra/Src/image/checkmate.jpg +0 -0
- package/Extra/Src/test.js +28 -0
- package/Extra/Src/uuid.js +1 -1
- package/Func/AcceptAgreement.js +4 -5
- package/Func/ClearCache.js +7 -7
- package/Func/ReportV1.js +5 -5
- package/LICENSE +1 -4
- package/Language/index.json +59 -8
- package/Main.js +1444 -0
- package/README.md +198 -1
- package/broadcast.js +43 -37
- package/index.js +305 -1709
- package/logger.js +4 -4
- package/package.json +16 -11
- package/src/Dev_Horizon_Data.js +3 -3
- package/src/Dev_getThreadInfoOLD.js +422 -0
- package/src/Dev_shareTest2.js +68 -0
- package/src/Dev_shareTest3.js +71 -0
- package/src/Premium.js +8 -13
- package/src/Screenshot.js +4 -6
- package/src/editMessage.js +53 -0
- package/src/getAccessToken.js +0 -4
- package/src/getFriendsList.js +1 -1
- package/src/getMessage.js +26 -3
- package/src/getThreadHistory.js +1 -1
- package/src/getThreadInfo.js +237 -161
- package/src/getThreadInfoOLD.js +422 -0
- package/src/getThreadMain.js +1 -1
- package/src/getUID.js +3 -3
- package/src/getUserInfo.js +56 -73
- package/src/getUserInfoMain.js +2 -2
- package/src/getUserInfoV2.js +0 -4
- package/src/getUserInfoV3.js +3 -3
- package/src/getUserInfoV4.js +5 -5
- package/src/getUserInfoV5.js +4 -4
- package/src/listenMqtt.js +905 -625
- package/src/listenMqttV1.js +846 -0
- package/src/sendMessage.js +54 -2
- package/src/sendMqttMessage.js +71 -0
- package/src/setPostReaction.js +3 -3
- package/src/shareContact.js +55 -0
- package/src/shareLink.js +58 -0
- package/src/unsendMessage.js +28 -20
- package/src/unsendMqttMessage.js +66 -0
- package/utils.js +1567 -138
- package/.gitattributes +0 -2
- package/gitattributes +0 -2
- package/gitignore.txt +0 -10
package/Extra/Src/Premium.js
CHANGED
@@ -2,80 +2,77 @@ module.exports = async function(SessionID) {
|
|
2
2
|
try {
|
3
3
|
var userName,Text;
|
4
4
|
var os = require('os');
|
5
|
-
var Database = require("
|
6
|
-
var Fetch = global.Fca.Require.Fetch;
|
5
|
+
var Database = require("../Database");
|
7
6
|
var { getAll,readyCreate,deleteAll } = require('../ExtraGetThread');
|
8
7
|
if (process.env.REPL_OWNER != undefined) userName = process.env.REPL_OWNER;
|
9
8
|
else if (os.hostname() != null || os.hostname() != undefined) userName = os.hostname();
|
10
9
|
else userName = os.userInfo().username;
|
11
|
-
if (
|
12
|
-
if (
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
if (Database(true).has('UserName')) {
|
11
|
+
if (Database(true).get('UserName') != userName) {
|
12
|
+
Database(true).set('Premium', false);
|
13
|
+
Database(true).set('PremiumKey', '');
|
14
|
+
Database(true).set('UserName', userName);
|
16
15
|
}
|
17
16
|
}
|
18
|
-
if (
|
17
|
+
if (Database(true).has('PremiumKey') && Database(true).get('PremiumKey') != '' && Database(true).has('Premium') && Database(true).get('Premium') == true) {
|
19
18
|
try {
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
Database(true).set('Premium', true);
|
20
|
+
Database(true).set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
21
|
+
Database(true).set('UserName', userName);
|
23
22
|
process.env.HalzionVersion = 1973
|
24
|
-
Text = "
|
23
|
+
Text = "Bạn Đang Sài Phiên Bản: Premium Access";
|
25
24
|
}
|
26
25
|
catch (error) {
|
27
|
-
Text = "
|
26
|
+
Text = "Lỗi Kết Nối";
|
28
27
|
}
|
29
28
|
} else if (global.Fca.Require.Priyansh.PreKey) {
|
30
29
|
try {
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
Database(true).set('Premium', true);
|
31
|
+
Database(true).set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
32
|
+
Database(true).set('UserName', userName);
|
34
33
|
process.env.HalzionVersion = 1973
|
35
|
-
Text = "
|
34
|
+
Text = "Bạn Đang Sài Phiên Bản: Premium Access";
|
36
35
|
}
|
37
36
|
catch (error) {
|
38
|
-
Text = "
|
37
|
+
Text = "Lỗi Kết Nối";
|
39
38
|
}
|
40
39
|
}
|
41
40
|
else if (!global.Fca.Require.Priyansh.PreKey) {
|
42
41
|
try {
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
Database(true).set('Premium', true);
|
43
|
+
Database(true).set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
44
|
+
Database(true).set('UserName', userName);
|
46
45
|
process.env.HalzionVersion = 1973
|
47
|
-
Text = "
|
46
|
+
Text = "Bạn Đang Sài Phiên Bản: Premium Access";
|
48
47
|
}
|
49
48
|
catch (error) {
|
50
|
-
Text = "
|
49
|
+
Text = "Lỗi Kết Nối";
|
51
50
|
}
|
52
51
|
}
|
53
52
|
} catch (e) {
|
54
53
|
try {
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
Database(true).set('Premium', true);
|
55
|
+
Database(true).set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
56
|
+
Database(true).set('UserName', userName);
|
58
57
|
process.env.HalzionVersion = 1973
|
59
|
-
Text = "
|
58
|
+
Text = "Bạn Đang Sài Phiên Bản: Premium Access";
|
60
59
|
}
|
61
60
|
catch (error) {
|
62
|
-
Text = "
|
61
|
+
Text = "Lỗi Kết Nối";
|
63
62
|
}
|
64
63
|
}
|
65
64
|
if (process.env.HalzionVersion == 1973) {
|
66
65
|
try {
|
67
66
|
let data = [];
|
68
|
-
var getAll = await getAll()
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
if (i.data.messageCount != undefined) {
|
74
|
-
data.push(i.data.threadID);
|
75
|
-
} else continue;
|
67
|
+
var getAll = await getAll();
|
68
|
+
if (getAll.length > 1) {
|
69
|
+
getAll.forEach((i) => {
|
70
|
+
if (i.data.messageCount !== undefined) {
|
71
|
+
data.push(i.data.threadID);
|
76
72
|
}
|
77
|
-
|
78
|
-
|
73
|
+
});
|
74
|
+
deleteAll(data);
|
75
|
+
}
|
79
76
|
} catch (e) {
|
80
77
|
console.log(e);
|
81
78
|
}
|
@@ -0,0 +1,160 @@
|
|
1
|
+
/* eslint-disable linebreak-style */
|
2
|
+
const fs = require('fs');
|
3
|
+
const path = require('path');
|
4
|
+
const v8 = require('v8');
|
5
|
+
const EventEmitter = require('events');
|
6
|
+
|
7
|
+
class MemoryManager extends EventEmitter {
|
8
|
+
constructor(options = {}) {
|
9
|
+
super();
|
10
|
+
this.thresholds = {
|
11
|
+
warning: options.warningThreshold || 0.7,
|
12
|
+
release: options.releaseThreshold || 0.8,
|
13
|
+
max: options.maxThreshold || 0.9,
|
14
|
+
};
|
15
|
+
this.interval = options.interval || 5000;
|
16
|
+
this.logLevel = options.logLevel || 'info';
|
17
|
+
this.logFile = options.logFile || path.join(__dirname, 'memory.log');
|
18
|
+
this.allowLog = options.allowLog || true;
|
19
|
+
this.weakRefs = new WeakMap();
|
20
|
+
this.smartReleaseEnabled = options.smartReleaseEnabled || false;
|
21
|
+
this.memoryUsageHistory = [];
|
22
|
+
}
|
23
|
+
|
24
|
+
start() {
|
25
|
+
this.intervalId = setInterval(() => {
|
26
|
+
const memoryUsage = this.getMemoryUsage();
|
27
|
+
this.logMemoryUsage(memoryUsage);
|
28
|
+
|
29
|
+
if (memoryUsage > this.thresholds.warning) {
|
30
|
+
this.emit('memoryWarning', memoryUsage);
|
31
|
+
}
|
32
|
+
|
33
|
+
if (memoryUsage > this.thresholds.release) {
|
34
|
+
this.releaseMemory(memoryUsage);
|
35
|
+
}
|
36
|
+
|
37
|
+
if (memoryUsage > this.thresholds.max) {
|
38
|
+
this.emit('memoryMax', memoryUsage);
|
39
|
+
}
|
40
|
+
|
41
|
+
if (this.smartReleaseEnabled) {
|
42
|
+
this.memoryUsageHistory.push(memoryUsage);
|
43
|
+
this.smartRelease();
|
44
|
+
}
|
45
|
+
}, this.interval);
|
46
|
+
}
|
47
|
+
|
48
|
+
stop() {
|
49
|
+
clearInterval(this.intervalId);
|
50
|
+
}
|
51
|
+
|
52
|
+
getMemoryUsage() {
|
53
|
+
const heapStats = v8.getHeapStatistics();
|
54
|
+
const totalHeapSize = heapStats.total_available_size / 1024 / 1024;
|
55
|
+
const usedHeapSize = heapStats.used_heap_size / 1024 / 1024;
|
56
|
+
return usedHeapSize / totalHeapSize;
|
57
|
+
}
|
58
|
+
|
59
|
+
releaseMemory(memoryUsage) {
|
60
|
+
if (global.gc) {
|
61
|
+
global.gc();
|
62
|
+
} else {
|
63
|
+
v8.setFlagsFromString('--expose_gc');
|
64
|
+
const vm = require('vm');
|
65
|
+
vm.runInNewContext('gc')();
|
66
|
+
}
|
67
|
+
this.emit('memoryReleased', memoryUsage);
|
68
|
+
}
|
69
|
+
|
70
|
+
logMemoryUsage(memoryUsage) {
|
71
|
+
const timestamp = new Date().toLocaleString("vi-vn", {timeZone: "Asia/Ho_Chi_Minh"});
|
72
|
+
const logMessage = `${timestamp} - Memory usage: ${(memoryUsage * 100).toFixed(2)}%`;
|
73
|
+
|
74
|
+
switch (this.logLevel) {
|
75
|
+
case 'debug':
|
76
|
+
console.debug(logMessage);
|
77
|
+
break;
|
78
|
+
case 'info':
|
79
|
+
global.Fca.Require.logger.Info(logMessage);
|
80
|
+
break;
|
81
|
+
case 'warn':
|
82
|
+
global.Fca.Require.logger.Normal(logMessage);
|
83
|
+
break;
|
84
|
+
case 'error':
|
85
|
+
global.Fca.Require.logger.Error(logMessage);
|
86
|
+
break;
|
87
|
+
default:
|
88
|
+
global.Fca.Require.logger.Normal(logMessage);
|
89
|
+
}
|
90
|
+
if (this.allowLog) {
|
91
|
+
fs.appendFile(this.logFile, `${logMessage}\n`, (err) => {
|
92
|
+
if (err) throw err;
|
93
|
+
});
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
onMaxMemory(callback) {
|
98
|
+
this.on('memoryMax', callback);
|
99
|
+
}
|
100
|
+
|
101
|
+
addMemoryUsageListener(callback) {
|
102
|
+
this.on('memoryWarning', callback);
|
103
|
+
this.on('memoryReleased', callback);
|
104
|
+
this.on('memoryMax', callback);
|
105
|
+
}
|
106
|
+
|
107
|
+
removeMemoryUsageListener(callback) {
|
108
|
+
this.off('memoryWarning', callback);
|
109
|
+
this.off('memoryReleased', callback);
|
110
|
+
this.off('memoryMax', callback);
|
111
|
+
}
|
112
|
+
|
113
|
+
addThreshold(type, value) {
|
114
|
+
if (type === 'warning' || type === 'release' || type === 'max') {
|
115
|
+
this.thresholds[type] = value;
|
116
|
+
} else {
|
117
|
+
throw new Error('Invalid threshold type');
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
removeThreshold(type) {
|
122
|
+
if (type === 'warning' || type === 'release' || type === 'max') {
|
123
|
+
delete this.thresholds[type];
|
124
|
+
} else {
|
125
|
+
throw new Error('Invalid threshold type');
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
smartRelease() {
|
130
|
+
const memoryUsageHistory = this.memoryUsageHistory.slice(-100);
|
131
|
+
const averageUsage = memoryUsageHistory.reduce((sum, usage) => sum + usage, 0) / memoryUsageHistory.length;
|
132
|
+
const maxUsage = Math.max(...memoryUsageHistory);
|
133
|
+
|
134
|
+
if (averageUsage > this.thresholds.release && maxUsage > this.thresholds.max) {
|
135
|
+
this.releaseMemory(maxUsage);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
autoStart(interval) { //1h
|
140
|
+
this.stopMemoryManager();
|
141
|
+
this.startMemoryManager();
|
142
|
+
this.autoStartInterval = setInterval(() => {
|
143
|
+
this.stopMemoryManager();
|
144
|
+
this.startMemoryManager();
|
145
|
+
}, interval);
|
146
|
+
}
|
147
|
+
|
148
|
+
stopMemoryManager() {
|
149
|
+
this.stop();
|
150
|
+
clearInterval(this.intervalId);
|
151
|
+
clearInterval(this.autoStartInterval);
|
152
|
+
}
|
153
|
+
|
154
|
+
startMemoryManager() {
|
155
|
+
this.start();
|
156
|
+
}
|
157
|
+
|
158
|
+
}
|
159
|
+
|
160
|
+
module.exports = MemoryManager;
|
@@ -0,0 +1,213 @@
|
|
1
|
+
/* eslint-disable no-prototype-builtins */
|
2
|
+
/* eslint-disable linebreak-style */
|
3
|
+
/**
|
4
|
+
const Eval = require('eval');
|
5
|
+
const Database = require('../Database');
|
6
|
+
global.ws = new Object({
|
7
|
+
client: {},
|
8
|
+
});
|
9
|
+
const All_Session_ID = Database().get('Session_ID') || []; [ { Session_ID: ".", TimeStamp: "" }]
|
10
|
+
for (let v of All_Session_ID) {
|
11
|
+
if (v.TimeStamp <= Date.now()) {
|
12
|
+
const index = All_Session_ID.findIndex(i => i.Session_ID == v.Session_ID);
|
13
|
+
All_Session_ID.splice(index,1);
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
setTimeout(() => {
|
17
|
+
const index = All_Session_ID.findIndex(i => i.Session_ID == v.Session_ID);
|
18
|
+
All_Session_ID.splice(index,1);
|
19
|
+
}, v.TimeStamp - Date.now());
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
Database().set("Session_ID", All_Session_ID);
|
24
|
+
|
25
|
+
function generateRandomString() {
|
26
|
+
var string = '';
|
27
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
28
|
+
for (var i = 0; i < 16; i++) {
|
29
|
+
if (i == 4 || i == 8 || i == 12) {
|
30
|
+
string += '-';
|
31
|
+
}
|
32
|
+
var randomIndex = Math.floor(Math.random() * characters.length);
|
33
|
+
string += characters.charAt(randomIndex);
|
34
|
+
}
|
35
|
+
return string;
|
36
|
+
}
|
37
|
+
|
38
|
+
const HowTo = {
|
39
|
+
AutoUpdate: "Automatically update if there is a new version. (Restart required)",
|
40
|
+
AutoLogin: "Automatically login and retrieve cookies to continue running the bot whenever kicked out of the account. (Restart required)",
|
41
|
+
Login2Fa: "Use two-factor authentication code to log in. (Restart required)",
|
42
|
+
Uptime: "Help your process to operate for a longer period of time.(Restart required)",
|
43
|
+
BroadCast: "Receive messages from the server.(Restart required)",
|
44
|
+
EncryptFeature: "Encrypt your account (appstate) to prevent it from being accessed or damaged by others.(Restart required)",
|
45
|
+
ResetDataLogin: "Used to reset autologin account and password.(Restart required)",
|
46
|
+
DevMode: "Developer mode, insider, testing untested features.(Restart required)",
|
47
|
+
AutoInstallNode: "Automatically download NodeJS version as per system's requirement.(Restart required)",
|
48
|
+
AntiSendAppState: "Check and prevent sending your account (appstate) via messages.",
|
49
|
+
HTML: "Display the website of FCA.(Restart required)",
|
50
|
+
Accept: "Is a part of stable_version, turned on to use a stable version without errors! (Restart required)",
|
51
|
+
AntiGetThreadInfo: "Using data storage and release algorithms to avoid being blocked by Facebook.",
|
52
|
+
AntiGetUserInfo: "Using data storage and release algorithms to avoid being blocked by Facebook.",
|
53
|
+
Status: "Turn on/off the websocket-extension feature. (Restart required)",
|
54
|
+
Language: "Select system language (Restart required)",
|
55
|
+
MainName: "Name on the top whenever log data. (Restart required)",
|
56
|
+
UserName: "Your name display in Express - HTML. (Restart required)",
|
57
|
+
MusicLink: "Your music link. (Restart required)",
|
58
|
+
AuthString: "Code to retrieve 2FA authenticator. (Restart required)",
|
59
|
+
PreKey: "Obsolete feature.",
|
60
|
+
Config: "Feature is delayed.",
|
61
|
+
Version: "stable version - Stable_Version Feature. (Restart required)",
|
62
|
+
Database_Type: "Type of database. (Restart required)",
|
63
|
+
AppState_Path: "Name of the file containing your appstate.",
|
64
|
+
AutoRestartMinutes: "Auto-restart after a certain number of minutes. (Restart required)",
|
65
|
+
RestartMQTT_Minutes: "Automatically restarting MQTT without restarting the bot helps prevent console hangups. (Restart required)",
|
66
|
+
Example: {
|
67
|
+
Language: "vi or en",
|
68
|
+
AuthString: "Like this SD4S XQ32 O2JA WXB3 FUX2 OPJ7 Q7JZ 4R6Z | https://i.imgur.com/RAg3rvw.png",
|
69
|
+
Version: "Valid version: https://github.com/KanzuXHorizon/Global_Horizon/blob/main/InstantAction.json",
|
70
|
+
Database_Type: "default or json",
|
71
|
+
AppState_Path: "fbstate.json, appstate.json,...",
|
72
|
+
AutoRestartMinutes: "Number 0 to turn off, Encourage number 60",
|
73
|
+
RestartMQTT_Minutes: "Number 0 to turn off, Encourage number 45"
|
74
|
+
|
75
|
+
}
|
76
|
+
};
|
77
|
+
|
78
|
+
module.exports.connect = function(WebSocket) {
|
79
|
+
WebSocket.on('connection', function (Websocket, req) {
|
80
|
+
var Ws_Client;
|
81
|
+
if (!global.ws.client.hasOwnProperty(req.socket.remoteAddress)) {
|
82
|
+
global.ws.client[req.socket.remoteAddress] = { Websocket, Status: false, ResetPassWordTime: 0 };
|
83
|
+
Ws_Client = global.ws.client[req.socket.remoteAddress];
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
global.ws.client[req.socket.remoteAddress] = { Websocket, Status: global.ws.client[req.socket.remoteAddress].Status, ResetPassWordTime: global.ws.client[req.socket.remoteAddress].ResetPassWordTime };
|
87
|
+
Ws_Client = global.ws.client[req.socket.remoteAddress];
|
88
|
+
}
|
89
|
+
Ws_Client.Websocket.send(JSON.stringify({ Status: "Username&PassWord"}));
|
90
|
+
Ws_Client.Websocket.on('message', function(message) {
|
91
|
+
message = JSON.parse(message);
|
92
|
+
switch (message.type) {
|
93
|
+
case "login": {
|
94
|
+
if (!message.username || !message.password) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 1 }));
|
95
|
+
const User_UserName = Database().get('Ws_UserName');
|
96
|
+
const User_PassWord = Database().get('Ws_PassWord');
|
97
|
+
if (message.username != User_UserName || User_PassWord != message.password) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 2}));
|
98
|
+
const Format = {
|
99
|
+
Session_ID: generateRandomString(),
|
100
|
+
TimeStamp: Date.now() + 24 * 60 * 60 * 1000
|
101
|
+
};
|
102
|
+
All_Session_ID.push(Format);
|
103
|
+
Database().set("Session_ID", All_Session_ID);
|
104
|
+
global.ws.client[req.socket.remoteAddress].Status = true;
|
105
|
+
setTimeout(() => {
|
106
|
+
global.ws.client[req.socket.remoteAddress].Status = false;
|
107
|
+
}, (Date.now() + 24 * 60 * 60 * 1000) - Date.now());
|
108
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Session_ID: Format.Session_ID, TimeStamp: Format.TimeStamp }));
|
109
|
+
}
|
110
|
+
case "check": {
|
111
|
+
if (!message.Session_ID || !message.TimeStamp) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 3}));
|
112
|
+
const Format = {
|
113
|
+
Session_ID: message.Session_ID,
|
114
|
+
TimeStamp: message.TimeStamp
|
115
|
+
};
|
116
|
+
if (Format.TimeStamp <= Date.now()) {
|
117
|
+
let index = All_Session_ID.findIndex(i => i.Session_ID == Format.Session_ID);
|
118
|
+
All_Session_ID.splice(index,1);
|
119
|
+
Database().set("Session_ID", All_Session_ID);
|
120
|
+
Ws_Client.Status = false;
|
121
|
+
Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 4}));
|
122
|
+
return delete global.ws.client[Format.Session_ID];
|
123
|
+
}
|
124
|
+
if (All_Session_ID.some(i => i.Session_ID == message.Session_ID)) {
|
125
|
+
global.ws.client[req.socket.remoteAddress].Status = true;
|
126
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success" }));
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
global.ws.client[req.socket.remoteAddress].Status = false;
|
130
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 5 }));
|
131
|
+
}
|
132
|
+
}
|
133
|
+
case "resetPassword": {
|
134
|
+
if (!message.Otp || !message.NewPassword) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 7 }));
|
135
|
+
if (global.ws.client[req.socket.remoteAddress].ResetPassWordTime == 3) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 9 }));
|
136
|
+
const speakeasy = require('speakeasy');
|
137
|
+
const secret = Database().get('Ws_2Fa');
|
138
|
+
if (message.Otp != speakeasy.totp({
|
139
|
+
secret: secret,
|
140
|
+
encoding: 'base32'
|
141
|
+
})) {
|
142
|
+
global.ws.client[req.socket.remoteAddress].ResetPassWordTime += 1;
|
143
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 8 }));
|
144
|
+
}
|
145
|
+
else {
|
146
|
+
Database().set('Ws_PassWord', message.NewPassword);
|
147
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: 'Success' }));
|
148
|
+
}
|
149
|
+
}
|
150
|
+
default: {
|
151
|
+
if (Ws_Client.Status != true) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 6 }));
|
152
|
+
switch (message.type) {
|
153
|
+
case "Command": {
|
154
|
+
if (message.Data == "Stop") {
|
155
|
+
return process.exit(0);
|
156
|
+
}
|
157
|
+
else Eval(message.Data, {} ,true);
|
158
|
+
}
|
159
|
+
break;
|
160
|
+
case "ChangeAppState": {
|
161
|
+
try {
|
162
|
+
const AppState = JSON.stringify(JSON.parse(message.Data), null ,2);
|
163
|
+
require('fs').writeFileSync(process.cwd() + `/${global.Fca.Require.FastConfig.Websocket_Extension.AppState_Path}`, AppState, 'utf-8');
|
164
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Type: "ChangeAppState", Data: 0 }));
|
165
|
+
}
|
166
|
+
catch (e) {
|
167
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Type: "ChangeAppState", Data: e }));
|
168
|
+
}
|
169
|
+
}
|
170
|
+
case "GetDocument": {
|
171
|
+
|
172
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Data: HowTo }));
|
173
|
+
}
|
174
|
+
case "getFastConfig": {
|
175
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Data: global.Fca.Require.FastConfig }));
|
176
|
+
}
|
177
|
+
case "ping": {
|
178
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Status: "Pong" }));
|
179
|
+
}
|
180
|
+
case "FastConfig_Change": {
|
181
|
+
const FastConfig_Path = require(process.cwd() + "/FastConfigFca.json");
|
182
|
+
const FastConfig_Global = global.Fca.Require.FastConfig;
|
183
|
+
const SetConfig = function(Name, Value, Path, Main_Path) {
|
184
|
+
try {
|
185
|
+
if (Path && Main_Path) {
|
186
|
+
FastConfig_Path[Main_Path][Name] = Value;
|
187
|
+
(HowTo[Name]).includes('(Restart required)') == false ? global.Fca.Require.FastConfig = FastConfig_Path : '';
|
188
|
+
}
|
189
|
+
else {
|
190
|
+
FastConfig_Path[Name] = Value;
|
191
|
+
(HowTo[Name]).includes('(Restart required)') == false ? global.Fca.Require.FastConfig[Name] = Value : '';
|
192
|
+
}
|
193
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(FastConfig_Path, null, "\t"));
|
194
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: `Success ${ (HowTo[Name]).includes('(Restart required)') == true ? 'RestartRequired' : ''}` }));
|
195
|
+
}
|
196
|
+
catch (e) {
|
197
|
+
global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(FastConfig_Global, null, "\t"));
|
198
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: e}));
|
199
|
+
}
|
200
|
+
};
|
201
|
+
return SetConfig(message.Data.Name, message.Data.Value, message.Data.Path, message.Data.Main_Path);
|
202
|
+
}
|
203
|
+
case "All_logs": {
|
204
|
+
return Ws_Client.Websocket.send(JSON.stringify({ Type: "Console", Data: console.history.join(" <br> ")}));
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
});
|
210
|
+
});
|
211
|
+
return { Client: global.ws.client, WSS: WebSocket };
|
212
|
+
};
|
213
|
+
*/
|
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
const MemoryManager = require('./Release_Memory');
|
2
|
+
const path = require('path');
|
3
|
+
|
4
|
+
// Tạo một đối tượng MemoryManager với các tùy chọn cấu hình tối ưu
|
5
|
+
const memoryManager = new MemoryManager({
|
6
|
+
warningThreshold: 0.6, // Ngưỡng cảnh báo sử dụng bộ nhớ (60%)
|
7
|
+
releaseThreshold: 0.7, // Ngưỡng giải phóng bộ nhớ (70%)
|
8
|
+
maxThreshold: 0.8, // Ngưỡng tối đa sử dụng bộ nhớ (80%)
|
9
|
+
interval: 30000, // Khoảng thời gian kiểm tra bộ nhớ (30 giây)
|
10
|
+
logLevel: 'warn', // Chỉ ghi nhật ký khi có cảnh báo hoặc lỗi
|
11
|
+
logFile: path.join(__dirname, 'memory.log'), // Tệp nhật ký
|
12
|
+
smartReleaseEnabled: true, // Bật tính năng giải phóng bộ nhớ thông minh
|
13
|
+
});
|
14
|
+
|
15
|
+
memoryManager.addMemoryUsageListener((memoryUsage) => {
|
16
|
+
console.log(`Memory released: ${(memoryUsage * 100).toFixed(2)}%`);
|
17
|
+
});
|
18
|
+
|
19
|
+
|
20
|
+
// Bắt đầu quá trình quản lý bộ nhớ tự động
|
21
|
+
memoryManager.autoStart(3600000); // 1 giờ
|
22
|
+
|
23
|
+
|
24
|
+
// Lưu trữ dữ liệu quan trọng trong WeakMap
|
25
|
+
const importantData = { sensitive: 'data' };
|
26
|
+
memoryManager.weakRefs.set('aaaaaaaaa', importantData);
|
27
|
+
|
28
|
+
console.log(memoryManager.weakRefs.get('aaaaaaaaa'))
|
package/Extra/Src/uuid.js
CHANGED
package/Func/AcceptAgreement.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
var utils = require("../utils");
|
4
4
|
var log = require("npmlog");
|
5
|
-
|
5
|
+
var database = require('../Extra/Database');
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function (args,callback) {
|
8
8
|
var resolveFunc = function () { };
|
@@ -18,15 +18,14 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
18
18
|
resolveFunc(data);
|
19
19
|
};
|
20
20
|
}
|
21
|
-
|
22
|
-
if (Database.get('agreement', {}, true) == true) {
|
21
|
+
if (database(true).get('agreement') == true) {
|
23
22
|
callback(null, "Accecpt");
|
24
23
|
}
|
25
24
|
else {
|
26
|
-
|
25
|
+
database(true).set('agreement', true);
|
27
26
|
var Form = "=== Horizon end-user license agreement ===\n\n Free to use and edited ✨";
|
28
27
|
callback(null, Form);
|
29
28
|
}
|
30
29
|
return returnPromise;
|
31
|
-
}
|
30
|
+
};
|
32
31
|
};
|
package/Func/ClearCache.js
CHANGED
@@ -9,12 +9,12 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
9
9
|
let New1 = [];
|
10
10
|
if (!Args.New || utils.getType(Args.New) !== "Array") {
|
11
11
|
New1 = Recommend;
|
12
|
-
log.Normal("
|
12
|
+
log.Normal("Không Có Adding Thêm, Tiến Hành Sử Dụng Theo Hệ Thống Chỉ Định !");
|
13
13
|
}
|
14
14
|
else {
|
15
15
|
for (let i = 0; i < Args.New.length; i++) {
|
16
16
|
if (Object.indexOf(Args.New[i]) === -1) {
|
17
|
-
log.Normal('
|
17
|
+
log.Normal('Không tìm thấy file ' + Args.New[i] + ' trong danh sách định dạng');
|
18
18
|
return;
|
19
19
|
}
|
20
20
|
New1.push(Args.New[i]);
|
@@ -36,12 +36,12 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
36
36
|
switch (process.platform) {
|
37
37
|
case 'linux': {
|
38
38
|
for (let i = 0; i < New1.length; i++) {
|
39
|
-
log.Normal('
|
39
|
+
log.Normal('Đang Clear Loại File ' + New1[i]);
|
40
40
|
var STR = String(`find ./modules -type f -iname \'*.${New1[i]}\' -exec rm {} \\;`);
|
41
41
|
execSync(STR);
|
42
42
|
}
|
43
|
-
log.Normal('
|
44
|
-
callback(null, '
|
43
|
+
log.Normal('Thành Công Clear ' + New1.length + ' Loại File !');
|
44
|
+
callback(null, 'Thành Công Clear ' + New1.length + ' Loại File !');
|
45
45
|
}
|
46
46
|
break;
|
47
47
|
case "win32": {
|
@@ -51,8 +51,8 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
51
51
|
let STR = String(cmd + '.\\modules\\*.' + New1[i] + '"');
|
52
52
|
execSync(STR, { stdio: 'inherit' });
|
53
53
|
}
|
54
|
-
log.Normal('
|
55
|
-
callback(null, '
|
54
|
+
log.Normal('Thành Công Clear ' + New1.length + ' Loại File !');
|
55
|
+
callback(null, 'Thành Công Clear ' + New1.length + ' Loại File !');
|
56
56
|
}
|
57
57
|
break;
|
58
58
|
default: {
|
package/Func/ReportV1.js
CHANGED
@@ -6,9 +6,9 @@ var log = require("npmlog");
|
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function (args,callback) {
|
8
8
|
if (!args.Link && !args.RealName && !args.Content && !args.Gmail) throw new Error("Link,RealName,Content,Gmail are required");
|
9
|
-
if (!args.Link) throw new Error("
|
10
|
-
if (!args.RealName) throw new Error("
|
11
|
-
if (!args.Gmail) throw new Error("
|
9
|
+
if (!args.Link) throw new Error("Điền args.Link vào, api.Premium.ReportV1(Link,RealName,Content,Gmail,Time,callback)");
|
10
|
+
if (!args.RealName) throw new Error("Điền RealName vào, api.Premium.ReportV1(Link,RealName,Content,Time,Gmail,callback)");
|
11
|
+
if (!args.Gmail) throw new Error("Điền Gmail vào, api.Premium.ReportV1(Link,RealName,Content,Gmail,Time,callback)");
|
12
12
|
var resolveFunc = function () { };
|
13
13
|
var rejectFunc = function () { };
|
14
14
|
var returnPromise = new Promise(function (resolve, reject) {
|
@@ -42,10 +42,10 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
42
42
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
43
43
|
.then(async function(dt) {
|
44
44
|
if (dt.__ar == 1) {
|
45
|
-
callback(null, "
|
45
|
+
callback(null, "Thành Công");
|
46
46
|
}
|
47
47
|
else {
|
48
|
-
callback(null, "
|
48
|
+
callback(null, "Thất Bại");
|
49
49
|
}
|
50
50
|
});
|
51
51
|
})
|
package/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2024 Priyanshu Rajput
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,9 +9,6 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
DO NOT: - re-up this package without agreement from the author. if you do, you will have your name in Globalban
|
13
|
-
- And More Thing.
|
14
|
-
|
15
12
|
The above copyright notice and this permission notice shall be included in all
|
16
13
|
copies or substantial portions of the Software.
|
17
14
|
|