mirror of
https://git.alemi.dev/mumble-stats-api.git
synced 2024-11-12 19:59:19 +01:00
fix: improved widged example
This commit is contained in:
parent
a57afe0e3c
commit
0a0603a338
1 changed files with 5 additions and 10 deletions
|
@ -7,7 +7,7 @@
|
|||
<body>
|
||||
<div class="container">
|
||||
<h3 id="loading">loading...</h3>
|
||||
<p><table id="stats" class="w-100 align"></table></p>
|
||||
<p style="margin:0"><table id="stats" class="w-100 align"></table></p>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
|
@ -16,23 +16,18 @@ let loading = document.getElementById("loading");
|
|||
let stats = document.getElementById("stats");
|
||||
async function pingServer() {
|
||||
try {
|
||||
let res = await fetch("https://api.fantabos.co/mumble/ping")
|
||||
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>bandwidth</code> ${doc.bandwidth}</td>
|
||||
<td><code>net</code> ${doc.bandwidth/1000}kbps ~ ${doc.latency}ms</td>
|
||||
<td><code>version</code> ${doc.version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ping</code> ${doc.ping}</td>
|
||||
<td><code>roundtrip</code> ${doc.roundtrip}</td>
|
||||
<td><code>time</code> ${doc.time}</td>
|
||||
</tr>`;
|
||||
loading.remove();
|
||||
} catch (e) {
|
||||
loading.innerHTML = `error reaching api: ${e}`;
|
||||
stats.innerHTML = `<tr><td><b>error reaching api</b>: <code>${e}</code></td></tr>`;
|
||||
}
|
||||
loading.remove();
|
||||
}
|
||||
pingServer()
|
||||
setInterval(pingServer, 1000 * 60);
|
||||
|
|
Loading…
Reference in a new issue