mirror of
https://git.alemi.dev/mumble-stats-api.git
synced 2024-11-22 16:04:49 +01:00
36 lines
1,021 B
HTML
36 lines
1,021 B
HTML
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="https://cdn.alemi.dev/web/alemi.css">
|
|
<title>mumble stats</title>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h3 id="loading">loading...</h3>
|
|
<p style="margin:0"><table id="stats" class="w-100 align"></table></p>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
|
|
let loading = document.getElementById("loading");
|
|
let stats = document.getElementById("stats");
|
|
async function pingServer() {
|
|
try {
|
|
let res = await fetch("https://api.alemi.dev/mumble/ping?host=<<YOUR_SERVER_HERE>>")
|
|
let doc = await res.json()
|
|
stats.innerHTML = `
|
|
<tr>
|
|
<td><code>users</code> ${doc.users}/${doc.max_users}</td>
|
|
<td><code>net</code> ${doc.bandwidth/1000}kbps ~ ${doc.latency}ms</td>
|
|
<td><code>version</code> ${doc.version}</td>
|
|
</tr>`;
|
|
} catch (e) {
|
|
stats.innerHTML = `<tr><td><b>error reaching api</b>: <code>${e}</code></td></tr>`;
|
|
}
|
|
loading.remove();
|
|
}
|
|
pingServer()
|
|
setInterval(pingServer, 1000 * 60);
|
|
|
|
</script>
|
|
</html>
|