feat: 添加 anti-feature 功能
This commit is contained in:
1
main.go
1
main.go
@@ -151,6 +151,7 @@ func main() {
|
||||
serverMeta.Meta.ImplementationVersion = meta.ImplementationVersion
|
||||
serverMeta.Meta.FeatureNoMojangNamespace = true
|
||||
serverMeta.Meta.FeatureEnableProfileKey = true
|
||||
serverMeta.Meta.FeatureEnableMojangAntiFeatures = true
|
||||
serverMeta.Meta.Links.Homepage = meta.SkinRootUrl + "/profile/"
|
||||
serverMeta.Meta.Links.Register = meta.SkinRootUrl + "/profile/"
|
||||
serverMeta.SkinDomains = meta.SkinDomains
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023. Gardel <sunxinao@hotmail.com> and contributors
|
||||
* Copyright (C) 2022-2025. Gardel <sunxinao@hotmail.com> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -33,10 +33,11 @@ type MetaInfo struct {
|
||||
Homepage string `json:"homepage,omitempty"`
|
||||
Register string `json:"register,omitempty"`
|
||||
} `json:"links"`
|
||||
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"`
|
||||
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"`
|
||||
FeatureEnableMojangAntiFeatures bool `json:"feature.enable_mojang_anti_features,omitempty"`
|
||||
}
|
||||
|
||||
type ServerMeta struct {
|
||||
|
@@ -79,6 +79,7 @@ func InitRouters(router *gin.Engine, db *gorm.DB, meta *ServerMeta, smtpCfg *ser
|
||||
}
|
||||
minecraftservices := router.Group("/minecraftservices")
|
||||
{
|
||||
minecraftservices.GET("/player/attributes", userRouter.PlayerAttributes)
|
||||
minecraftservices.POST("/player/certificates", userRouter.ProfileKey)
|
||||
minecraftservices.GET("/publickeys", homeRouter.PublicKeys)
|
||||
minecraftservices.GET("/minecraft/profile/lookup/:uuid", userRouter.UUIDToUUID)
|
||||
|
@@ -38,6 +38,7 @@ type UserRouter interface {
|
||||
UUIDToUUID(c *gin.Context)
|
||||
QueryUUIDs(c *gin.Context)
|
||||
QueryProfile(c *gin.Context)
|
||||
PlayerAttributes(c *gin.Context)
|
||||
ProfileKey(c *gin.Context)
|
||||
SendEmail(c *gin.Context)
|
||||
VerifyEmail(c *gin.Context)
|
||||
@@ -299,6 +300,21 @@ func (u *userRouterImpl) QueryProfile(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
func (u *userRouterImpl) PlayerAttributes(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"privileges": gin.H{
|
||||
"onlineChat": true,
|
||||
"multiplayerServer": true,
|
||||
"multiplayerRealms": false,
|
||||
"telemetry": false,
|
||||
"optionalTelemetry": false,
|
||||
},
|
||||
"profanityFilterPreferences": gin.H{
|
||||
"profanityFilterOn": false,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (u *userRouterImpl) ProfileKey(c *gin.Context) {
|
||||
bearerToken := c.GetHeader("Authorization")
|
||||
if len(bearerToken) < 8 {
|
||||
|
Reference in New Issue
Block a user