/
index.html
219 lines (197 loc) · 9.36 KB
/
index.html
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<html>
<head>
<title>Solar Client</title>
<author>AaronSick</author>
<link rel="stylesheet" href="index.css" />
<meta http-Equiv="Cache-Control" Content="no-cache" />
<meta http-Equiv="Pragma" Content="no-cache" />
<meta http-Equiv="Expires" Content="0" />
</head>
<body>
<div id="main">
<div class="form-popup" id="accountPopup">
<div class="header">
<button id="close-popup" onclick="accountPopup()">x</button>
</div>
<div class="form-container">
<img src="pfp.png" id="pfp" draggable="false"></img>
<h2 id="accountName"></h2>
<button id="switchAccount" onclick="switchAccount()"><p>Switch Account</p></button>
</div>
</div>
<div class="form-popup" id="switchAccountPopup">
<div class="header">
<button id="close-popup" onclick="resetAccountPopup()">←</button>
</div>
<div class="form-container">
<h2 class="select-account">Select Account</h2>
<div class="accounts" id="accountSelect">
<div class="account-select"><button id="addAccount" onclick="loginPopup()">+ Add Account</button> </div>
</div>
</div>
</div>
<div class="form-popup" id="loginPopup">
<div class="header">
<button id="close-popup" onclick="resetAccountPopup()">←</button>
</div>
<div class="form-container">
<label for="email">Email</label>
<input id="email" type="text" placeholder="Enter Email" name="email" required>
<label for="psw">Password</label>
<input id="password" type="password" placeholder="Enter Password" name="psw" required>
<button type="submit" class="btn" onclick="login()">Login</button>
</div>
</div>
<div class="form-popup" id="settingsPopup">
<div class="header">
<button id="close-popup" onclick="settingsPopup()">x</button>
</div>
<div class="form-container">
<h2>Ram</h2>
<p id="minRam">1</p>
<input type="range" min="1" max="1" value="1" class="slider" id="ram" onchange="setRam(this.value)">
<p id="maxRam">1</p>
</div>
</div>
<div id="title-bar">
<div id="title-bar-btns">
<button id="login-btn" onclick="resetAccountPopup()">ACCOUNT</button>
<button id="settings-btn" onclick="resetSettingsPopup()">SETTINGS</button>
<button id="min-btn">–</button>
<button id="close-btn">x</button>
</div>
</div>
<div id="content">
<div id="logo">
<img id="logo-img" src="Nova.png" draggable="false" onclick="clicked()">
</div>
</div>
<div id="news">
<img src="loading.gif" width="50px">
<iframe id="inlineFrameExample"
src="http://192.95.58.242/launchernews.html">
</iframe>
</div>
<div id="footer">
<p id="left">Solar Client ©</p>
<p id="right">Not Affliated With Mojang AB</p>
</div>
<div id="launch">
<div id="launch-btn"onclick="launch()">
<img src="launch.png" draggable="false">
<p id="launch-txt">LAUNCH</p>
<img id="loading" src="loading.gif" draggable="false">
</div>
</div>
</div>
<script src="html.js"></script>
<script src="index.js"></script>
<script>
var opn = require('opn');
var si = require('systeminformation');
function clicked() {
opn('https://discord.gg/fmNHYQ5');
}
function accountPopup() {
if (document.getElementById("accountPopup").style.display == "block") {
//Close
document.getElementById("accountPopup").style.display = "none";
} else {
//Open
document.getElementById("accountPopup").style.display = "block";
}
}
function settingsPopup() {
if (document.getElementById("settingsPopup").style.display == "block") {
//Close
document.getElementById("settingsPopup").style.display = "none";
} else {
//Open
document.getElementById("settingsPopup").style.display = "block";
}
}
function switchAccount() {
//Close Account Menu
document.getElementById("accountPopup").style.display = "none";
//Open Switch Account Menu
document.getElementById("switchAccountPopup").style.display = "block";
}
function loginPopup() {
//Close Switch Account Menu
document.getElementById("switchAccountPopup").style.display = "none";
//Open Login Menu
document.getElementById("loginPopup").style.display = "block";
}
function resetAccountPopup() {
//Close Switch Account / Login Menu
document.getElementById("switchAccountPopup").style.display = "none";
document.getElementById("loginPopup").style.display = "none";
//Open Account Menu
document.getElementById("accountPopup").style.display = "block";
}
function resetSettingsPopup() {
document.getElementById("settingsPopup").style.display = "block";
}
function setRam(amount) {
amount = parseInt(amount);
fs.readFile('./info.json', 'utf8', (err, jsonString) => {
const config = JSON.parse(jsonString);
config.ram = amount;
fs.writeFileSync('./info.json', JSON.stringify(config, null, 2));
});
}
si.mem((mem) => {
const ram = Math.floor((mem.total / 1000000000));
document.getElementById("ram").max = ram;
document.getElementById("maxRam").innerText = (ram).toString();
fs.readFile('./info.json', 'utf8', (err, jsonString) => {
const config = JSON.parse(jsonString);
document.getElementById("ram").value = config.ram.toString();
});
})
fs.readFile('./info.json', 'utf8', (err, jsonString) => {
if (err) {
console.log("File read failed:", err)
return
}
const config = JSON.parse(jsonString);
const selected = config.selected;
if (selected == "") {
} else {
document.getElementById("pfp").src = "https://visage.surgeplay.com/face/" + selected;
document.getElementById("accountName").innerText = config.accounts [selected].displayName;
const accountSelect = document.getElementById("accountSelect");
}
var accounts = Object.entries(config.accounts);
for (var i = 0; i < accounts.length; i++) {
var accountData = accounts[i];
var account = document.createElement("div");
account.className = "account-select";
account.id = accountData[0];
account.addEventListener("click", (e) => selectAccount(event));
var accountButton = document.createElement("button");
var accountJson = config.accounts [accountData[0]];
accountButton.innerText = accountJson.displayName;
account.appendChild(accountButton);
accountSelect.appendChild(account);
}
})
function selectAccount(e) {
var uuid = e.path[1].id;
if (uuid == "accountSelect") {
uuid = e.path[0].id;
}
console.log(e);
fs.readFile('./info.json', 'utf8', (err, jsonString) => {
const config = JSON.parse(jsonString);
config.selected = uuid;
const selected = config.selected;
document.getElementById("pfp").src = "https://visage.surgeplay.com/face/" + selected;
document.getElementById("accountName").innerText = config.accounts [selected].displayName;
resetAccountPopup();
fs.writeFileSync('./info.json', JSON.stringify(config, null, 2));
});
}
</script>
</body>
</html>