Theme & favicon

This commit is contained in:
aceberg 2022-08-16 23:52:06 +07:00
parent 2c785a8b13
commit 9e812e050a
3 changed files with 56 additions and 23 deletions

View file

@ -10,7 +10,7 @@ var FoundHosts []Host
func index (w http.ResponseWriter, r *http.Request) {
fmt.Println(FoundHosts)
tmpl, _ := template.ParseFiles("templates/index.html")
tmpl, _ := template.ParseFiles("templates/index.html", "templates/header.html")
tmpl.ExecuteTemplate(w, "index", FoundHosts)
}

10
templates/header.html Normal file
View file

@ -0,0 +1,10 @@
{{ define "header"}}
<html>
<head>
<title>Watch Your LAN</title>
<meta charset="utf-8">
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA/6k7AP+uSQD/z50A7urjAD85MgAAOO8AWlpaAADIawAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEREQAAAAAzEREREQAAAzEREREREAAzFxEREVERADN3d3VVVREDM3d3dYVlERMzd3d1VVUREzM3ERESERETMzcRESERERMzNxESMREREzM3ESNEQREwMzcSMxEREwAzNyM0REQzAAMzMzMzMzAAADMzMzMzAAAAADMzMwAAD4HwAA4AcAAMADAACAAQAAgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIABAACAAQAAwAMAAOAHAAD4HwAA" rel="icon" type="image/x-icon" />
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.0/dist/solar/bootstrap.min.css" rel="stylesheet">
</head>
{{ end }}

View file

@ -1,27 +1,50 @@
{{ define "index"}}
<html>
<head>
<title>Watch Your LAN</title>
<meta charset="utf-8">
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.0/dist/spacelab/bootstrap.min.css" rel="stylesheet">
</head>
{{ template "header" }}
<body>
<table>
<tr>
<th>Name</th>
<th>Ip</th>
<th>Mac</th>
<th>Hardware</th>
</tr>
{{ range . }}
<tr>
<td>{{ .Name }}</td>
<td>{{ .Ip }}</td>
<td>{{ .Mac }}</td>
<td>{{ .Hw }}</td>
</tr>
{{ end }}
</table>
<div class="container mt-3">
<h2>Now online</h2>
<table class="table table-striped">
<tr>
<th>Name</th>
<th>Ip</th>
<th>Mac</th>
<th>Hardware</th>
<th>Known</th>
</tr>
{{ range . }}
<tr>
<td>{{ .Name }}</td>
<td>{{ .Ip }}</td>
<td>{{ .Mac }}</td>
<td>{{ .Hw }}</td>
<td>{{ .Known }}</td>
</tr>
{{ end }}
</table>
<h2>Log</h2>
<table class="table table-striped">
<tr>
<th>Name</th>
<th>Ip</th>
<th>Mac</th>
<th>Hardware</th>
<th>Date</th>
<th>Known</th>
</tr>
{{ range . }}
<tr>
<td>{{ .Name }}</td>
<td>{{ .Ip }}</td>
<td>{{ .Mac }}</td>
<td>{{ .Hw }}</td>
<td>{{ .Date }}</td>
<td>{{ .Known }}</td>
</tr>
{{ end }}
</table>
</div>
</body>
</html>
{{ end }}