Skip to content

Commit

Permalink
chore: add provider to fs list resp
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 22, 2022
1 parent b71ecc8 commit c7f6684
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions server/handles/fsread.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ type ObjResp struct {
}

type FsListResp struct {
Content []ObjResp `json:"content"`
Total int64 `json:"total"`
Readme string `json:"readme"`
Write bool `json:"write"`
Content []ObjResp `json:"content"`
Total int64 `json:"total"`
Readme string `json:"readme"`
Write bool `json:"write"`
Provider string `json:"provider"`
}

func FsList(c *gin.Context) {
Expand Down Expand Up @@ -79,11 +80,17 @@ func FsList(c *gin.Context) {
return
}
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{
Content: toObjResp(objs, isEncrypt(meta, req.Path)),
Total: int64(total),
Readme: getReadme(meta, req.Path),
Write: user.CanWrite() || canWrite(meta, req.Path),
Content: toObjResp(objs, isEncrypt(meta, req.Path)),
Total: int64(total),
Readme: getReadme(meta, req.Path),
Write: user.CanWrite() || canWrite(meta, req.Path),
Provider: provider,
})
}

Expand Down

0 comments on commit c7f6684

Please sign in to comment.