fca-project-orion 1.1.3 → 1.1.5

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.
Files changed (108) hide show
  1. package/.gitattributes +2 -2
  2. package/Extra/Database/index.js +468 -468
  3. package/Extra/ExtraAddons.js +81 -81
  4. package/Extra/ExtraFindUID.js +61 -61
  5. package/Extra/ExtraGetThread.js +339 -339
  6. package/Extra/ExtraScreenShot.js +430 -430
  7. package/Extra/ExtraUptimeRobot.js +37 -37
  8. package/Extra/Html/Classic/script.js +118 -118
  9. package/Extra/Html/Classic/style.css +7 -7
  10. package/Extra/Security/Base/Step_1.js +5 -5
  11. package/Extra/Security/Base/Step_2.js +22 -22
  12. package/Extra/Security/Base/Step_3.js +22 -22
  13. package/Extra/Security/Base/index.js +172 -172
  14. package/Extra/Security/Index.js +4 -4
  15. package/Extra/Security/Step_1.js +5 -5
  16. package/Extra/Security/Step_2.js +22 -22
  17. package/Extra/Security/Step_3.js +22 -22
  18. package/Extra/Src/Change_Environment.js +23 -23
  19. package/Extra/Src/Check_Update.js +65 -65
  20. package/Extra/Src/History.js +114 -114
  21. package/Extra/Src/Instant_Update.js +64 -64
  22. package/Extra/Src/Last-Run.js +64 -64
  23. package/Extra/Src/Premium.js +80 -80
  24. package/Extra/Src/Release_Memory.js +40 -40
  25. package/Extra/Src/Websocket.js +212 -212
  26. package/Extra/Src/uuid.js +137 -137
  27. package/Func/AcceptAgreement.js +31 -31
  28. package/Func/ClearCache.js +64 -64
  29. package/Func/ReportV1.js +54 -54
  30. package/LICENSE +21 -21
  31. package/Language/index.json +216 -216
  32. package/Main.js +1215 -1215
  33. package/README.md +138 -138
  34. package/SECURITY.md +18 -18
  35. package/broadcast.js +39 -39
  36. package/index.js +385 -385
  37. package/logger.js +66 -66
  38. package/package.json +93 -93
  39. package/src/Dev_Horizon_Data.js +124 -124
  40. package/src/Premium.js +24 -24
  41. package/src/Screenshot.js +82 -82
  42. package/src/addExternalModule.js +16 -16
  43. package/src/addUserToGroup.js +79 -79
  44. package/src/changeAdminStatus.js +79 -79
  45. package/src/changeArchivedStatus.js +41 -41
  46. package/src/changeAvt.js +84 -84
  47. package/src/changeBio.js +65 -65
  48. package/src/changeBlockedStatus.js +36 -36
  49. package/src/changeGroupImage.js +106 -106
  50. package/src/changeNickname.js +45 -45
  51. package/src/changeThreadColor.js +62 -62
  52. package/src/changeThreadEmoji.js +42 -42
  53. package/src/createNewGroup.js +70 -70
  54. package/src/createPoll.js +60 -60
  55. package/src/deleteMessage.js +45 -45
  56. package/src/deleteThread.js +43 -43
  57. package/src/forwardAttachment.js +48 -48
  58. package/src/getAccessToken.js +27 -27
  59. package/src/getCurrentUserID.js +7 -7
  60. package/src/getEmojiUrl.js +27 -27
  61. package/src/getFriendsList.js +73 -73
  62. package/src/getMessage.js +79 -79
  63. package/src/getThreadHistory.js +537 -537
  64. package/src/getThreadInfo.js +424 -424
  65. package/src/getThreadList.js +213 -213
  66. package/src/getThreadMain.js +219 -219
  67. package/src/getThreadPictures.js +59 -59
  68. package/src/getUID.js +58 -58
  69. package/src/getUserID.js +62 -62
  70. package/src/getUserInfo.js +113 -113
  71. package/src/getUserInfoMain.js +64 -64
  72. package/src/getUserInfoV2.js +31 -31
  73. package/src/getUserInfoV3.js +62 -62
  74. package/src/getUserInfoV4.js +54 -54
  75. package/src/getUserInfoV5.js +60 -60
  76. package/src/handleFriendRequest.js +46 -46
  77. package/src/handleMessageRequest.js +49 -49
  78. package/src/httpGet.js +49 -49
  79. package/src/httpPost.js +48 -48
  80. package/src/httpPostFormData.js +40 -40
  81. package/src/listenMqtt.js +786 -786
  82. package/src/logout.js +68 -68
  83. package/src/markAsDelivered.js +48 -48
  84. package/src/markAsRead.js +70 -70
  85. package/src/markAsReadAll.js +42 -42
  86. package/src/markAsSeen.js +51 -51
  87. package/src/muteThread.js +47 -47
  88. package/src/removeUserFromGroup.js +49 -49
  89. package/src/resolvePhotoUrl.js +37 -37
  90. package/src/searchForThread.js +43 -43
  91. package/src/sendMessage.js +378 -378
  92. package/src/sendTypingIndicator.js +80 -80
  93. package/src/setMessageReaction.js +109 -109
  94. package/src/setPostReaction.js +101 -101
  95. package/src/setTitle.js +74 -74
  96. package/src/threadColors.js +38 -38
  97. package/src/unfriend.js +43 -43
  98. package/src/unsendMessage.js +40 -40
  99. package/test/Database_Test.js +3 -3
  100. package/test/Db2.js +529 -529
  101. package/test/data/shareAttach.js +146 -146
  102. package/test/data/test.txt +7 -7
  103. package/test/example-config.json +18 -18
  104. package/test/memoryleak.js +18 -18
  105. package/test/test-page.js +140 -140
  106. package/test/test.js +385 -385
  107. package/test/testv2.js +17 -17
  108. package/utils.js +1682 -1682
