From 2263d6063edf823525ee2722fa0406b36a65f738 Mon Sep 17 00:00:00 2001 From: yusing Date: Sun, 8 Jun 2025 15:13:38 +0800 Subject: [PATCH] fix(favicon): add GetFavIconFromAlias function and update favicon handling in idlewatcher --- internal/api/v1/favicon/favicon.go | 6 ++++++ internal/idlewatcher/handle_http.go | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/api/v1/favicon/favicon.go b/internal/api/v1/favicon/favicon.go index cb03fa8..8084747 100644 --- a/internal/api/v1/favicon/favicon.go +++ b/internal/api/v1/favicon/favicon.go @@ -44,6 +44,12 @@ func GetFavIcon(w http.ResponseWriter, req *http.Request) { return } + // try with alias + GetFavIconFromAlias(w, req, alias) + return +} + +func GetFavIconFromAlias(w http.ResponseWriter, req *http.Request, alias string) { // try with route.Icon r, ok := routes.HTTP.Get(alias) if !ok { diff --git a/internal/idlewatcher/handle_http.go b/internal/idlewatcher/handle_http.go index 0c2f0e9..9c2d9f4 100644 --- a/internal/idlewatcher/handle_http.go +++ b/internal/idlewatcher/handle_http.go @@ -62,8 +62,7 @@ func (w *Watcher) wakeFromHTTP(rw http.ResponseWriter, r *http.Request) (shouldN // handle favicon request if isFaviconPath(r.URL.Path) { - r.URL.RawQuery = "alias=" + w.rp.TargetName - favicon.GetFavIcon(rw, r) + favicon.GetFavIconFromAlias(rw, r, w.route.Name()) return false }