remove servers which don't reply
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Philipp 2021-10-04 16:23:27 +02:00
parent 28c830acfc
commit c36e6b1947
5 changed files with 32 additions and 12 deletions

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,15 +1,15 @@
{{define "title"}} {{define "title" -}}
<title>Serverlist :: {{.Region}}</title> <title>Serverlist :: {{.Region}}</title>
{{end}} {{- end}}
{{define "content"}} {{define "content" -}}
{{ $gamemodes := .Gamemodes}} {{ $gamemodes := .Gamemodes}}
{{ $servers := .Servers}} {{ $servers := .Servers}}
{{ $flags := .Flags}} {{ $flags := .Flags}}
<div class="container mx-auto px-4 sm:px-8"> <div class="container mx-auto px-4 sm:px-8">
<div class="py-8"> <div class="py-8">
<div> <div>
<h2 class="text-2xl font-semibold leading-tight">{{.Region}}</h2> <h2 class="text-2xl font-semibold leading-tight text-white">{{.Region}}</h2>
</div> </div>
{{range $gamemode := $gamemodes -}} {{range $gamemode := $gamemodes -}}
<div class="-mx-4 sm:-mx-8 px-4 sm:px-8 py-4 overflow-x-auto"> <div class="-mx-4 sm:-mx-8 px-4 sm:px-8 py-4 overflow-x-auto">
@ -35,6 +35,7 @@
<tbody> <tbody>
{{range $server := $servers -}} {{range $server := $servers -}}
{{if eq $gamemode.ID $server.GamemodeID -}} {{if eq $gamemode.ID $server.GamemodeID -}}
{{if ne $server.Map "Server didn't reply." -}}
<tr id="content"> <tr id="content">
<td class="px-5 border-b border-gray-200 bg-white" id="flag"> <td class="px-5 border-b border-gray-200 bg-white" id="flag">
{{range $flag := $flags -}} {{range $flag := $flags -}}
@ -58,6 +59,7 @@
</td> </td>
</tr> </tr>
{{- end}} {{- end}}
{{- end}}
{{- end}} {{- end}}
</tbody> </tbody>
</table> </table>
@ -67,4 +69,4 @@
</div> </div>
</div> </div>
</section> </section>
{{end}} {{- end}}

View File

@ -1,10 +1,21 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><head> <html class="bg-gray-800" lang="en"><head>
{{block "title" .}}{{end}} {{block "title" . -}}{{- end}}
<meta http-equiv="content-Type" content="text/html; utf-8" />
<meta http-equiv="Pragma" content="no-cache" />
<meta name="robots" content="INDEX,FOLLOW" />
<meta http-equiv="content-Language" content="en" />
<meta name="description" content="Serverlist for competitive Team Fortress 2 players" />
<meta name="keywords" content="tf2, tf, serverlist, team, fortress, 2" />
<meta name="page-type" content="Game" />
<meta name="page-topic" content="Team Fortress 2" />
<meta http-equiv="Reply-to" content="" />
<meta name="expires" content="" />
<meta name="revisit-after" content="2 days" />
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="https://spenny.tf/favicon.ico"/> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/>
<link href="https://unpkg.com/tailwindcss@1.0.4/dist/tailwind.min.css" rel="stylesheet"> <link href="https://unpkg.com/tailwindcss@1.0.4/dist/tailwind.min.css" rel="stylesheet">
<script async defer data-website-id="084ca01d-5337-4f12-8932-3033addbc175" src="https://a.v0v.de/t.js"></script> <script async defer data-website-id="084ca01d-5337-4f12-8932-3033addbc175" src="https://a.v0v.de/t.js"></script>
<script defer data-domain="serverlist.tf" src="https://t.v0v.de/js/t.js"></script> <script defer data-domain="serverlist.tf" src="https://t.v0v.de/js/t.js"></script>
@ -20,7 +31,7 @@
} }
</style> </style>
</head> </head>
<body class="max-w-screen-xl px-4 py-12 mx-auto space-y-8 sm:px-6 lg:px-8" style="background: #edf2f7;"> <body class="max-w-screen-xl px-4 py-12 mx-auto space-y-8 sm:px-6 lg:px-8 bg-gray-800">
<section class="container mx-auto px-8 my-1 flex flex-wrap -m-4"> <section class="container mx-auto px-8 my-1 flex flex-wrap -m-4">
<div class="p-2 md:w-40"> <div class="p-2 md:w-40">
<a href="/" class="flex items-center p-4 bg-blue-200 rounded-lg shadow-xs cursor-pointer hover:bg-blue-500 hover:text-gray-100"> <a href="/" class="flex items-center p-4 bg-blue-200 rounded-lg shadow-xs cursor-pointer hover:bg-blue-500 hover:text-gray-100">
@ -57,14 +68,14 @@
</div> </div>
</a> </a>
</div> </div>
{{block "content" .}}{{end}} {{block "content" . -}}{{- end}}
</body> </body>
<!-- Foooter --> <!-- Foooter -->
<section class="bg-white rounded-lg"> <section class="bg-white rounded-lg">
<div class="max-w-screen-xl px-4 py-12 mx-auto space-y-8 overflow-hidden sm:px-6 lg:px-8"> <div class="max-w-screen-xl px-4 py-12 mx-auto space-y-8 overflow-hidden sm:px-6 lg:px-8">
<nav class="flex flex-wrap justify-center -mx-5 -my-2"> <nav class="flex flex-wrap justify-center -mx-5 -my-2">
<div class="px-5 py-2"> <div class="px-5 py-2">
<a href="https://spenny.tf/discord" class="text-base leading-6 text-gray-500 hover:text-gray-900"> <a href="https://discord.gg/MfeXJkWg5m" class="text-base leading-6 text-gray-500 hover:text-gray-900">
Add server Add server
</a> </a>
</div> </div>

View File

@ -10,7 +10,7 @@
<div class="container mx-auto px-4 sm:px-8"> <div class="container mx-auto px-4 sm:px-8">
<div class="py-8"> <div class="py-8">
<div> <div>
<h2 class="text-2xl font-semibold leading-tight">{{.Region}}</h2> <h2 class="text-2xl font-semibold leading-tight text-white">{{.Region}}</h2>
</div> </div>
{{range $gamemode := $gamemodes -}} {{range $gamemode := $gamemodes -}}
{{range $gamemodeCount := $gamemodesCount -}} {{range $gamemodeCount := $gamemodesCount -}}
@ -38,6 +38,7 @@
<tbody> <tbody>
{{range $server := $servers -}} {{range $server := $servers -}}
{{if eq $gamemode.ID $server.GamemodeID -}} {{if eq $gamemode.ID $server.GamemodeID -}}
{{if ne $server.Map "Server didn't reply." -}}
<tr id="content"> <tr id="content">
<td class="px-5 border-b border-gray-200 bg-white" id="flag"> <td class="px-5 border-b border-gray-200 bg-white" id="flag">
{{range $flag := $flags -}} {{range $flag := $flags -}}
@ -61,6 +62,7 @@
</td> </td>
</tr> </tr>
{{- end}} {{- end}}
{{- end}}
{{- end}} {{- end}}
</tbody> </tbody>
</table> </table>

View File

@ -17,6 +17,7 @@ func NewHandler(store steamServer.Store) *Handler {
h.Use(middleware.Logger) h.Use(middleware.Logger)
h.Get("/favicon.ico", faviconHandler)
h.Get("/", h.Home()) h.Get("/", h.Home())
h.Get("/europe", h.Europe()) h.Get("/europe", h.Europe())
h.Get("/america", h.America()) h.Get("/america", h.America())
@ -32,6 +33,10 @@ type Handler struct {
store steamServer.Store store steamServer.Store
} }
func faviconHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "static/favicon.ico")
}
func (h *Handler) Home() http.HandlerFunc { func (h *Handler) Home() http.HandlerFunc {
type data struct { type data struct {
Region string Region string