diff --git a/CrystalConnector/Handlers/WebSocketHandler.cs b/CrystalConnector/Handlers/WebSocketHandler.cs index 49ed00d..c7f470c 100644 --- a/CrystalConnector/Handlers/WebSocketHandler.cs +++ b/CrystalConnector/Handlers/WebSocketHandler.cs @@ -29,10 +29,12 @@ public class WebSocketHandler if (!webSocket.GetConnectionInfo().Authenticated) { var secret = reader.ReadTextString(); + var name = reader.ReadTextString(); if (secret == Config.GetSecretKey()) { - Logger.LogInformation("Client {Id} authorized", webSocket.GetConnectionInfo().Id); + Logger.LogInformation("Client {Name}({Id}) authorized", name, webSocket.GetConnectionInfo().Id); webSocket.GetConnectionInfo().Authenticated = true; + webSocket.GetConnectionInfo().Name = name; await webSocket.Send(new S2CAuthenticatedPacket().Write); } else diff --git a/README.md b/README.md index 78b65ce..e91cd55 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ reader.ReadEndArray(); ``` > Authenticate > +> ``` 认证成功: @@ -58,5 +59,5 @@ reader.ReadEndArray();