-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
99 lines (95 loc) · 3.03 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const inquirer = require("inquirer");
const chalk = require("chalk");
const Conf = require("conf");
const config = new Conf("stasis-cli");
const discordRpc = require(`./services/discordRpc.js`);
const { launchTLS } = require(`./managers/tls/tls.js`);
const { version } = require("./package.json");
const { defaultConfig, logLogo } = require(`./managers/utils.js`);
const { handleTasksManager } = require(`./managers/task/tasks.js`);
const { handleRpcManager } = require(`./managers/rpc/rpc.js`);
const { handleWalletManager } = require(`./managers/wallet/wallets.js`);
const { handleSettingsManager } = require(`./managers/settings/settings.js`);
const { handleToolBox } = require(`./managers/toolbox/tools.js`);
const { handleProxyManager } = require(`./managers/proxies/proxies.js`);
const log = (message, type) => {
switch (type) {
case "error":
console.log(chalk.red(message));
break;
case "success":
console.log(chalk.green(message));
break;
case "warn":
console.log(chalk.yellow(message));
break;
case "info":
console.log(chalk.blueBright(message));
break;
}
};
const run = async () => {
await launchTLS();
process.title = `Stasis AIO - Version: ${global.version} - Total Tasks: ${global.savedConfig.tasks.length} - Bypass: ${global.tlsPort}`;
logLogo();
console.log("");
let answer = await inquirer.prompt([
{
type: "list",
name: "action",
message: "What would you like to do:",
choices: [
`Tasks`,
"Proxies",
"Wallets",
"RPC",
"Toolbox",
"Settings",
"Force Refresh Configuration",
"Exit CLI",
],
},
]);
if (answer.action === "Exit CLI") {
log("👋 Exiting Stasis AIO...", "error");
process.exit();
} else {
if (answer.action === "Tasks") {
await handleTasksManager();
} else if (answer.action === "Wallets") {
await handleWalletManager();
} else if (answer.action === "Force Refresh Configuration") {
log("🕒 Refreshing Configuration...", "info");
global.savedConfig = config.get("stasis-cli");
log("🟢 Configuration refreshed!", "success");
await sleep(1500);
run();
} else if (answer.action === "RPC") {
await handleRpcManager();
} else if (answer.action === "Settings") {
await handleSettingsManager();
} else if (answer.action === "Toolbox") {
await handleToolBox();
} else if (answer.action === "Proxies") {
await handleProxyManager();
}
}
};
const main = async () => {
global.version = version;
global.savedConfig = config.get("stasis-cli");
global.apiURL = "";
global.tasks = [];
global.logThis = log;
global.runMain = run;
global.sleep = (ms) => new Promise((r) => setTimeout(r, ms));
if (!global.savedConfig) {
config.set("stasis-cli", defaultConfig);
global.savedConfig = config.get("stasis-cli");
}
log(`🔵 Verifying system...`, "info");
new discordRpc().launchRPC();
log("🟢 System verified, welcome back!", "success");
run();
};
main();