mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 13:02:33 +02:00
fix(favicon): add GetFavIconFromAlias function and update favicon handling in idlewatcher
This commit is contained in:
parent
cfe0f6bb70
commit
2263d6063e
2 changed files with 7 additions and 2 deletions
|
@ -44,6 +44,12 @@ func GetFavIcon(w http.ResponseWriter, req *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try with alias
|
||||||
|
GetFavIconFromAlias(w, req, alias)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetFavIconFromAlias(w http.ResponseWriter, req *http.Request, alias string) {
|
||||||
// try with route.Icon
|
// try with route.Icon
|
||||||
r, ok := routes.HTTP.Get(alias)
|
r, ok := routes.HTTP.Get(alias)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -62,8 +62,7 @@ func (w *Watcher) wakeFromHTTP(rw http.ResponseWriter, r *http.Request) (shouldN
|
||||||
|
|
||||||
// handle favicon request
|
// handle favicon request
|
||||||
if isFaviconPath(r.URL.Path) {
|
if isFaviconPath(r.URL.Path) {
|
||||||
r.URL.RawQuery = "alias=" + w.rp.TargetName
|
favicon.GetFavIconFromAlias(rw, r, w.route.Name())
|
||||||
favicon.GetFavIcon(rw, r)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue