fix "invalid session"

This commit is contained in:
2022-06-13 23:24:56 +08:00
parent ccd5ca916d
commit e3c8294d9f
5 changed files with 112 additions and 74 deletions

View File

@@ -49,6 +49,7 @@ func InitRouters(router *gin.Engine, db *gorm.DB, meta *ServerMeta, skinRootUrl
textureRouter := NewTextureRouter(textureService)
router.GET("/", homeRouter.Home)
router.HEAD("/", homeRouter.Home)
authserver := router.Group("/authserver")
{
authserver.POST("/register", userRouter.Register)

View File

@@ -68,8 +68,7 @@ func (s *sessionRouterImpl) JoinServer(c *gin.Context) {
func (s *sessionRouterImpl) HasJoinedServer(c *gin.Context) {
username := c.Query("username")
serverId := c.Query("serverId")
ip := c.DefaultQuery("ip",
c.Request.RemoteAddr[:strings.LastIndexByte(c.Request.RemoteAddr, ':')])
ip := c.Query("ip")
var textureBaseUrl string
if len(s.skinRootUrl) > 0 {
textureBaseUrl = strings.TrimRight(s.skinRootUrl, "/") + "/textures"