feat(yggdrasil): 实现 MC 1.21.7 单用户名查 UUID 接口
Some checks failed
Build / build-docker (push) Has been cancelled
Build / build (push) Has been cancelled

对应官方 api.minecraftservices.com/minecraft/profile/lookup/name/{name},
1.21.7 的 /whitelist add 等命令会请求该接口(authlib-injector issue #277)。
authlib-injector 把 api.minecraftservices.com override 到 {apiRoot}/minecraftservices,
故路由注册在 mcServices 组下:

  GET /api/yggdrasil/minecraftservices/minecraft/profile/lookup/name/:name

复用 ProfileSearchByNameSingle,返回 {id,name},未找到返回 404。
go build ./... && go test ./... 全部通过。
This commit is contained in:
2026-07-09 21:06:43 +08:00
parent f2b02682c2
commit 9fc1be0ec1
2 changed files with 37 additions and 0 deletions

View File

@@ -186,6 +186,8 @@ func registerYggdrasilRoutesWithDI(v1 *gin.RouterGroup, h *Handlers) {
mcServices.POST("/player/attributes", h.Friends.UpdateAttributes)
mcServices.POST("/presence", h.Friends.UpdatePresence)
mcServices.GET("/privacy/blocklist", h.Friends.GetBlocklist)
// MC 1.21.7 /whitelist add 查询单用户名 UUIDauthlib-injector issue #277
mcServices.GET("/minecraft/profile/lookup/name/:name", h.Yggdrasil.LookupProfileByName)
}
authserver := ygg.Group("/authserver")