mirror of
https://github.com/sky22333/hubproxy.git
synced 2026-08-05 03:24:57 +08:00
fix favicon
This commit is contained in:
@@ -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"), "/")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user