add support for 1.19 "Secure Chat Signing"
This commit is contained in:
@@ -37,6 +37,7 @@ type UserRouter interface {
|
||||
UsernameToUUID(c *gin.Context)
|
||||
QueryUUIDs(c *gin.Context)
|
||||
QueryProfile(c *gin.Context)
|
||||
ProfileKey(c *gin.Context)
|
||||
}
|
||||
|
||||
type userRouterImpl struct {
|
||||
@@ -263,3 +264,18 @@ func (u *userRouterImpl) QueryProfile(c *gin.Context) {
|
||||
}
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
func (u *userRouterImpl) ProfileKey(c *gin.Context) {
|
||||
bearerToken := c.GetHeader("Authorization")
|
||||
if len(bearerToken) < 8 {
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, util.NewForbiddenOperationError(util.MessageInvalidToken))
|
||||
return
|
||||
}
|
||||
accessToken := bearerToken[7:]
|
||||
response, err := u.userService.ProfileKey(accessToken)
|
||||
if err != nil {
|
||||
util.HandleError(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
Reference in New Issue
Block a user