From 7e0b82f8f0105557ebe17d60035ccd8ca429b0f4 Mon Sep 17 00:00:00 2001 From: sky22333 Date: Sun, 12 Jul 2026 01:30:17 +0800 Subject: [PATCH] fix favicon --- src/main.go | 6 +++--- src/main_test.go | 2 +- src/utils/ratelimiter.go | 2 +- web/index.html | 2 +- web/public/favicon.ico | Bin 0 -> 2092 bytes web/public/favicon.svg | 1 - web/public/icons.svg | 24 ------------------------ 7 files changed, 6 insertions(+), 31 deletions(-) create mode 100644 web/public/favicon.ico delete mode 100644 web/public/favicon.svg delete mode 100644 web/public/icons.svg diff --git a/src/main.go b/src/main.go index cd542cb..c97e13b 100644 --- a/src/main.go +++ b/src/main.go @@ -67,15 +67,15 @@ func registerFrontendRoutes(router *gin.Engine, enabled bool) { router.GET("/images", notFound) router.GET("/search", notFound) router.GET("/assets/*filepath", notFound) - router.GET("/favicon.svg", notFound) + router.GET("/favicon.ico", notFound) return } router.GET("/", serveSPA) router.GET("/images", serveSPA) router.GET("/search", serveSPA) - router.GET("/favicon.svg", func(c *gin.Context) { - serveEmbedFile(c, "dist/favicon.svg") + router.GET("/favicon.ico", func(c *gin.Context) { + serveEmbedFile(c, "dist/favicon.ico") }) router.GET("/assets/*filepath", func(c *gin.Context) { filepath := strings.TrimPrefix(c.Param("filepath"), "/") diff --git a/src/main_test.go b/src/main_test.go index be5952f..913cdbd 100644 --- a/src/main_test.go +++ b/src/main_test.go @@ -71,7 +71,7 @@ func TestFrontendDisabledRoutesReturnNotFound(t *testing.T) { enableFrontend = false `) - for _, path := range []string{"/", "/images", "/search", "/favicon.svg"} { + for _, path := range []string{"/", "/images", "/search", "/favicon.ico"} { w := performRequest(router, http.MethodGet, path, "") if w.Code != http.StatusNotFound { t.Fatalf("%s status = %d, want 404", path, w.Code) diff --git a/src/utils/ratelimiter.go b/src/utils/ratelimiter.go index 4741e40..6531319 100644 --- a/src/utils/ratelimiter.go +++ b/src/utils/ratelimiter.go @@ -213,7 +213,7 @@ func RateLimitMiddleware(limiter *IPRateLimiter) gin.HandlerFunc { return func(c *gin.Context) { path := c.Request.URL.Path if path == "/" || path == "/images" || path == "/search" || - path == "/favicon.svg" || + path == "/favicon.ico" || strings.HasPrefix(path, "/assets/") { c.Next() return diff --git a/web/index.html b/web/index.html index e1ede59..58b4cd3 100644 --- a/web/index.html +++ b/web/index.html @@ -2,7 +2,7 @@ - + HubProxy diff --git a/web/public/favicon.ico b/web/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..1ead7d63ee12249f8fc59a3d5daf02a3cdc51bba GIT binary patch literal 2092 zcmV+{2-Ek8P)2D!_9fs*{!i&jWpdW`%BK+-L+`1-t?5a%6Oq z)Bsa}?m!6*m=?fDU`-y3u9LOEV4x`tY?!%Q#&Itu@~b=ys%}Nib-?Br7~IpyI-n0l zNIT$T%L#M^FbxTAJj=SfM%Lp| z>=BgDe=P84y)yUu^f{@HTW#nBwd2nl>Pfv6I6Z`p;fBU6avaN5vE{D}&psg{4Ml+W~&@3a=5Q?7Ep4mgzQcFUWhcCif76s%G~g0j+w zVKTm>gFZi7R}RW|{d`u%D}r!^LD%g>$Wl$AD*6w0kt8#fTk6dR{*IEv2y8X*oTzifbN zmC)!6ru^(S?2dt?(oq3qfu^q zt}0uit{0=DN;Wjr=u@@}jqZuH%?eu(14DZb151eG&E*?)7&|n|RjAO0F)=W-rxA5{ z(1sH<`hLd&8#T(yL%5;6m~O;Qwro>ZjZWok49#-K%TQA|&nuv)(=xW4tI??fHldmC zcq5jnaBU2XUe|GUPRQf8+4O#j114&e-xX5tYcVio z42-`b#DXHjI~v_Xa6s<}+|e0M1hy2=_*KEZd|e zKWB=E%N-I2ER23YHbNBEOk6wQ?0UnZ%40o)1kuIETUFdicD<%`1>>lDi*@nx>L&vMB}zubU$}I%ylPur!ei z?h5@wZo?Y-&l{G=O(m1_;1A0DO4Bs?aiKW>m_$KnCY!VIvMjZ^uCl(=iVI|d{AOi? ze%galCRe^xhymwGcyYZ1gZ7F0pjxsus^li$NpkT \ No newline at end of file diff --git a/web/public/icons.svg b/web/public/icons.svg deleted file mode 100644 index e952219..0000000 --- a/web/public/icons.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -