summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2025-01-23 13:43:41 +0100
committerJulian Hurst <ark@mansus.space>2025-01-23 13:43:41 +0100
commit694235d8492726c28b7849f80410ddebf9fcbedc (patch)
treedfdb63fbc4ab4bfc396852e3c71aef0811b1a11d
parentcc5587319b411fc6896f18c8d174d6034f4ee5e5 (diff)
downloadbox-694235d8492726c28b7849f80410ddebf9fcbedc.tar.gz
Add favicon
-rw-r--r--main.go7
1 files changed, 7 insertions, 0 deletions
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 {