Add initial support for multiple servers

This commit is contained in:
Chandler Swift 2020-03-29 21:29:00 -05:00
parent 11f0b09725
commit 2d0e07b59f
2 changed files with 13 additions and 8 deletions

View file

@ -61,12 +61,13 @@ func main() {
return return
} }
data := serverData{ data := []serverData{}
data = append(data, serverData{
*serverAddr, *serverAddr,
34197, 34197,
"Server with Bob's Mod, est. Feb 2020", "Server with Bob's Mod, est. Feb 2020",
playersOnline, playersOnline,
} })
t.Execute(w, data) t.Execute(w, data)
}) })

View file

@ -10,11 +10,15 @@
</style> </style>
</head> </head>
<body> <body>
<h1>blackolivepineapple.pizza Factorio Server</h1> <h1>blackolivepineapple.pizza Factorio Servers</h1>
<ul> {{range .}}
<li><b>Connection String:</b> {{.IPAddr}}{{if ne .Port 34197}}:{{.Port}}{{end}}</li> <h3>{{.Title}}</h3>
<li><b>Server Name:</b> {{.Title}}</li> <ul>
<li><b>Current players:</b><br>{{.Players}}</li> <li><b>Connection String:</b> {{.IPAddr}}{{if ne .Port 34197}}:{{.Port}}{{end}}</li>
</ul> <li><b>Version:</b> {{.Version}}</li>
<li><b>Server Name:</b> {{.Title}}</li>
<li><b>Current players:</b><br>{{.Players}}</li>
</ul>
{{end}}
</body> </body>
</html> </html>