-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
72 lines (71 loc) · 2.47 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
<!DOCTYPE html>
<html>
<head>
<title>Cheese Bot</title>
<link rel="stylesheet" type="text/css" href="src/css/index.css">
<script src="src/scripts/savedata.js"></script>
</head>
<body>
<center>
<img src="src/images/header.png">
<form onsubmit="saveToFile()" action="console.html">
<h3>Server Address</h3>
<input type="text" class="matField" id="ip" placeholder="127.0.0.1" required><br>
<small>This may be left blank for local host.</small><br>
<h3>Server Port</h3>
<input type="text" class="matField" id="port" placeholder="25565"><br>
<small>This may be left blank for the default port.</small><br>
<h3>Username/Email</h3>
<input type="text" class="matField" id="username" placeholder="Notch" required><br>
<small>Use an email if the account is migrated.</small><br>
<h3>Password</h3>
<input type="password" class="matField" id="password" placeholder="abc123"><br>
<small>This may be left blanked for cracked/offline servers.</small><br><br>
<input type="checkbox" onclick="doSave()" id="save">Remember Me<br><br><br>
<input type="submit" class="buttonMaterial" value="Start Bot">
<button type="button" class="buttonMaterial" onclick="gotoPlugins()">Plugins</button>
<button type="button" class="buttonMaterial" onclick="gotoWebsite()">Website</button>
</form>
</center>
<script src="src/scripts/loaddata.js"></script>
<script>
var gui = require('nw.gui');
var win = gui.Window.get();
function gotoWebsite() {
gui.Shell.openExternal("http://bot.minecheesecraft.com");
}
function gotoPlugins() {
saveToFile()
window.location.replace("plugins.html");
}
win.on('close', function () {
//win.hide()
if (fs.existsSync("./src/userdata/" + window.name)) {
fs.unlink("./src/userdata/" + window.name)
}
win.close(true);
});
function doSave() {
if (document.getElementById('save').checked) {
var ip_element = document.getElementById("ip").value
var port_element = document.getElementById("port").value
var name_element = document.getElementById("username").value
var pass_element = document.getElementById("password").value
savestring = name_element + "|" + pass_element + "|" + ip_element + "|" + port_element + "|" + "1"
fs.writeFile("./src/userdata/settings.txt", savestring, function(err) {
if(err) {
return console.log(err);
}
});
} else {
savestring = "||||" + "0"
fs.writeFile("./src/userdata/settings.txt", savestring, function(err) {
if(err) {
return console.log(err);
}
});
}
}
</script>
</body>
</html>