🐛 Keep the nex_user in context always the pointer

This commit is contained in:
2025-01-30 22:44:43 +08:00
parent 7cf9b80fe6
commit 2e3c663525
3 changed files with 9 additions and 8 deletions

View File

@ -42,7 +42,7 @@ func MapAPIs(app *fiber.App) {
}
// WatchTower administration APIs
wt := app.Group("/watchtower").Name("WatchTower").Use(auth.ValidatorMiddleware)
wt := app.Group("/wt").Name("WatchTower").Use(auth.ValidatorMiddleware)
{
wt.Post("/maintenance/database", wtRunDbMaintenance)
}

View File

@ -15,14 +15,14 @@ import (
)
func Listen(c *websocket.Conn) {
user, ok := c.Locals("nex_user").(sec.UserInfo)
user, ok := c.Locals("nex_user").(*sec.UserInfo)
if !ok {
c.Close()
return
}
// Push connection
clientId := ClientRegister(user, c)
clientId := ClientRegister(*user, c)
// Event loop
var mt int
@ -80,5 +80,5 @@ func Listen(c *websocket.Conn) {
}
// Pop connection
ClientUnregister(user, clientId)
ClientUnregister(*user, clientId)
}