feat(files): add isSharing api

This commit is contained in:
hexxa 2021-08-17 15:08:44 +08:00 committed by Hexxa
parent 94505ae87b
commit 43f2507428
3 changed files with 18 additions and 0 deletions

View file

@ -785,6 +785,21 @@ func (h *FileHandlers) DelSharing(c *gin.Context) {
c.JSON(q.Resp(200))
}
func (h *FileHandlers) IsSharing(c *gin.Context) {
req := &SharingReq{}
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(q.ErrResp(c, 400, err))
return
}
_, ok := h.deps.FileInfos().GetSharing(req.SharingPath)
if ok {
c.JSON(q.Resp(200))
} else {
c.JSON(q.Resp(404))
}
}
type SharingResp struct {
SharingDirs []string `json:"sharingPaths"`
}