Move minecraft server status page to a more generic URL and change contents to be less-specific to a single server

This is in preparation for showing the status page for multiple servers
This commit is contained in:
Daniel Flanagan 2023-11-03 20:19:28 -05:00
parent 2e332e20ea
commit ef6e306cb3
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4

View file

@ -1,24 +1,26 @@
--- ---
title: Ourcraft Server Status Checker title: Minecraft Server Status Checker
toc: false toc: false
aliases:
/ourcraft-status
--- ---
<p id="server-status-loading"> <p id="server-status-loading">
Checking <code>ourcraft.lyte.dev</code> server status... Checking minecraft servers' status...
</p> </p>
<div id="server-status-check-failed"> <div id="server-status-check-failed">
<p> <p>
Failed to retrieve <code>ourcraft.lyte.dev</code> server status. Unfortunately, that usually means we're <code><span style="color: var(--syntax-mag);">OFFLINE</span></code>. Failed to retrieve <code>h.lyte.dev</code> server status. Unfortunately, that usually means we're <code><span style="color: var(--syntax-mag);">OFFLINE</span></code>.
</p> </p>
<p> <p>
Please yell at <code>@lytedev</code> in the Ourcraft Discord to fix it! Please yell at <code>@lytedev</code> in Discord to fix it!
</p> </p>
<p><button id="server-status-check-button">Try Again</button></p> <p><button id="server-status-check-button">Try Again</button></p>
</div> </div>
<div id="server-status-online" style="display: none;"> <div id="server-status-online" style="display: none;">
<p>Server <code>ourcraft.lyte.dev</code> is <code><span style="color: var(--syntax-name);">ONLINE</span></code></p> <p>Server <code>h.lyte.dev</code> is <code><span style="color: var(--syntax-name);">ONLINE</span></code></p>
<p id="server-status-player-info" style="display: none;">There are currently <span id="server-status-current-num-players">0</span>/<span id="server-status-max-players">20</span> players online.</p> <p id="server-status-player-info" style="display: none;">There are currently <span id="server-status-current-num-players">0</span>/<span id="server-status-max-players">20</span> players online.</p>
<h3 id="server-status-player-sampling-header" style="display: none;">Online Players</h3> <h3 id="server-status-player-sampling-header" style="display: none;">Online Players</h3>
<ul id="server-status-player-sampling" style="display: none;"> <ul id="server-status-player-sampling" style="display: none;">
@ -44,7 +46,7 @@ function showServerStatus(key) {
} }
function checkServerStatus() { function checkServerStatus() {
showServerStatus('server-status-loading') showServerStatus('server-status-loading')
MinecraftAPI.getServerStatus('ourcraft.lyte.dev', {port: 25565}, function (err, status) { MinecraftAPI.getServerStatus('h.lyte.dev', {port: 25565}, function (err, status) {
console.debug("Status Errors:", err || false) console.debug("Status Errors:", err || false)
if (err || !('online' in status)) { if (err || !('online' in status)) {
showServerStatus('server-status-check-failed') showServerStatus('server-status-check-failed')