-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
66 lines (50 loc) · 4.09 KB
/
index.js
File metadata and controls
66 lines (50 loc) · 4.09 KB
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
const colors = require("./Aesthetics/colors")
const pkgInfo = require("./package.json")
const fs = require("fs")
const { makeSession } = require("./Authentication/makeSession")
const { askQuestion } = require("./Aesthetics/getInput")
const { launch } = require("./Launch/launch")
const path = require("path")
function logo() {
console.log(colors.fgMagenta, `
░██████╗██████╗░███████╗░█████╗░████████╗██████╗░░█████╗░ ░█████╗░██╗░░░░░██╗
██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗ ██╔══██╗██║░░░░░██║
╚█████╗░██████╔╝█████╗░░██║░░╚═╝░░░██║░░░██████╔╝███████║ ██║░░╚═╝██║░░░░░██║
░╚═══██╗██╔═══╝░██╔══╝░░██║░░██╗░░░██║░░░██╔══██╗██╔══██║ ██║░░██╗██║░░░░░██║
██████╔╝██║░░░░░███████╗╚█████╔╝░░░██║░░░██║░░██║██║░░██║ ╚█████╔╝███████╗██║
╚═════╝░╚═╝░░░░░╚══════╝░╚════╝░░░░╚═╝░░░╚═╝░░╚═╝╚═╝░░╚═╝ ░╚════╝░╚══════╝╚═╝
`, colors.reset)
}
async function newComer() {
console.log("Welcome to Spectra CLI")
console.log(`${colors.bright} ${colors.bgBlack} Before we launch minecraft, Here's some things you must do ${colors.reset} \n`)
console.log(` > ${colors.underscore} Spectra Mainly uses ElyBy for its authentication. You can signup on https://ely.by/login ${colors.reset}`)
console.log(" > Spectra is 100% open source and I do not profit off of you.")
console.log(" > If you're a developer, Please consider contributing to Spectra! \n\n")
console.log("Please sign up for ElyBy, And answer the given parameters. ")
const username = await askQuestion("Username: ")
const password = await askQuestion("Password: ")
const version = await askQuestion("Version (s+{version} for snapshot): ")
console.log("---------------------------------------------------------------------------------------------- \n")
const details = await makeSession(username, password, version)
await launch(false, details)
}
async function init() {
// Aesthetics \\
logo()
console.log(colors.fgBrightBlue, `
╭───────────────────────────────────────────────────────────────────────────────╮
Spectra CLI v${pkgInfo.version}
╰───────────────────────────────────────────────────────────────────────────────╯
`, colors.reset)
if (fs.existsSync("./session.json")) {
console.log("---------------------------------------------------------------------------------------------- \n")
console.log(`${colors.bgBlack} [SESSION] ${colors.reset} Previous Session detected. Diverting direct to launch.`)
const info = JSON.parse(fs.readFileSync(path.join(__dirname, "session.json")))
const info2 = await makeSession(info.username, info.password, info.version)
await launch(false, info2)
} else {
newComer()
}
}
init()