mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
chore: update deps #946
This commit is contained in:
parent
98a4708a8c
commit
241fa4adfe
10 changed files with 107 additions and 90 deletions
|
@ -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(""))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue