feat: meta readme

pull/1073/head
Xhofe 2022-04-05 20:17:16 +08:00
parent c413c22201
commit 1428d90361
2 changed files with 7 additions and 2 deletions

View File

@ -12,6 +12,7 @@ type Meta struct {
Hide string `json:"hide"`
Upload bool `json:"upload"`
OnlyShows string `json:"only_shows"`
Readme string `json:"readme"`
}
func GetMetaByPath(path string) (*Meta, error) {

View File

@ -60,6 +60,7 @@ type Meta struct {
Driver string `json:"driver"`
Upload bool `json:"upload"`
Total int `json:"total"`
Readme string `json:"readme"`
//Pages int `json:"pages"`
}
@ -75,8 +76,10 @@ func Path(c *gin.Context) {
_, ok := c.Get("admin")
meta, _ := model.GetMetaByPath(req.Path)
upload := false
if meta != nil && meta.Upload {
upload = true
readme := ""
if meta != nil {
upload = meta.Upload
readme = meta.Readme
}
err := CheckPagination(&req)
if err != nil {
@ -137,6 +140,7 @@ func Path(c *gin.Context) {
Driver: driverName,
Upload: upload,
Total: total,
Readme: readme,
},
Files: files,
},