Update for Minecraft

Using template from the PHP version of this site, from 2016/2017!

$ ls -Alh
-rw-r--r-- 1 chandler chandler 1.5K Jan  4  2017 index.php
This commit is contained in:
Chandler Swift 2023-09-29 19:59:46 -05:00
parent 8dd1b7b58d
commit f17074d22d
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
7 changed files with 93 additions and 110 deletions

View file

@ -1,49 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{.Title}}</title>
<style>
html {
font-family: sans-serif;
padding: 10px;
}
/* https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3 */
.light {
color: #888;
}
.light a {
color: #88f;
}
.light a:hover {
color: #00e;
}
.light a:visited {
color: #a9b;
}
.light a:visited:hover {
color: #518;
}
:not(:hover) .optional-port {
color: #ccc;
}
</style>
</head>
<body>
<h1>{{.Title}}</h1>
<p>{{.Content}}</p>
<p>Backups are taken and archived periodically, and made available in the <a href="/backups">backup archive</a>.</p>
{{range .Servers}}
<h3>{{.Title}}</h3>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>ChandlerSwift.com Minecraft</title>
<style>
body{margin:1em auto;max-width:40em;padding:0 .62em;font:1.2em sans-serif; line-height: 1.62em;}h1,h2,h3{line-height:1.2em;}@media print{body{max-width:none}}
/* https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3 */
.light {
color: #888;
}
.light a {
color: #88f;
}
.light a:hover {
color: #00e;
}
.light a:visited {
color: #a9b;
}
.light a:visited:hover {
color: #518;
}
:not(:hover) .optional-port {
color: #666;
}
</style>
<link rel="shortcut icon" href="https://chandlerswift.com/favicon.ico" />
</head>
<body>
<header>
<h1>{{.Title}}</h1>
<p>{{.Content}}</p>
</header>
{{range .Servers}}
<section>
<h2 style="margin-bottom: 0;"><code>{{.Host}}{{if eq .Port 25565}}<span class="optional-port">:{{.Port}}</span>{{else}}:{{.Port}}{{end}}</code></h2>
{{if .Status}}
<span style="color: #666; font-style: italic;">{{.Status.Description.String}}</span>
<ul>
<li>Minecraft Version: {{.Status.VersionName}}</li>
<li>Players Online: {{.Status.OnlinePlayers}}/{{.Status.MaxPlayers}}
{{if gt .Status.OnlinePlayers 0}}
<ul>
<li><b>Description:</b> {{.Description}}</li>
<li><b>Connection String:</b> {{.Host}}{{if eq .Port 34197}}<span class="optional-port">:{{.Port}}</span>{{else}}:{{.Port}}{{end}}</li>
{{if ne .RCONHost ""}}
<li><b>Version:</b> {{.Version}}</li>
<li><b>Current players:</b><br>{{.Players}}</li>
{{range $i, $player := .Status.SamplePlayers}}
<li>{{$player.Nickname}}</li>
{{end}}
</ul>
{{end}}
<p class="light">This page maintained by chandlerswift's <a href="https://github.com/chandlerswift/factorio-site">factorio server list</a>.</p>
</body>
{{end}}
</li>
</ul>
{{else}}
<span style="color: #666;">Unable to connect to server to check status</span>
{{end}}
</section>
{{end}}
<p class="light">This page maintained by chandlerswift's <a href="https://git.chandlerswift.com/chandlerswift/minecraft-site">minecraft server list</a>.</p>
</body>
</html>