@@ -1,66 +1,66 @@
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
- const { body } = await got('https://raw.githubusercontent.com/ivancotacte/fca-project-orion/main/package.json');
8
- const json = JSON.parse(body);
9
- const LocalVersion = require('../../package.json').version;
10
- if (Number(LocalVersion.replace(/\./g,"")) < Number(json.version.replace(/\./g,"")) && global.Fca.Require.FastConfig.Stable_Version.Accept == false || Stable_Version && Number(LocalVersion.replace(/\./g,"")) != Number(Stable_Version.replace(/\./g,""))) {
11
- var Version = Stable_Version != undefined ? Stable_Version : json.version;
12
- log.warn("[ FCA-UPDATE ] •","New Version, Ready to Update: " + LocalVersion + " -> " + Version);
13
- await new Promise(resolve => setTimeout(resolve, 3000));
14
- try {
15
- execSync(`npm install fca-project-orion@${Version}`, { stdio: 'inherit' });
16
- log.info("[ FCA-UPDATE ] •","Update Complete, Restarting...");
17
- await new Promise(resolve => setTimeout(resolve, 3000));
18
- Database().set("Instant_Update", Date.now());
19
- await new Promise(resolve => setTimeout(resolve, 3000));
20
- process.exit(1);
21
- }
22
- catch (err) {
23
- try {
24
- console.log(err);
25
- log.warn("[ FCA-UPDATE ] •","Update Failed, Trying Another Method 1...");
26
- await new Promise(resolve => setTimeout(resolve, 3000));
27
- execSync(`npm install fca-project-orion@${Version} --force`, { stdio: 'inherit' });
28
- log.info("[ FCA-UPDATE ] •","Update Complete, Restarting...");
29
- await new Promise(resolve => setTimeout(resolve, 3000));
30
- Database().set("Instant_Update", Date.now());
31
- await new Promise(resolve => setTimeout(resolve, 3000));
32
- process.exit(1);
33
- }
34
- catch (err) {
35
- try {
36
- console.log(err);
37
- log.warn("[ FCA-UPDATE ] •","Update Failed, Trying to clean Database() cache...");
38
- await new Promise(resolve => setTimeout(resolve, 3000));
39
- execSync('npm cache clean --force', { stdio: 'inherit' });
40
- log.info("[ FCA-UPDATE ] •","Cache Cleaned, Trying Another Method 2...");
41
- await new Promise(resolve => setTimeout(resolve, 3000));
42
- //self delete fca-horizon-remastered folder from node_modules
43
- fs.rmdirSync((process.cwd() + "/node_modules/fca-project-orion" || __dirname + '../../../fca-project-orion'), { recursive: true });
44
- await new Promise(resolve => setTimeout(resolve, 3000));
45
- execSync(`npm install fca-project-orion@${Version}`, { stdio: 'inherit' });
46
- log.info("[ FCA-UPDATE ] •","Update Complete, Restarting...");
47
- await new Promise(resolve => setTimeout(resolve, 3000));
48
- Database().set("Instant_Update", Date.now(), true);
49
- await new Promise(resolve => setTimeout(resolve, 3000));
50
- process.exit(1);
51
- }
52
- catch (e) {
53
- console.log(e);
54
- log.error("[ FCA-UPDATE ] •","Update Failed, Please Update Manually");
55
- await new Promise(resolve => setTimeout(resolve, 3000));
56
- log.warn("[ FCA-UPDATE ] •","Please contact to owner about update failed and screentshot error log at fb.com/Lazic.Kanzu");
57
- await new Promise(resolve => setTimeout(resolve, 3000));
58
- process.exit(1);
59
- }
60
- }
61
- }
62
- }
63
- else {
64
- return Database().set("NeedRebuild", false, true);
65
- }
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
+ const { body } = await got('https://raw.githubusercontent.com/ivancotacte/fca-project-orion/main/package.json');
8
+ const json = JSON.parse(body);
9
+ const LocalVersion = require('../../package.json').version;
10
+ if (Number(LocalVersion.replace(/\./g,"")) < Number(json.version.replace(/\./g,"")) && global.Fca.Require.FastConfig.Stable_Version.Accept == false || Stable_Version && Number(LocalVersion.replace(/\./g,"")) != Number(Stable_Version.replace(/\./g,""))) {
11
+ var Version = Stable_Version != undefined ? Stable_Version : json.version;
12
+ log.warn("[ FCA-UPDATE ] •","New Version, Ready to Update: " + LocalVersion + " -> " + Version);
13
+ await new Promise(resolve => setTimeout(resolve, 3000));
14
+ try {
15
+ execSync(`npm install fca-project-orion@${Version}`, { stdio: 'inherit' });
16
+ log.info("[ FCA-UPDATE ] •","Update Complete, Restarting...");
17
+ await new Promise(resolve => setTimeout(resolve, 3000));
18
+ Database().set("Instant_Update", Date.now());
19
+ await new Promise(resolve => setTimeout(resolve, 3000));
20
+ process.exit(1);
21
+ }
22
+ catch (err) {
23
+ try {
24
+ console.log(err);
25
+ log.warn("[ FCA-UPDATE ] •","Update Failed, Trying Another Method 1...");
26
+ await new Promise(resolve => setTimeout(resolve, 3000));
27
+ execSync(`npm install fca-project-orion@${Version} --force`, { stdio: 'inherit' });
28
+ log.info("[ FCA-UPDATE ] •","Update Complete, Restarting...");
29
+ await new Promise(resolve => setTimeout(resolve, 3000));
30
+ Database().set("Instant_Update", Date.now());
31
+ await new Promise(resolve => setTimeout(resolve, 3000));
32
+ process.exit(1);
33
+ }
34
+ catch (err) {
35
+ try {
36
+ console.log(err);
37
+ log.warn("[ FCA-UPDATE ] •","Update Failed, Trying to clean Database() cache...");
38
+ await new Promise(resolve => setTimeout(resolve, 3000));
39
+ execSync('npm cache clean --force', { stdio: 'inherit' });
40
+ log.info("[ FCA-UPDATE ] •","Cache Cleaned, Trying Another Method 2...");
41
+ await new Promise(resolve => setTimeout(resolve, 3000));
42
+ //self delete fca-horizon-remastered folder from node_modules
43
+ fs.rmdirSync((process.cwd() + "/node_modules/fca-project-orion" || __dirname + '../../../fca-project-orion'), { recursive: true });
44
+ await new Promise(resolve => setTimeout(resolve, 3000));
45
+ execSync(`npm install fca-project-orion@${Version}`, { stdio: 'inherit' });
46
+ log.info("[ FCA-UPDATE ] •","Update Complete, Restarting...");
47
+ await new Promise(resolve => setTimeout(resolve, 3000));
48
+ Database().set("Instant_Update", Date.now(), true);
49
+ await new Promise(resolve => setTimeout(resolve, 3000));
50
+ process.exit(1);
51
+ }
52
+ catch (e) {
53
+ console.log(e);
54
+ log.error("[ FCA-UPDATE ] •","Update Failed, Please Update Manually");
55
+ await new Promise(resolve => setTimeout(resolve, 3000));
56
+ log.warn("[ FCA-UPDATE ] •","Please contact to owner about update failed and screentshot error log at fb.com/Lazic.Kanzu");
57
+ await new Promise(resolve => setTimeout(resolve, 3000));
58
+ process.exit(1);
59
+ }
60
+ }
61
+ }
62
+ }
63
+ else {
64
+ return Database().set("NeedRebuild", false, true);
65
+ }
66
66
  }
