mirror of https://github.com/Xhofe/alist
chore: add `provider` to fs list resp
parent
b71ecc8e89
commit
c7f6684eed
|
@ -46,6 +46,7 @@ type FsListResp struct {
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
Readme string `json:"readme"`
|
Readme string `json:"readme"`
|
||||||
Write bool `json:"write"`
|
Write bool `json:"write"`
|
||||||
|
Provider string `json:"provider"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func FsList(c *gin.Context) {
|
func FsList(c *gin.Context) {
|
||||||
|
@ -79,11 +80,17 @@ func FsList(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
total, objs := pagination(objs, &req.PageReq)
|
total, objs := pagination(objs, &req.PageReq)
|
||||||
|
provider := "unknown"
|
||||||
|
storage, err := fs.GetStorage(req.Path)
|
||||||
|
if err == nil {
|
||||||
|
provider = storage.GetStorage().Driver
|
||||||
|
}
|
||||||
common.SuccessResp(c, FsListResp{
|
common.SuccessResp(c, FsListResp{
|
||||||
Content: toObjResp(objs, isEncrypt(meta, req.Path)),
|
Content: toObjResp(objs, isEncrypt(meta, req.Path)),
|
||||||
Total: int64(total),
|
Total: int64(total),
|
||||||
Readme: getReadme(meta, req.Path),
|
Readme: getReadme(meta, req.Path),
|
||||||
Write: user.CanWrite() || canWrite(meta, req.Path),
|
Write: user.CanWrite() || canWrite(meta, req.Path),
|
||||||
|
Provider: provider,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue