cancel hide file for admin #343

pull/548/head
微凉 2022-01-14 18:00:47 +08:00
parent 424ec10692
commit 1640a52789
2 changed files with 8 additions and 2 deletions

View File

@ -87,6 +87,7 @@ type PathResp struct {
func Path(c *gin.Context) {
reqV, _ := c.Get("req")
req := reqV.(common.PathReq)
_, ok := c.Get("admin")
meta, _ := model.GetMetaByPath(req.Path)
upload := false
if meta != nil && meta.Upload {
@ -98,7 +99,9 @@ func Path(c *gin.Context) {
common.ErrorResp(c, err, 500)
return
}
files = Hide(meta, files)
if !ok {
files = Hide(meta, files)
}
c.JSON(200, common.Resp{
Code: 200,
Message: "success",
@ -155,7 +158,9 @@ func Path(c *gin.Context) {
},
})
} else {
files = Hide(meta, files)
if !ok {
files = Hide(meta, files)
}
if driver.Config().LocalSort {
model.SortFiles(files, account)
}

View File

@ -18,6 +18,7 @@ func PathCheck(c *gin.Context) {
c.Set("req", req)
token := c.GetHeader("Authorization")
if token == conf.Token {
c.Set("admin", true)
c.Next()
return
}