Compare commits
1 Commits
8934da692b
...
42716cd2a3
Author | SHA1 | Date | |
---|---|---|---|
42716cd2a3
|
@@ -64,7 +64,6 @@ type HomeRouter interface {
|
|||||||
type homeRouterImpl struct {
|
type homeRouterImpl struct {
|
||||||
serverMeta ServerMeta
|
serverMeta ServerMeta
|
||||||
myPubKey KeyPair
|
myPubKey KeyPair
|
||||||
cachedPubKey *PublicKeys
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHomeRouter(meta *ServerMeta) HomeRouter {
|
func NewHomeRouter(meta *ServerMeta) HomeRouter {
|
||||||
@@ -82,10 +81,6 @@ func (h *homeRouterImpl) Home(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *homeRouterImpl) PublicKeys(c *gin.Context) {
|
func (h *homeRouterImpl) PublicKeys(c *gin.Context) {
|
||||||
if h.cachedPubKey != nil {
|
|
||||||
c.JSON(http.StatusOK, h.cachedPubKey)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
publicKeys := PublicKeys{}
|
publicKeys := PublicKeys{}
|
||||||
err := util.GetObject("https://api.minecraftservices.com/publickeys", &publicKeys)
|
err := util.GetObject("https://api.minecraftservices.com/publickeys", &publicKeys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -95,5 +90,4 @@ func (h *homeRouterImpl) PublicKeys(c *gin.Context) {
|
|||||||
publicKeys.ProfilePropertyKeys = append(publicKeys.ProfilePropertyKeys, h.myPubKey)
|
publicKeys.ProfilePropertyKeys = append(publicKeys.ProfilePropertyKeys, h.myPubKey)
|
||||||
publicKeys.PlayerCertificateKeys = append(publicKeys.PlayerCertificateKeys, h.myPubKey)
|
publicKeys.PlayerCertificateKeys = append(publicKeys.PlayerCertificateKeys, h.myPubKey)
|
||||||
c.JSON(http.StatusOK, publicKeys)
|
c.JSON(http.StatusOK, publicKeys)
|
||||||
h.cachedPubKey = &publicKeys
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user