From 694235d8492726c28b7849f80410ddebf9fcbedc Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Thu, 23 Jan 2025 13:43:41 +0100 Subject: Add favicon --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index 3e2cd86..b5ff613 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,9 @@ import ( //go:embed templates var tmplFS embed.FS +//go:embed favicon.ico +var favicon []byte + type BoxHandler struct { dataPath string @@ -38,6 +41,10 @@ func serve(w http.ResponseWriter, token string, views ...string) { func (handler BoxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { switch r.Method { case http.MethodGet: + if r.URL.Path == "/favicon.ico" { + w.Write(favicon) + return + } if r.URL.Path == "/" { serve(w, handler.token, "templates/index.html") } else { -- cgit v1.2.3