Added more infos to a link share auth (#98)

This commit is contained in:
konrad 2019-09-08 19:22:54 +00:00 committed by Gitea
parent 6140920cb8
commit 71ef86e0df

View file

@ -23,6 +23,13 @@ import (
"net/http" "net/http"
) )
// LinkShareToken represents a link share auth token with extra infos about the actual link share
type LinkShareToken struct {
Token
*models.LinkSharing
ListID int64 `json:"list_id"`
}
// AuthenticateLinkShare gives a jwt auth token for valid share hashes // AuthenticateLinkShare gives a jwt auth token for valid share hashes
// @Summary Get an auth token for a share // @Summary Get an auth token for a share
// @Description Get a jwt auth token for a shared list from a share hash. // @Description Get a jwt auth token for a shared list from a share hash.
@ -46,5 +53,9 @@ func AuthenticateLinkShare(c echo.Context) error {
return handler.HandleHTTPError(err, c) return handler.HandleHTTPError(err, c)
} }
return c.JSON(http.StatusOK, Token{Token: t}) return c.JSON(http.StatusOK, LinkShareToken{
Token: Token{Token: t},
LinkSharing: share,
ListID: share.ListID,
})
} }