From ca4391784a29dfd248226451d82c70887512d78a Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 21 May 2023 22:35:37 +0400 Subject: [PATCH] Added /favicon.svg endpoint. --- cmd/dwelling-radio/main.go | 1 + internal/http/handlers.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cmd/dwelling-radio/main.go b/cmd/dwelling-radio/main.go index 5c4e2cf..e7e3652 100644 --- a/cmd/dwelling-radio/main.go +++ b/cmd/dwelling-radio/main.go @@ -65,6 +65,7 @@ func main() { srv.GET("/filelist", hand.Filelist) srv.GET("/robots.txt", hand.RobotsTxt) + srv.GET("/favicon.svg", http.Favicon) if !*noLiquidsoap { liquid, err := radio.NewLiquidsoap(config.Liquidsoap.ExecPath, config.Liquidsoap.ScriptPath) diff --git a/internal/http/handlers.go b/internal/http/handlers.go index 09ba47b..fca3332 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -109,3 +109,8 @@ func (h *Handlers) RobotsTxt(w http.ResponseWriter, _ *http.Request) { w.Header().Add("Content-Disposition", "attachment; filename=\"robots.txt\"") w.Write([]byte("User-agent: *\nDisallow: /assets/\nDisallow: /live/")) } + +func Favicon(w http.ResponseWriter, r *http.Request) { + data, _ := web.AssetsGetFile("img/favicon.svg") + w.Write(data) +}