@@ -1,115 +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
- })
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
115
  }
@@ -1,65 +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/Fca-Horizon-Remastered/main/package.json
8
- const { body } = await got('https://raw.githubusercontent.com/ivancotacte/Global_fca-project-orion/main/InstantAction.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("[ FCA-UPDATE ] •","Found a command that requires downloading an important Version to avoid errors, update onions: " + LocalVersion + " -> " + json.Version);
13
- log.warn("[ FCA-UPDATE ] •","Problem Description: " + json.Problem);
14
- await new Promise(resolve => setTimeout(resolve, 3000));
15
- try {
16
- execSync(`npm install fca-project-orion@${json.Version}`, { stdio: 'inherit' });
17
- log.info("[ FCA-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("[ FCA-UPDATE ] •","Update Failed, Trying Another Method 1...");
26
- await new Promise(resolve => setTimeout(resolve, 3000));
27
- execSync(`npm install fca-project-orion@${json.Version} --force`, { stdio: 'inherit' });
28
- log.info("[ FCA-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("[ FCA-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("[ FCA-UPDATE ] •","Cache Cleaned, Trying Another Method 2...");
40
- await new Promise(resolve => setTimeout(resolve, 3000));
41
- //self delete fca-project-orion folder from node_modules
42
- fs.rmdirSync((process.cwd() + "/node_modules/fca-project-orion" || __dirname + '../../../fca-project-orion'), { recursive: true });
43
- await new Promise(resolve => setTimeout(resolve, 3000));
44
- execSync(`npm install fca-project-orion@${json.Version}`, { stdio: 'inherit' });
45
- log.info("[ FCA-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("[ FCA-UPDATE ] •","Update Failed, Please Update Manually");
54
- await new Promise(resolve => setTimeout(resolve, 3000));
55
- log.warn("[ FCA-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
- }
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/Fca-Horizon-Remastered/main/package.json
8
+ const { body } = await got('https://raw.githubusercontent.com/ivancotacte/Global_fca-project-orion/main/InstantAction.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("[ FCA-UPDATE ] •","Found a command that requires downloading an important Version to avoid errors, update onions: " + LocalVersion + " -> " + json.Version);
13
+ log.warn("[ FCA-UPDATE ] •","Problem Description: " + json.Problem);
14
+ await new Promise(resolve => setTimeout(resolve, 3000));
15
+ try {
16
+ execSync(`npm install fca-project-orion@${json.Version}`, { stdio: 'inherit' });
17
+ log.info("[ FCA-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("[ FCA-UPDATE ] •","Update Failed, Trying Another Method 1...");
26
+ await new Promise(resolve => setTimeout(resolve, 3000));
27
+ execSync(`npm install fca-project-orion@${json.Version} --force`, { stdio: 'inherit' });
28
+ log.info("[ FCA-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("[ FCA-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("[ FCA-UPDATE ] •","Cache Cleaned, Trying Another Method 2...");
40
+ await new Promise(resolve => setTimeout(resolve, 3000));
41
+ //self delete fca-project-orion folder from node_modules
42
+ fs.rmdirSync((process.cwd() + "/node_modules/fca-project-orion" || __dirname + '../../../fca-project-orion'), { recursive: true });
43
+ await new Promise(resolve => setTimeout(resolve, 3000));
44
+ execSync(`npm install fca-project-orion@${json.Version}`, { stdio: 'inherit' });
45
+ log.info("[ FCA-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("[ FCA-UPDATE ] •","Update Failed, Please Update Manually");
54
+ await new Promise(resolve => setTimeout(resolve, 3000));
55
+ log.warn("[ FCA-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
65
  }
@@ -1,65 +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
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
65
  };