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:
@@ -113,6 +113,7 @@ func routes(logger *slog.Logger, cfg *config.Config, db *store.DB, provider ai.P
|
||||
|
||||
mcpHandler := mcpserver.New(cfg.MCP, toolSet)
|
||||
mux.Handle(cfg.MCP.Path, auth.Middleware(cfg.Auth, keyring, logger)(mcpHandler))
|
||||
mux.HandleFunc("/favicon.ico", serveFavicon)
|
||||
|
||||
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
24
internal/app/favicon.go
Normal file
24
internal/app/favicon.go
Normal 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)
|
||||
}
|
||||
BIN
internal/app/static/favicon-source.png
Normal file
BIN
internal/app/static/favicon-source.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
BIN
internal/app/static/favicon.ico
Normal file
BIN
internal/app/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
Reference in New Issue
Block a user