mirror of https://github.com/Xhofe/alist
🚧 change path api resp struct
parent
939c9cd5ac
commit
cc217df924
|
@ -27,6 +27,12 @@ func Hide(files []model.File, path string) []model.File {
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PathResp struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Driver string `json:"driver"`
|
||||||
|
Files []model.File `json:"files"`
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@ -39,8 +45,12 @@ func Path(c *gin.Context) {
|
||||||
files = Hide(files, req.Path)
|
files = Hide(files, req.Path)
|
||||||
c.JSON(200, common.Resp{
|
c.JSON(200, common.Resp{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
Message: "folder",
|
Message: "success",
|
||||||
Data: files,
|
Data: PathResp{
|
||||||
|
Type: "folder",
|
||||||
|
Driver: "root",
|
||||||
|
Files: files,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -72,8 +82,12 @@ func Path(c *gin.Context) {
|
||||||
}
|
}
|
||||||
c.JSON(200, common.Resp{
|
c.JSON(200, common.Resp{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
Message: "file",
|
Message: "success",
|
||||||
Data: []*model.File{file},
|
Data: PathResp{
|
||||||
|
Type: "file",
|
||||||
|
Driver: driver.Config().Name,
|
||||||
|
Files: []model.File{*file},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
files = Hide(files, req.Path)
|
files = Hide(files, req.Path)
|
||||||
|
@ -82,8 +96,12 @@ func Path(c *gin.Context) {
|
||||||
}
|
}
|
||||||
c.JSON(200, common.Resp{
|
c.JSON(200, common.Resp{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
Message: "folder",
|
Message: "success",
|
||||||
Data: files,
|
Data: PathResp{
|
||||||
|
Type: "folder",
|
||||||
|
Driver: "root",
|
||||||
|
Files: files,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue