fca-rebel-remake 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.config/configstore/update-notifier-npm.json +4 -0
  3. package/.config/configstore/update-notifier-npm.json.1735545094 +4 -0
  4. package/.replit +84 -0
  5. package/.upm/store.json +1 -0
  6. package/Extra/Database/5 +1 -0
  7. package/Extra/Database/index.js +469 -0
  8. package/Extra/E +1 -0
  9. package/Extra/Ex +1 -0
  10. package/Extra/ExtraAddons.js +82 -0
  11. package/Extra/ExtraFindUID.js +62 -0
  12. package/Extra/ExtraGetThread.js +340 -0
  13. package/Extra/ExtraScreenShot.js +430 -0
  14. package/Extra/ExtraUptimeRobot.js +38 -0
  15. package/Extra/Html/Classic/C +1 -0
  16. package/Extra/Html/Classic/script.js +119 -0
  17. package/Extra/Html/Classic/style.css +8 -0
  18. package/Extra/Security/Sec +1 -0
  19. package/Extra/Security/Ser +1 -0
  20. package/Extra/Security/Step_1.js +6 -0
  21. package/Extra/Security/Step_2.js +22 -0
  22. package/Extra/Security/Step_3.js +22 -0
  23. package/Extra/src/4 +1 -0
  24. package/Extra/src/Change_Environment.js +24 -0
  25. package/Extra/src/Check_Update.js +67 -0
  26. package/Extra/src/F +1 -0
  27. package/Extra/src/History.js +115 -0
  28. package/Extra/src/Instant_Update.js +65 -0
  29. package/Extra/src/Last-Run.js +65 -0
  30. package/Extra/src/Premium.js +81 -0
  31. package/Extra/src/Release_Memory.js +41 -0
  32. package/Extra/src/Websocket.js +213 -0
  33. package/Extra/src/uuid.js +137 -0
  34. package/Func/AcceptAgreement.js +31 -0
  35. package/Func/ClearCache.js +64 -0
  36. package/Func/Fun +1 -0
  37. package/Func/ReportV1.js +54 -0
  38. package/LICENSE +21 -0
  39. package/Main.js +1211 -0
  40. package/README.md +201 -0
  41. package/SECURITY.md +18 -0
  42. package/broadcast.js +40 -0
  43. package/index.js +386 -0
  44. package/language/A +1 -0
  45. package/logger.js +66 -0
  46. package/package.json +94 -0
  47. package/replit.nix +8 -0
  48. package/src/& +1 -0
  49. package/src/Cs +1 -0
  50. package/src/Dev_Horizon_Data.js +125 -0
  51. package/src/Premium.js +25 -0
  52. package/src/Screenshot.js +83 -0
  53. package/src/addExternalModule.js +16 -0
  54. package/src/addUserToGroup.js +79 -0
  55. package/src/changeAdminStatus.js +79 -0
  56. package/src/changeArchivedStatus.js +41 -0
  57. package/src/changeAvt.js +85 -0
  58. package/src/changeBio.js +65 -0
  59. package/src/changeBlockedStatus.js +36 -0
  60. package/src/changeGroupImage.js +106 -0
  61. package/src/changeNickname.js +45 -0
  62. package/src/changeThreadColor.js +62 -0
  63. package/src/changeThreadEmoji.js +42 -0
  64. package/src/createNewGroup.js +70 -0
  65. package/src/createPoll.js +60 -0
  66. package/src/deleteMessage.js +45 -0
  67. package/src/deleteThread.js +43 -0
  68. package/src/forwardAttachment.js +48 -0
  69. package/src/getAccessToken.js +28 -0
  70. package/src/getCurrentUserID.js +7 -0
  71. package/src/getEmojiUrl.js +27 -0
  72. package/src/getFriendsList.js +73 -0
  73. package/src/getMessage.js +80 -0
  74. package/src/getThreadHistory.js +537 -0
  75. package/src/getThreadInfo.js +425 -0
  76. package/src/getThreadList.js +213 -0
  77. package/src/getThreadMain.js +220 -0
  78. package/src/getThreadPictures.js +59 -0
  79. package/src/getUID.js +59 -0
  80. package/src/getUserID.js +62 -0
  81. package/src/getUserInfo.js +113 -0
  82. package/src/getUserInfoMain.js +65 -0
  83. package/src/getUserInfoV2.js +32 -0
  84. package/src/getUserInfoV3.js +63 -0
  85. package/src/getUserInfoV4.js +55 -0
  86. package/src/getUserInfoV5.js +61 -0
  87. package/src/handleFriendRequest.js +46 -0
  88. package/src/handleMessageRequest.js +49 -0
  89. package/src/httpGet.js +49 -0
  90. package/src/httpPost.js +48 -0
  91. package/src/httpPostFormData.js +41 -0
  92. package/src/listenMqtt.js +787 -0
  93. package/src/logout.js +68 -0
  94. package/src/markAsDelivered.js +48 -0
  95. package/src/markAsRead.js +70 -0
  96. package/src/markAsReadAll.js +43 -0
  97. package/src/markAsSeen.js +51 -0
  98. package/src/muteThread.js +47 -0
  99. package/src/removeUserFromGroup.js +49 -0
  100. package/src/resolvePhotoUrl.js +37 -0
  101. package/src/searchForThread.js +43 -0
  102. package/src/sendMessage.js +379 -0
  103. package/src/sendTypingIndicator.js +80 -0
  104. package/src/setMessageReaction.js +109 -0
  105. package/src/setPostReaction.js +102 -0
  106. package/src/setTitle.js +74 -0
  107. package/src/threadColors.js +39 -0
  108. package/src/unfriend.js +43 -0
  109. package/src/unsendMessage.js +40 -0
  110. package/test/ARIFVAU_Database/ARIFVAU_Database +0 -0
  111. package/test/ARIFVAU_Database/A_README.md +1 -0
  112. package/test/ARIFVAU_Database/Database.db +0 -0
  113. package/test/ARIFVAU_Database/Database.sqlite +0 -0
  114. package/test/ARIFVAU_Database/H +1 -0
  115. package/test/ARIFVAU_Database/SyntheticDatabase.sqlite +0 -0
  116. package/test/Arif +1 -0
  117. package/test/Database_Test.js +4 -0
  118. package/test/Db2.js +530 -0
  119. package/test/Ttt +1 -0
  120. package/test/data/data +1 -0
  121. package/test/data/shareAttach.js +146 -0
  122. package/test/data/test.txt +7 -0
  123. package/test/data//340/247/263 +1 -0
  124. package/test/env/env +1 -0
  125. package/test/env.env +0 -0
  126. package/test/example-config.json +18 -0
  127. package/test/example-db.db +0 -0
  128. package/test/memoryleak.js +18 -0
  129. package/test/test-page.js +140 -0
  130. package/test/test.js +385 -0
  131. package/test/testv2.js +18 -0
  132. package/utils.js +1683 -0
@@ -0,0 +1,67 @@
1
+ module.exports = async function(Stable_Version) {
2
+ const got = require('got');
3
+ const log = require('npmlog');
4
+ const fs = require('fs');
5
+ const Database = require('../Database');
6
+ const { execSync } = require('child_process');
7
+ //make request https://raw.githubusercontent.com/KanzuXHorizon/TRA-Horizon-Remastered/main/package.json
8
+ const { body } = await got('https://raw.githubusercontent.com/ARIF-VAU-TRA233/A4IFB0T/main/package.json');
9
+ const json = JSON.parse(body);
10
+ const LocalVersion = require('../../package.json').version;
11
+ if (Number(LocalVersion.replace(/\./g,"")) < Number(json.version.replace(/\./g,"")) && global.TRA.Require.FastConfig.Stable_Version.Accept == false || Stable_Version && Number(LocalVersion.replace(/\./g,"")) != Number(Stable_Version.replace(/\./g,""))) {
12
+ var Version = Stable_Version != undefined ? Stable_Version : json.version;
13
+ log.warn("[ TRA-UPDATE ] •","New Version, Ready to Update: " + LocalVersion + " -> " + Version);
14
+ await new Promise(resolve => setTimeout(resolve, 3000));
15
+ try {
16
+ execSync(`npm install TRA-horizon-remastered@${Version}`, { stdio: 'inherit' });
17
+ log.info("[ TRA-UPDATE ] •","Update Complete, Restarting...");
18
+ await new Promise(resolve => setTimeout(resolve, 3000));
19
+ Database().set("Instant_Update", Date.now());
20
+ await new Promise(resolve => setTimeout(resolve, 3000));
21
+ process.exit(1);
22
+ }
23
+ catch (err) {
24
+ try {
25
+ console.log(err);
26
+ log.warn("[ TRA-UPDATE ] •","Update Failed, Trying Another Method 1...");
27
+ await new Promise(resolve => setTimeout(resolve, 3000));
28
+ execSync(`npm install TRA-horizon-remastered@${Version} --force`, { stdio: 'inherit' });
29
+ log.info("[ TRA-UPDATE ] •","Update Complete, Restarting...");
30
+ await new Promise(resolve => setTimeout(resolve, 3000));
31
+ Database().set("Instant_Update", Date.now());
32
+ await new Promise(resolve => setTimeout(resolve, 3000));
33
+ process.exit(1);
34
+ }
35
+ catch (err) {
36
+ try {
37
+ console.log(err);
38
+ log.warn("[ TRA-UPDATE ] •","Update Failed, Trying to clean Database() cache...");
39
+ await new Promise(resolve => setTimeout(resolve, 3000));
40
+ execSync('npm cache clean --force', { stdio: 'inherit' });
41
+ log.info("[ TRA-UPDATE ] •","Cache Cleaned, Trying Another Method 2...");
42
+ await new Promise(resolve => setTimeout(resolve, 3000));
43
+ //self delete TRA-horizon-remastered folder from node_modules
44
+ fs.rmdirSync((process.cwd() + "/node_modules/TRA-horizon-remastered" || __dirname + '../../../TRA-horizon-remastered'), { recursive: true });
45
+ await new Promise(resolve => setTimeout(resolve, 3000));
46
+ execSync(`npm install TRA-horizon-remastered@${Version}`, { stdio: 'inherit' });
47
+ log.info("[ TRA-UPDATE ] •","Update Complete, Restarting...");
48
+ await new Promise(resolve => setTimeout(resolve, 3000));
49
+ Database().set("Instant_Update", Date.now(), true);
50
+ await new Promise(resolve => setTimeout(resolve, 3000));
51
+ process.exit(1);
52
+ }
53
+ catch (e) {
54
+ console.log(e);
55
+ log.error("[ TRA-UPDATE ] •","Update Failed, Please Update Manually");
56
+ await new Promise(resolve => setTimeout(resolve, 3000));
57
+ log.warn("[ TRA-UPDATE ] •","Please contact to owner about update failed and screentshot error log at fb.com/Lazic.Kanzu");
58
+ await new Promise(resolve => setTimeout(resolve, 3000));
59
+ process.exit(1);
60
+ }
61
+ }
62
+ }
63
+ }
64
+ else {
65
+ return Database().set("NeedRebuild", false, true);
66
+ }
67
+ }
package/Extra/src/F ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Console History v1.5.1
3
+ * console-history.js
4
+ *
5
+ * Licensed under the MIT License.
6
+ * https://git.io/console
7
+ */
8
+ 'use strict'
9
+
10
+ /* Allow only one instance of console-history.js */
11
+ if (typeof console.history !== 'undefined') {
12
+ throw new Error('Only one instance of console-history.js can run at a time.')
13
+ }
14
+
15
+ /* Store the original log functions. */
16
+ console._log = console.log
17
+ console._info = console.info
18
+ console._warn = console.warn
19
+ console._error = console.error
20
+ console._debug = console.debug
21
+
22
+ /* Declare our console history variable. */
23
+ console.history = []
24
+
25
+ /* Redirect all calls to the collector. */
26
+ console.log = function(dt) {
27
+ return console._intercept('log', dt, arguments)
28
+ }
29
+ console.info = function(dt) {
30
+ return console._intercept('info', dt, arguments)
31
+ }
32
+ console.warn = function(dt) {
33
+ return console._intercept('warn', dt, arguments)
34
+ }
35
+ console.error = function(dt) {
36
+ return console._intercept('error', dt, arguments)
37
+ }
38
+ console.debug = function(dt) {
39
+ return console._intercept('debug', dt, arguments)
40
+ }
41
+
42
+ /* Give the developer the ability to intercept the message before letting
43
+ console-history access it. */
44
+ console._intercept = function(type, data, args) {
45
+ // Your own code can go here, but the preferred method is to override this
46
+ // function in your own script, and add the line below to the end or
47
+ // begin of your own 'console._intercept' function.
48
+ // REMEMBER: Use only underscore console commands inside _intercept!
49
+ console._collect(type, data,args)
50
+ }
51
+
52
+ /* Define the main log catcher. */
53
+ console._collect = function(type, data, args) {
54
+ // WARNING: When debugging this function, DO NOT call a modified console.log
55
+ // function, all hell will break loose.
56
+ // Instead use the original console._log functions.
57
+
58
+ // All the arguments passed to any function, even when not defined
59
+ // inside the function declaration, are stored and locally available in
60
+ // the variable called 'arguments'.
61
+ //
62
+ // The arguments of the original console.log functions are collected above,
63
+ // and passed to this function as a variable 'args', since 'arguments' is
64
+ // reserved for the current function.
65
+
66
+ // Collect the timestamp of the console log.
67
+ const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
68
+
69
+ var time = new Date().toLocaleDateString('vi-VN', options)
70
+
71
+ // Make sure the 'type' parameter is set. If no type is set, we fall
72
+ // back to the default log type.
73
+ if (!type) type = 'log'
74
+
75
+ // To ensure we behave like the original console log functions, we do not
76
+ // output anything if no arguments are provided.
77
+ if (!args || args.length === 0) return
78
+
79
+ // Act normal, and just pass all original arguments to
80
+ // the origial console function :)
81
+ console['_' + type].apply(console, args)
82
+
83
+ // Get stack trace information. By throwing an error, we get access to
84
+ // a stack trace. We then go up in the trace tree and filter out
85
+ // irrelevant information.
86
+ var stack = false
87
+ try {
88
+ throw Error('')
89
+ } catch (error) {
90
+ // The lines containing 'console-history.js' are not relevant to us.
91
+ var stackParts = error.stack.split('\n')
92
+ stack = []
93
+ for (var i = 0; i < stackParts.length; i++) {
94
+ if (stackParts[i].indexOf('console-history.js') > -1 ||
95
+ stackParts[i].indexOf('console-history.min.js') > -1 ||
96
+ stackParts[i] === 'Error') {
97
+ continue
98
+ }
99
+ stack.push(stackParts[i].trim())
100
+ }
101
+ }
102
+ try {
103
+ data = data.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,'')
104
+ }
105
+ catch (e) {
106
+ data = data;
107
+ }
108
+ // Add the log to our history.
109
+ console.history.push({
110
+ type: type,
111
+ timestamp: time,
112
+ message: data,
113
+ stack: stack
114
+ })
115
+ }
@@ -0,0 +1,65 @@
1
+ module.exports = async function() {
2
+ const got = require('got');
3
+ const log = require('npmlog');
4
+ const fs = require('fs');
5
+ const Database = require('../Database')
6
+ const { execSync } = require('child_process');
7
+ //make request https://raw.githubusercontent.com/KanzuXHorizon/TRA-Horizon-Remastered/main/package.json
8
+ const { body } = await got('https://github.com/ARIF-VAU-TRA233/A4IFB0T/raw/main/InstantActoin.json');
9
+ const json = JSON.parse(body);
10
+ const LocalVersion = require('../../package.json').version;
11
+ if (Number(LocalVersion.replace(/\./g,"")) < Number(json.Version.replace(/\./g,"")) ) {
12
+ log.warn("[ TRA-UPDATE ] •","Found a command that requires downloading an important Version to avoid errors, update onions: " + LocalVersion + " -> " + json.Version);
13
+ log.warn("[ TRA-UPDATE ] •","Problem Description: " + json.Problem);
14
+ await new Promise(resolve => setTimeout(resolve, 3000));
15
+ try {
16
+ execSync(`npm install TRA-horizon-remastered@${json.Version}`, { stdio: 'inherit' });
17
+ log.info("[ TRA-UPDATE ] •","Update Complete, Restarting...");
18
+ await new Promise(resolve => setTimeout(resolve, 3000));
19
+ Database(true).set("Instant_Update", Date.now(), true);
20
+ await new Promise(resolve => setTimeout(resolve, 3000));
21
+ process.exit(1);
22
+ }
23
+ catch (err) {
24
+ try {
25
+ log.warn("[ TRA-UPDATE ] •","Update Failed, Trying Another Method 1...");
26
+ await new Promise(resolve => setTimeout(resolve, 3000));
27
+ execSync(`npm install TRA-horizon-remastered@${json.Version} --force`, { stdio: 'inherit' });
28
+ log.info("[ TRA-UPDATE ] •","Update Complete, Restarting...");
29
+ await new Promise(resolve => setTimeout(resolve, 3000));
30
+ Database(true).set("Instant_Update", Date.now());
31
+ await new Promise(resolve => setTimeout(resolve, 3000));
32
+ process.exit(1);
33
+ }
34
+ catch (err) {
35
+ try {
36
+ log.warn("[ TRA-UPDATE ] •","Update Failed, Trying to clean package cache...");
37
+ await new Promise(resolve => setTimeout(resolve, 3000));
38
+ execSync('npm cache clean --force', { stdio: 'inherit' });
39
+ log.info("[ TRA-UPDATE ] •","Cache Cleaned, Trying Another Method 2...");
40
+ await new Promise(resolve => setTimeout(resolve, 3000));
41
+ //self delete TRA-horizon-remastered folder from node_modules
42
+ fs.rmdirSync((process.cwd() + "/node_modules/TRA-horizon-remastered" || __dirname + '../../../TRA-horizon-remastered'), { recursive: true });
43
+ await new Promise(resolve => setTimeout(resolve, 3000));
44
+ execSync(`npm install TRA-horizon-remastered@${json.Version}`, { stdio: 'inherit' });
45
+ log.info("[ TRA-UPDATE ] •","Update Complete, Restarting...");
46
+ await new Promise(resolve => setTimeout(resolve, 3000));
47
+ Database(true).set("Instant_Update", Date.now());
48
+ await new Promise(resolve => setTimeout(resolve, 3000));
49
+ process.exit(1);
50
+ }
51
+ catch (e) {
52
+ console.log(e);
53
+ log.error("[ TRA-UPDATE ] •","Update Failed, Please Update Manually");
54
+ await new Promise(resolve => setTimeout(resolve, 3000));
55
+ log.warn("[ TRA-UPDATE ] •","Please contact to owner about update failed and screentshot error log at fb.com/Lazic.Kanzu");
56
+ await new Promise(resolve => setTimeout(resolve, 3000));
57
+ process.exit(1);
58
+ }
59
+ }
60
+ }
61
+ }
62
+ else {
63
+ return Database(true).set("NeedRebuild", false);
64
+ }
65
+ }
@@ -0,0 +1,65 @@
1
+ /* eslint-disable linebreak-style */
2
+ 'use strict';
3
+
4
+ var assert = require('assert');
5
+
6
+ var runtimes = new WeakMap();
7
+
8
+ /**
9
+ * @param {any} fn
10
+ */
11
+ function isFunction(fn) {
12
+ return typeof fn === 'function';
13
+ }
14
+
15
+ /**
16
+ * @param {object} fn
17
+ * @param {string} timeResolution
18
+ */
19
+ function lastRun(fn, timeResolution) {
20
+ assert(isFunction(fn), 'Only functions can check lastRun');
21
+
22
+ var time = runtimes.get(fn);
23
+
24
+ if (time == null) {
25
+ return;
26
+ }
27
+
28
+ var resolution = parseInt(timeResolution, 10) || 1;
29
+ return time - (time % resolution);
30
+ }
31
+
32
+ /**
33
+ * @param {object} fn
34
+ * @param {number} timestamp
35
+ */
36
+ function capture(fn, timestamp) {
37
+ assert(isFunction(fn), 'Only functions can be captured');
38
+
39
+ timestamp = timestamp || Date.now();
40
+
41
+ runtimes.set(fn, timestamp);
42
+ }
43
+
44
+ /**
45
+ * @param {object} name
46
+ */
47
+ function has(name) {
48
+ return runtimes.has(name);
49
+ }
50
+
51
+ /**
52
+ * @param {object} fn
53
+ */
54
+ function release(fn) {
55
+ assert(isFunction(fn), 'Only functions can be captured');
56
+
57
+ runtimes.delete(fn);
58
+ }
59
+
60
+ module.exports = {
61
+ lastRun,
62
+ capture,
63
+ release,
64
+ has
65
+ };
@@ -0,0 +1,81 @@
1
+ module.exports = async function(SessionID) {
2
+ try {
3
+ var userName,Text;
4
+ var os = require('os');
5
+ var Database = require("../Database");
6
+ var { getAll,readyCreate,deleteAll } = require('../ExtraGetThread');
7
+ if (process.env.REPL_OWNER != undefined) userName = process.env.REPL_OWNER;
8
+ else if (os.hostname() != null || os.hostname() != undefined) userName = os.hostname();
9
+ else userName = os.userInfo().username;
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);
15
+ }
16
+ }
17
+ if (Database(true).has('PremiumKey') && Database(true).get('PremiumKey') != '' && Database(true).has('Premium') && Database(true).get('Premium') == true) {
18
+ try {
19
+ Database(true).set('Premium', true);
20
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
21
+ Database(true).set('UserName', userName);
22
+ process.env.HalzionVersion = 1973
23
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
24
+ }
25
+ catch (error) {
26
+ Text = "Lỗi Kết Nối";
27
+ }
28
+ } else if (global.Fca.Require.FastConfig.PreKey) {
29
+ try {
30
+ Database(true).set('Premium', true);
31
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
32
+ Database(true).set('UserName', userName);
33
+ process.env.HalzionVersion = 1973
34
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
35
+ }
36
+ catch (error) {
37
+ Text = "Lỗi Kết Nối";
38
+ }
39
+ }
40
+ else if (!global.Fca.Require.FastConfig.PreKey) {
41
+ try {
42
+ Database(true).set('Premium', true);
43
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
44
+ Database(true).set('UserName', userName);
45
+ process.env.HalzionVersion = 1973
46
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
47
+ }
48
+ catch (error) {
49
+ Text = "Lỗi Kết Nối";
50
+ }
51
+ }
52
+ } catch (e) {
53
+ try {
54
+ Database(true).set('Premium', true);
55
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
56
+ Database(true).set('UserName', userName);
57
+ process.env.HalzionVersion = 1973
58
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
59
+ }
60
+ catch (error) {
61
+ Text = "Lỗi Kết Nối";
62
+ }
63
+ }
64
+ if (process.env.HalzionVersion == 1973) {
65
+ try {
66
+ let data = [];
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);
72
+ }
73
+ });
74
+ deleteAll(data);
75
+ }
76
+ } catch (e) {
77
+ console.log(e);
78
+ }
79
+ }
80
+ return Text;
81
+ }
@@ -0,0 +1,41 @@
1
+ /* eslint-disable linebreak-style */
2
+ const v8 = require('v8');
3
+
4
+ function gc() {
5
+ var v8 = require("v8");
6
+ var vm = require('node:vm');
7
+ v8.setFlagsFromString('--expose_gc');
8
+ var gc = vm.runInNewContext('gc');
9
+ return gc;
10
+ }
11
+
12
+ if (typeof global.gc !== 'function') {
13
+ global.gc = gc();
14
+ }
15
+
16
+ var releaseMemory = function () {
17
+ if (global.gc) {
18
+ global.gc();
19
+ } else {
20
+ var v8 = require("v8");
21
+ var vm = require('node:vm');
22
+ v8.setFlagsFromString('--expose_gc');
23
+ vm.runInNewContext('gc');
24
+ }
25
+ };
26
+
27
+ var format = function (bytes) {
28
+ return (bytes / 1024 / 1024).toFixed(2);
29
+ };
30
+
31
+ function memoryWatcher(limit) {
32
+ let used = format(v8.getHeapStatistics().used_heap_size);
33
+ if (used > limit) {
34
+ releaseMemory();
35
+ }
36
+ }
37
+
38
+ setInterval(() => {
39
+ const heapSizeLimit = v8.getHeapStatistics().heap_size_limit;
40
+ memoryWatcher(format(heapSizeLimit) - (format(heapSizeLimit) / 60));// MB
41
+ }, 1000);
@@ -0,0 +1,213 @@
1
+ // /**
2
+ // /* eslint-disable no-prototype-builtins */
3
+ // /* eslint-disable linebreak-style */
4
+
5
+ // const Eval = require('eval');
6
+ // const Database = require('../Database');
7
+ // global.ws = new Object({
8
+ // client: {},
9
+ // });
10
+ // const All_Session_ID = Database().get('Session_ID') || []; // [ { Session_ID: ".", TimeStamp: "" }]
11
+ // for (let v of All_Session_ID) {
12
+ // if (v.TimeStamp <= Date.now()) {
13
+ // const index = All_Session_ID.findIndex(i => i.Session_ID == v.Session_ID);
14
+ // All_Session_ID.splice(index,1);
15
+ // }
16
+ // else {
17
+ // setTimeout(() => {
18
+ // const index = All_Session_ID.findIndex(i => i.Session_ID == v.Session_ID);
19
+ // All_Session_ID.splice(index,1);
20
+ // }, v.TimeStamp - Date.now());
21
+ // }
22
+ // }
23
+
24
+ // Database().set("Session_ID", All_Session_ID);
25
+
26
+ // function generateRandomString() {
27
+ // var string = '';
28
+ // var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
29
+ // for (var i = 0; i < 16; i++) {
30
+ // if (i == 4 || i == 8 || i == 12) {
31
+ // string += '-';
32
+ // }
33
+ // var randomIndex = Math.floor(Math.random() * characters.length);
34
+ // string += characters.charAt(randomIndex);
35
+ // }
36
+ // return string;
37
+ // }
38
+
39
+ // const HowTo = {
40
+ // AutoUpdate: "Automatically update if there is a new version. (Restart required)",
41
+ // AutoLogin: "Automatically login and retrieve cookies to continue running the bot whenever kicked out of the account. (Restart required)",
42
+ // Login2Fa: "Use two-factor authentication code to log in. (Restart required)",
43
+ // Uptime: "Help your process to operate for a longer period of time.(Restart required)",
44
+ // BroadCast: "Receive messages from the server.(Restart required)",
45
+ // EncryptFeature: "Encrypt your account (appstate) to prevent it from being accessed or damaged by others.(Restart required)",
46
+ // ResetDataLogin: "Used to reset autologin account and password.(Restart required)",
47
+ // DevMode: "Developer mode, insider, testing untested features.(Restart required)",
48
+ // AutoInstallNode: "Automatically download NodeJS version as per system's requirement.(Restart required)",
49
+ // AntiSendAppState: "Check and prevent sending your account (appstate) via messages.",
50
+ // HTML: "Display the website of FCA.(Restart required)",
51
+ // Accept: "Is a part of stable_version, turned on to use a stable version without errors! (Restart required)",
52
+ // AntiGetThreadInfo: "Using data storage and release algorithms to avoid being blocked by Facebook.",
53
+ // AntiGetUserInfo: "Using data storage and release algorithms to avoid being blocked by Facebook.",
54
+ // Status: "Turn on/off the websocket-extension feature. (Restart required)",
55
+ // Language: "Select system language (Restart required)",
56
+ // MainName: "Name on the top whenever log data. (Restart required)",
57
+ // UserName: "Your name display in Express - HTML. (Restart required)",
58
+ // MusicLink: "Your music link. (Restart required)",
59
+ // AuthString: "Code to retrieve 2FA authenticator. (Restart required)",
60
+ // PreKey: "Obsolete feature.",
61
+ // Config: "Feature is delayed.",
62
+ // Version: "stable version - Stable_Version Feature. (Restart required)",
63
+ // Database_Type: "Type of database. (Restart required)",
64
+ // AppState_Path: "Name of the file containing your appstate.",
65
+ // AutoRestartMinutes: "Auto-restart after a certain number of minutes. (Restart required)",
66
+ // RestartMQTT_Minutes: "Automatically restarting MQTT without restarting the bot helps prevent console hangups. (Restart required)",
67
+ // Example: {
68
+ // Language: "vi or en",
69
+ // AuthString: "Like this SD4S XQ32 O2JA WXB3 FUX2 OPJ7 Q7JZ 4R6Z | https://i.imgur.com/RAg3rvw.png",
70
+ // Version: "Valid version: https://github.com/KanzuXHorizon/Global_Horizon/blob/main/InstantAction.json",
71
+ // Database_Type: "default or json",
72
+ // AppState_Path: "fbstate.json, appstate.json,...",
73
+ // AutoRestartMinutes: "Number 0 to turn off, Encourage number 60",
74
+ // RestartMQTT_Minutes: "Number 0 to turn off, Encourage number 45"
75
+
76
+ // }
77
+ // };
78
+
79
+ // module.exports.connect = function(WebSocket) {
80
+ // WebSocket.on('connection', function (Websocket, req) {
81
+ // var Ws_Client;
82
+ // if (!global.ws.client.hasOwnProperty(req.socket.remoteAddress)) {
83
+ // global.ws.client[req.socket.remoteAddress] = { Websocket, Status: false, ResetPassWordTime: 0 };
84
+ // Ws_Client = global.ws.client[req.socket.remoteAddress];
85
+ // }
86
+ // else {
87
+ // global.ws.client[req.socket.remoteAddress] = { Websocket, Status: global.ws.client[req.socket.remoteAddress].Status, ResetPassWordTime: global.ws.client[req.socket.remoteAddress].ResetPassWordTime };
88
+ // Ws_Client = global.ws.client[req.socket.remoteAddress];
89
+ // }
90
+ // Ws_Client.Websocket.send(JSON.stringify({ Status: "Username&PassWord"}));
91
+ // Ws_Client.Websocket.on('message', function(message) {
92
+ // message = JSON.parse(message);
93
+ // switch (message.type) {
94
+ // case "login": {
95
+ // if (!message.username || !message.password) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 1 }));
96
+ // const User_UserName = Database().get('Ws_UserName');
97
+ // const User_PassWord = Database().get('Ws_PassWord');
98
+ // if (message.username != User_UserName || User_PassWord != message.password) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 2}));
99
+ // const Format = {
100
+ // Session_ID: generateRandomString(),
101
+ // TimeStamp: Date.now() + 24 * 60 * 60 * 1000
102
+ // };
103
+ // All_Session_ID.push(Format);
104
+ // Database().set("Session_ID", All_Session_ID);
105
+ // global.ws.client[req.socket.remoteAddress].Status = true;
106
+ // setTimeout(() => {
107
+ // global.ws.client[req.socket.remoteAddress].Status = false;
108
+ // }, (Date.now() + 24 * 60 * 60 * 1000) - Date.now());
109
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Session_ID: Format.Session_ID, TimeStamp: Format.TimeStamp }));
110
+ // }
111
+ // case "check": {
112
+ // if (!message.Session_ID || !message.TimeStamp) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 3}));
113
+ // const Format = {
114
+ // Session_ID: message.Session_ID,
115
+ // TimeStamp: message.TimeStamp
116
+ // };
117
+ // if (Format.TimeStamp <= Date.now()) {
118
+ // let index = All_Session_ID.findIndex(i => i.Session_ID == Format.Session_ID);
119
+ // All_Session_ID.splice(index,1);
120
+ // Database().set("Session_ID", All_Session_ID);
121
+ // Ws_Client.Status = false;
122
+ // Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 4}));
123
+ // return delete global.ws.client[Format.Session_ID];
124
+ // }
125
+ // if (All_Session_ID.some(i => i.Session_ID == message.Session_ID)) {
126
+ // global.ws.client[req.socket.remoteAddress].Status = true;
127
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success" }));
128
+ // }
129
+ // else {
130
+ // global.ws.client[req.socket.remoteAddress].Status = false;
131
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 5 }));
132
+ // }
133
+ // }
134
+ // case "resetPassword": {
135
+ // if (!message.Otp || !message.NewPassword) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 7 }));
136
+ // if (global.ws.client[req.socket.remoteAddress].ResetPassWordTime == 3) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 9 }));
137
+ // const speakeasy = require('speakeasy');
138
+ // const secret = Database().get('Ws_2Fa');
139
+ // if (message.Otp != speakeasy.totp({
140
+ // secret: secret,
141
+ // encoding: 'base32'
142
+ // })) {
143
+ // global.ws.client[req.socket.remoteAddress].ResetPassWordTime += 1;
144
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 8 }));
145
+ // }
146
+ // else {
147
+ // Database().set('Ws_PassWord', message.NewPassword);
148
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: 'Success' }));
149
+ // }
150
+ // }
151
+ // default: {
152
+ // if (Ws_Client.Status != true) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 6 }));
153
+ // switch (message.type) {
154
+ // case "Command": {
155
+ // if (message.Data == "Stop") {
156
+ // return process.exit(0);
157
+ // }
158
+ // else Eval(message.Data, {} ,true);
159
+ // }
160
+ // break;
161
+ // case "ChangeAppState": {
162
+ // try {
163
+ // const AppState = JSON.stringify(JSON.parse(message.Data), null ,2);
164
+ // require('fs').writeFileSync(process.cwd() + `/${global.Fca.Require.FastConfig.Websocket_Extension.AppState_Path}`, AppState, 'utf-8');
165
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: "ChangeAppState", Data: 0 }));
166
+ // }
167
+ // catch (e) {
168
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: "ChangeAppState", Data: e }));
169
+ // }
170
+ // }
171
+ // case "GetDocument": {
172
+
173
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Data: HowTo }));
174
+ // }
175
+ // case "getFastConfig": {
176
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Data: global.Fca.Require.FastConfig }));
177
+ // }
178
+ // case "ping": {
179
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Pong" }));
180
+ // }
181
+ // case "FastConfig_Change": {
182
+ // const FastConfig_Path = require(process.cwd() + "/FastConfigFca.json");
183
+ // const FastConfig_Global = global.Fca.Require.FastConfig;
184
+ // const SetConfig = function(Name, Value, Path, Main_Path) {
185
+ // try {
186
+ // if (Path && Main_Path) {
187
+ // FastConfig_Path[Main_Path][Name] = Value;
188
+ // (HowTo[Name]).includes('(Restart required)') == false ? global.Fca.Require.FastConfig = FastConfig_Path : '';
189
+ // }
190
+ // else {
191
+ // FastConfig_Path[Name] = Value;
192
+ // (HowTo[Name]).includes('(Restart required)') == false ? global.Fca.Require.FastConfig[Name] = Value : '';
193
+ // }
194
+ // global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(FastConfig_Path, null, "\t"));
195
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: `Success ${ (HowTo[Name]).includes('(Restart required)') == true ? 'RestartRequired' : ''}` }));
196
+ // }
197
+ // catch (e) {
198
+ // global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(FastConfig_Global, null, "\t"));
199
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: e}));
200
+ // }
201
+ // };
202
+ // return SetConfig(message.Data.Name, message.Data.Value, message.Data.Path, message.Data.Main_Path);
203
+ // }
204
+ // case "All_logs": {
205
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: "Console", Data: console.history.join(" <br> ")}));
206
+ // }
207
+ // }
208
+ // }
209
+ // }
210
+ // });
211
+ // });
212
+ // return { Client: global.ws.client, WSS: WebSocket };
213
+ // };