feat(favicon): add favicon handling and serve functionality

* Implement favicon serving endpoint
* Add favicon.ico and favicon-source.png files
This commit is contained in:
Hein
2026-03-24 17:17:49 +02:00
parent 66370a7f0e
commit ad05a9e228
4 changed files with 25 additions and 0 deletions

24
internal/app/favicon.go Normal file
View File

@@ -0,0 +1,24 @@
package app
import (
_ "embed"
"net/http"
)
var (
//go:embed static/favicon.ico
faviconICO []byte
)
func serveFavicon(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "image/x-icon")
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
if r.Method == http.MethodHead {
w.WriteHeader(http.StatusOK)
return
}
w.WriteHeader(http.StatusOK)
_, _ = w.Write(faviconICO)
}