chore: update deps #946

This commit is contained in:
Jacky 2025-04-08 07:58:05 +00:00
parent 98a4708a8c
commit 241fa4adfe
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
10 changed files with 107 additions and 90 deletions

View file

@ -25,23 +25,6 @@ func mustFs(dir string) (serverFileSystem static.ServeFileSystem) {
return
}
func ServeStatic() []gin.HandlerFunc {
const urlPrefix = "/"
fs := mustFs(urlPrefix)
fileserver := http.FileServer(fs)
if urlPrefix != "" {
fileserver = http.StripPrefix(urlPrefix, fileserver)
}
return []gin.HandlerFunc{
func(c *gin.Context) {
if fs.Exists(urlPrefix, c.Request.URL.Path) {
c.Next()
}
},
IPWhiteList(),
func(c *gin.Context) {
fileserver.ServeHTTP(c.Writer, c.Request)
c.Abort()
},
}
func ServeStatic() gin.HandlerFunc {
return static.Serve("/", mustFs(""))
}