-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (98 loc) · 3.95 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
<!DOCTYPE html>
<html>
<head>
<title>AoS Server Status Demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="server_status.js"></script>
<style>
.noselect {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}
.online {
color: lightgreen;
}
.offline {
color: red;
}
html {
background-color: darkgray;
}
#nav {
text-align:center;
color: lightgray;
}
#nav a {
color: white;
}
#server_info {
text-align: center;
}
#server_info b {
display: block;
}
#join-button {
cursor: pointer;
}
#status-banner {
text-align: center;
}
#footer {
color: lightgray;
text-align: center;
}
#footer a {
color: white;
}
#header {
cursor: pointer;
}
</style>
</head>
<body>
<div id="nav">
<h2 id="header" class="noselect">AoS Server Status</h2>
<a href="/documentation">Docs</a> <a href="https://github.com/mrparkerlol/aos-server-status" target="_blank">Github</a>
</div>
<div id="content">
<h2 id="status-banner" class="noselect">Server Status</h2>
<div id="server_info" class="noselect">
<b>Server: <span id="server_name"></span></b>
<b>Players: <span id="server_players_current"></span>/<span id="server_players_max"></span></b>
<b>Map: <span id="server_map"></span></b>
<b>Ping: <span id="server_ping"></span></b>
<b>Mode: <span id="server_mode"></span></b>
<b>Country: <span id="server_country"></span></b>
<p id="join-link"><img src="" id="join-button" /></p>
</div>
</div>
<div id="footer" class="noselect">
<p>Made by <a href="https://github.com/mrparkerlol">Jacob</a>, project source is <a href="https://github.com/mrparkerlol/aos-server-status">here</a></p>
</div>
<script>
(async () => {
document.getElementById("header").addEventListener("click", () => {
window.location.href = "/"
})
let data = await aos_server_status("aos://1124169524:34887:0.75") // aos://2791176354:43887:0.75
if (data) {
document.getElementById("server_name").innerText = data.name
document.getElementById("server_players_current").innerText = data.players_current
document.getElementById("server_players_max").innerText = data.players_max
document.getElementById("server_map").innerText = data.map
document.getElementById("server_ping").innerText = data.latency
document.getElementById("server_mode").innerText = data.game_mode
document.getElementById("server_country").innerText = data.country
document.getElementById("join-link").addEventListener("click", () => {
window.location.href = `${data.identifier}:${data.game_version}`
})
document.getElementById("join-button").setAttribute("src", "https://i.imgur.com/3GinYaH.png")
} else {
document.getElementById("server_info").innerHTML = `<p class="offline">Server is offline!</span>`
}
})()
</script>
</body>
</html>