add support for 1.19 "Secure Chat Signing"
This commit is contained in:
@@ -33,6 +33,7 @@ type MetaInfo struct {
|
||||
FeatureNonEmailLogin bool `json:"feature.non_email_login,omitempty"`
|
||||
FeatureLegacySkinApi bool `json:"feature.legacy_skin_api,omitempty"`
|
||||
FeatureNoMojangNamespace bool `json:"feature.no_mojang_namespace,omitempty"`
|
||||
FeatureEnableProfileKey bool `json:"feature.enable_profile_key,omitempty"`
|
||||
}
|
||||
|
||||
type ServerMeta struct {
|
||||
|
@@ -76,4 +76,5 @@ func InitRouters(router *gin.Engine, db *gorm.DB, meta *ServerMeta, skinRootUrl
|
||||
api.DELETE("/user/profile/:uuid/:textureType", textureRouter.DeleteTexture)
|
||||
api.GET("/users/profiles/minecraft/:username", userRouter.UsernameToUUID)
|
||||
}
|
||||
router.POST("/minecraftservices/player/certificates", userRouter.ProfileKey)
|
||||
}
|
||||
|
@@ -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