101 lines
2.9 KiB
HTML
101 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>zekro's Minecraft Server</title>
|
|
<style>
|
|
body {
|
|
background-color: #212121;
|
|
color: #eceff1;
|
|
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
|
|
"Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
|
padding: 0;
|
|
margin: 0;
|
|
|
|
* > {
|
|
box-sizing: border-box;
|
|
}
|
|
}
|
|
|
|
.bg {
|
|
display: flex;
|
|
position: fixed;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
|
|
> img {
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 0;
|
|
height: 30%;
|
|
}
|
|
}
|
|
|
|
.content {
|
|
margin: 1em 2em;
|
|
max-width: 70em;
|
|
}
|
|
|
|
#body {
|
|
margin-top: 1em;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="bg">
|
|
<div class="content">
|
|
<h1 id="title"></h1>
|
|
<span id="message"></span>
|
|
<div id="body"></div>
|
|
</div>
|
|
<img src="/pepecry.png" />
|
|
</div>
|
|
|
|
<script>
|
|
const ADDRESS = "mc.zekro.de";
|
|
|
|
const title = document.querySelector("#title");
|
|
const message = document.querySelector("#message");
|
|
const body = document.querySelector("#body");
|
|
|
|
window
|
|
.fetch(`https://mcstatus.zekro.de/server?host=${ADDRESS}`, {
|
|
headers: { accept: "application/json" },
|
|
})
|
|
.then(checkAndParse)
|
|
.then((res) => {
|
|
title.innerText = "Pl3xMap is currently down.";
|
|
message.innerText =
|
|
"We are sorry to inform you that DynMap is currently down, but heads up, the server is still online! Here you can see which players are currently online.";
|
|
|
|
const playerCount = document.createElement("span");
|
|
playerCount.innerText = `${res.players.online} / ${res.players.max}`;
|
|
body.appendChild(playerCount);
|
|
|
|
if (res.players.sample) {
|
|
const playerList = document.createElement("ul");
|
|
|
|
for (const player of res.players.sample) {
|
|
const playerEntry = document.createElement("li");
|
|
playerEntry.innerText = player.name;
|
|
playerList.appendChild(playerEntry);
|
|
}
|
|
|
|
body.appendChild(playerList);
|
|
}
|
|
})
|
|
.catch(() => {
|
|
title.innerText = "⚠️ The server is currently down.";
|
|
message.innerText =
|
|
"We are sorry to inform you that the Minecraft server is currently down. This can be because of a scheduled restart or maintenance works. If this persists, please do not hesitate to contact zekro (@zekrotja) on Discord.";
|
|
});
|
|
|
|
function checkAndParse(res) {
|
|
if (res.status != 200) {
|
|
throw Error(`request failed with status ${res.status}: ${res.text}`);
|
|
}
|
|
return res.json();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|