serve favicon.ico

This commit is contained in:
Michael Stapelberg 2018-07-15 18:32:46 +02:00
parent 504f06b15f
commit 1c16b3b4eb
4 changed files with 8 additions and 1 deletions

BIN
assets/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -1,3 +1,3 @@
package gokrazy
//go:generate sh -c "go run goembed.go -package bundled -var assets assets/header.tmpl assets/footer.tmpl assets/overview.tmpl assets/status.tmpl > internal/bundled/GENERATED_bundled.go"
//go:generate sh -c "go run goembed.go -package bundled -var assets assets/header.tmpl assets/footer.tmpl assets/overview.tmpl assets/status.tmpl assets/favicon.ico > internal/bundled/GENERATED_bundled.go"

File diff suppressed because one or more lines are too long

View File

@ -94,6 +94,11 @@ var overviewTmpl = template.Must(template.Must(commonTmpls.Clone()).New("overvie
var statusTmpl = template.Must(template.Must(commonTmpls.Clone()).New("statusTmpl").Parse(bundled.Asset("status.tmpl")))
func initStatus(services []*service) {
http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
if _, err := w.Write([]byte(bundled.Asset("favicon.ico"))); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
})
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
token := xsrfTokenFromCookies(r.Cookies())
if token == 0 {