🐛 Fix user info not found panic
This commit is contained in:
parent
cd58e7a429
commit
8e1adfae9a
@ -3,6 +3,7 @@ package ws
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.solsynth.dev/hypernet/nexus/pkg/internal/directory"
|
"git.solsynth.dev/hypernet/nexus/pkg/internal/directory"
|
||||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||||
@ -14,7 +15,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Listen(c *websocket.Conn) {
|
func Listen(c *websocket.Conn) {
|
||||||
user := c.Locals("nex_user").(sec.UserInfo)
|
user, ok := c.Locals("nex_user").(sec.UserInfo)
|
||||||
|
if !ok {
|
||||||
|
c.Close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Push connection
|
// Push connection
|
||||||
clientId := ClientRegister(user, c)
|
clientId := ClientRegister(user, c)
|
||||||
|
Loading…
Reference in New Issue
Block a user