mirror of https://github.com/Xhofe/alist
✨ cancel hide file for admin #343
parent
424ec10692
commit
1640a52789
|
@ -87,6 +87,7 @@ type PathResp struct {
|
||||||
func Path(c *gin.Context) {
|
func Path(c *gin.Context) {
|
||||||
reqV, _ := c.Get("req")
|
reqV, _ := c.Get("req")
|
||||||
req := reqV.(common.PathReq)
|
req := reqV.(common.PathReq)
|
||||||
|
_, ok := c.Get("admin")
|
||||||
meta, _ := model.GetMetaByPath(req.Path)
|
meta, _ := model.GetMetaByPath(req.Path)
|
||||||
upload := false
|
upload := false
|
||||||
if meta != nil && meta.Upload {
|
if meta != nil && meta.Upload {
|
||||||
|
@ -98,7 +99,9 @@ func Path(c *gin.Context) {
|
||||||
common.ErrorResp(c, err, 500)
|
common.ErrorResp(c, err, 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
files = Hide(meta, files)
|
if !ok {
|
||||||
|
files = Hide(meta, files)
|
||||||
|
}
|
||||||
c.JSON(200, common.Resp{
|
c.JSON(200, common.Resp{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
Message: "success",
|
Message: "success",
|
||||||
|
@ -155,7 +158,9 @@ func Path(c *gin.Context) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
files = Hide(meta, files)
|
if !ok {
|
||||||
|
files = Hide(meta, files)
|
||||||
|
}
|
||||||
if driver.Config().LocalSort {
|
if driver.Config().LocalSort {
|
||||||
model.SortFiles(files, account)
|
model.SortFiles(files, account)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ func PathCheck(c *gin.Context) {
|
||||||
c.Set("req", req)
|
c.Set("req", req)
|
||||||
token := c.GetHeader("Authorization")
|
token := c.GetHeader("Authorization")
|
||||||
if token == conf.Token {
|
if token == conf.Token {
|
||||||
|
c.Set("admin", true)
|
||||||
c.Next()
|
c.Next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue