feat(files): add uploadings api (#30)
* fix(uploader, files/handlers): fix incorrect unlock, catch and check after calling api * fix(uploader): fix uploader test * feat(files): add uploadings api * fix(files): register uploading handlers to api Co-authored-by: Jia He <jiah@nvidia.com>
This commit is contained in:
parent
a909df384d
commit
67c07cc81f
11 changed files with 398 additions and 83 deletions
|
@ -53,11 +53,14 @@ func (h *SimpleUserHandlers) Auth() gin.HandlerFunc {
|
|||
ExpireParam: "",
|
||||
}
|
||||
|
||||
_, err = h.deps.Token().FromToken(token, claims)
|
||||
claims, err = h.deps.Token().FromToken(token, claims)
|
||||
if err != nil {
|
||||
c.AbortWithStatusJSON(q.ErrResp(c, 401, err))
|
||||
return
|
||||
}
|
||||
for key, val := range claims {
|
||||
c.Set(key, val)
|
||||
}
|
||||
|
||||
now := time.Now().Unix()
|
||||
expire, err := strconv.ParseInt(claims[ExpireParam], 10, 64)
|
||||
|
@ -71,6 +74,9 @@ func (h *SimpleUserHandlers) Auth() gin.HandlerFunc {
|
|||
c.AbortWithStatusJSON(q.ErrResp(c, 401, errors.New("not allowed")))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// this is for UploadMgr to get user info to get related namespace
|
||||
c.Set(UserParam, "quickshare_anonymous")
|
||||
}
|
||||
|
||||
c.Next()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue