succd: show logo

This commit is contained in:
Serge Bazanski 2024-09-27 02:10:39 +02:00
parent 7dffd2a4b4
commit 781bbaaeb4
3 changed files with 21 additions and 1 deletions

View file

@ -19,8 +19,15 @@ var (
//go:embed index.html //go:embed index.html
templateIndexText string templateIndexText string
templateIndex = template.Must(template.New("index").Parse(templateIndexText)) templateIndex = template.Must(template.New("index").Parse(templateIndexText))
//go:embed succd.png
favicon []byte
) )
func (d *daemon) httpFavicon(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "image/png")
w.Write(favicon)
}
func formatVolts(v float32) string { func formatVolts(v float32) string {
return fmt.Sprintf("%.4f V", v) return fmt.Sprintf("%.4f V", v)
} }

View file

@ -2,6 +2,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>succd</title> <title>succd</title>
<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/png" href="/favicon.png">
<style> <style>
body { body {
font-size: 14px; font-size: 14px;
@ -34,12 +35,23 @@ button {
padding-left: 1.5em; padding-left: 1.5em;
padding-right: 1.5em; padding-right: 1.5em;
} }
.logo {
float: left;
margin-right: 2em;
}
.logo > img {
height: 10em;
}
</style> </style>
<div class="logo"><img src="/favicon.png" /></div>
<h1>succd</h1> <h1>succd</h1>
<h2>nothing more permanent than a temporary solution</h2> <h2>nothing more permanent than a temporary solution</h2>
<p style="margin-top: 2em;"> <p style="margin-top: 2em; clear: both;">
<table> <table>
<tr> <tr>
<th>Voltage</th> <th>Voltage</th>

View file

@ -201,6 +201,7 @@ func main() {
} }
http.HandleFunc("/", d.httpIndex) http.HandleFunc("/", d.httpIndex)
http.HandleFunc("/favicon.png", d.httpFavicon)
http.HandleFunc("/stream", d.httpStream) http.HandleFunc("/stream", d.httpStream)
http.HandleFunc("/metrics", d.httpMetrics) http.HandleFunc("/metrics", d.httpMetrics)
http.HandleFunc("/button/vent", d.httpButtonVent) http.HandleFunc("/button/vent", d.httpButtonVent)