From f25a412a47c7e3296ea827ebd85987b8d6f3dd5c Mon Sep 17 00:00:00 2001 From: foogs Date: Thu, 26 Nov 2020 08:43:56 +0300 Subject: [PATCH] YOUR PRIVACY HAS BEEN DELETED --- .../Managers/MultiplayerManagerDedicated.cs | 11 +++++----- Torch/Commands/TorchCommands.cs | 21 ++++++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Torch.Server/Managers/MultiplayerManagerDedicated.cs b/Torch.Server/Managers/MultiplayerManagerDedicated.cs index a5ee65d..034c882 100644 --- a/Torch.Server/Managers/MultiplayerManagerDedicated.cs +++ b/Torch.Server/Managers/MultiplayerManagerDedicated.cs @@ -215,17 +215,16 @@ namespace Torch.Server.Managers //Largely copied from SE private void ValidateAuthTicketResponse(ulong steamId, JoinResult response, ulong steamOwner, string serviceName) - { - // TODO: Find another way to do this - //var state = new MyP2PSessionState(); - //MySteamServiceWrapper.Static.Peer2Peer.GetSessionState(steamId, ref state); - //var ip = new IPAddress(BitConverter.GetBytes(state.RemoteIP).Reverse().ToArray()); + { + var state = new MyP2PSessionState(); + Sandbox.Engine.Networking.MyGameService.Peer2Peer.GetSessionState(steamId, ref state); + var ip = new IPAddress(BitConverter.GetBytes(state.RemoteIP).Reverse().ToArray()); Torch.CurrentSession.KeenSession.PromotedUsers.TryGetValue(steamId, out MyPromoteLevel promoteLevel); _log.Debug($"ValidateAuthTicketResponse(user={steamId}, response={response}, owner={steamOwner}, permissions={promoteLevel})"); - _log.Info($"Connection attempt by {steamId}"); + _log.Info($"Connection attempt by {steamId} from {ip}"); if (IsProfiling(steamId)) { diff --git a/Torch/Commands/TorchCommands.cs b/Torch/Commands/TorchCommands.cs index f393a5a..4b4de2b 100644 --- a/Torch/Commands/TorchCommands.cs +++ b/Torch/Commands/TorchCommands.cs @@ -37,14 +37,19 @@ namespace Torch.Commands [Permission(MyPromoteLevel.None)] public void GetIP(ulong steamId = 0) { - Context.Respond("Command no longer working!"); - //if (steamId == 0) - // steamId = Context.Player.SteamUserId; - // - //VRage.GameServices.MyP2PSessionState statehack = new VRage.GameServices.MyP2PSessionState(); - //MySteamServiceWrapper.Static.Peer2Peer.GetSessionState(steamId, ref statehack); - //var ip = new IPAddress(BitConverter.GetBytes(statehack.RemoteIP).Reverse().ToArray()); - //Context.Respond($"Your IP is {ip}"); + if (steamId == 0) + { + steamId = Context.Player.SteamUserId; + } + else if (Context.Player.PromoteLevel <= MyPromoteLevel.Admin) + { + steamId = Context.Player.SteamUserId; + } + + var state = new VRage.GameServices.MyP2PSessionState(); + Sandbox.Engine.Networking.MyGameService.Peer2Peer.GetSessionState(steamId, ref state); + var ip = new IPAddress(BitConverter.GetBytes(state.RemoteIP).Reverse().ToArray()); + Context.Respond($"Your IP is {ip}"); } [Command("help", "Displays help for a command")]