diff --git a/Torch.API/WebAPI/PluginQuery.cs b/Torch.API/WebAPI/PluginQuery.cs index a13e5a8..61dcf6a 100644 --- a/Torch.API/WebAPI/PluginQuery.cs +++ b/Torch.API/WebAPI/PluginQuery.cs @@ -142,10 +142,11 @@ namespace Torch.API.WebAPI public class PluginItem { public string ID; - public string Name; + public string Name { get; set; } public string Author; public string Description; public string LatestVersion; + public bool Installed { get; set; } = false; public override string ToString() { diff --git a/Torch.Server/Initializer.cs b/Torch.Server/Initializer.cs index eb661a3..c88e617 100644 --- a/Torch.Server/Initializer.cs +++ b/Torch.Server/Initializer.cs @@ -55,6 +55,8 @@ quit"; #if !DEBUG AppDomain.CurrentDomain.UnhandledException += HandleException; + LogManager.Configuration.AddRule(LogLevel.Info, LogLevel.Fatal, "console"); + LogManager.ReconfigExistingLoggers(); #endif #if DEBUG diff --git a/Torch.Server/Managers/InstanceManager.cs b/Torch.Server/Managers/InstanceManager.cs index 6d71931..706b81f 100644 --- a/Torch.Server/Managers/InstanceManager.cs +++ b/Torch.Server/Managers/InstanceManager.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using Havok; using NLog; +using Sandbox; using Sandbox.Engine.Networking; using Sandbox.Engine.Utils; using Sandbox.Game; @@ -56,17 +57,19 @@ namespace Torch.Server.Managers //Initializes saves path. Why this isn't in Init() we may never know. MyFileSystem.InitUserSpecific(null); - var configPath = Path.Combine(path, CONFIG_NAME); - if (!File.Exists(configPath)) - { - Log.Error($"Failed to load dedicated config at {path}"); - return; - } + // why?.... + // var configPath = Path.Combine(path, CONFIG_NAME); + // if (!File.Exists(configPath)) + // { + // Log.Error($"Failed to load dedicated config at {path}"); + // return; + // } - var config = new MyConfigDedicated(configPath); - config.Load(configPath); + + // var config = new MyConfigDedicated(configPath); + // config.Load(configPath); - DedicatedConfig = new ConfigDedicatedViewModel(config); + DedicatedConfig = new ConfigDedicatedViewModel((MyConfigDedicated) MySandboxGame.ConfigDedicated); var worldFolders = Directory.EnumerateDirectories(Path.Combine(Torch.Config.InstancePath, "Saves")); diff --git a/Torch.Server/Managers/MultiplayerManagerDedicated.cs b/Torch.Server/Managers/MultiplayerManagerDedicated.cs index 034c882..6cc1149 100644 --- a/Torch.Server/Managers/MultiplayerManagerDedicated.cs +++ b/Torch.Server/Managers/MultiplayerManagerDedicated.cs @@ -134,13 +134,21 @@ namespace Torch.Server.Managers public override void Attach() { base.Attach(); - _gameServerValidateAuthTicketReplacer = _gameServerValidateAuthTicketFactory.Invoke(); - _gameServerUserGroupStatusReplacer = _gameServerUserGroupStatusFactory.Invoke(); + if (Torch.Config.UgcServiceType == UGCServiceType.Steam) + { + _gameServerValidateAuthTicketReplacer = _gameServerValidateAuthTicketFactory.Invoke(); + _gameServerUserGroupStatusReplacer = _gameServerUserGroupStatusFactory.Invoke(); + } + else + { + _gameServerValidateAuthTicketReplacer = _eosServerValidateAuthTicketFactory.Invoke(); + _gameServerUserGroupStatusReplacer = _eosServerUserGroupStatusFactory.Invoke(); + } _gameServerValidateAuthTicketReplacer.Replace( new Action(ValidateAuthTicketResponse), MyGameService.GameServer); _gameServerUserGroupStatusReplacer.Replace(new Action(UserGroupStatusResponse), MyGameService.GameServer); - _log.Info("Inserted steam authentication intercept"); + _log.Info("Inserted authentication intercept"); } /// @@ -150,7 +158,7 @@ namespace Torch.Server.Managers _gameServerValidateAuthTicketReplacer.Restore(MyGameService.GameServer); if (_gameServerUserGroupStatusReplacer != null && _gameServerUserGroupStatusReplacer.Replaced) _gameServerUserGroupStatusReplacer.Restore(MyGameService.GameServer); - _log.Info("Removed steam authentication intercept"); + _log.Info("Removed authentication intercept"); base.Detach(); } @@ -163,6 +171,14 @@ namespace Torch.Server.Managers [ReflectedEventReplace("VRage.Steam.MySteamGameServer, VRage.Steam", "UserGroupStatusResponse", typeof(MyDedicatedServerBase), "GameServer_UserGroupStatus")] private static Func _gameServerUserGroupStatusFactory; + + [ReflectedEventReplace("VRage.EOS.MyEOSGameServer, VRage.EOS", "ValidateAuthTicketResponse", + typeof(MyDedicatedServerBase), "GameServer_ValidateAuthTicketResponse")] + private static Func _eosServerValidateAuthTicketFactory; + + [ReflectedEventReplace("VRage.EOS.MyEOSGameServer, VRage.EOS", "UserGroupStatusResponse", + typeof(MyDedicatedServerBase), "GameServer_UserGroupStatus")] + private static Func _eosServerUserGroupStatusFactory; private ReflectedEventReplacer _gameServerValidateAuthTicketReplacer; private ReflectedEventReplacer _gameServerUserGroupStatusReplacer; @@ -231,12 +247,6 @@ namespace Torch.Server.Managers _log.Warn($"Rejecting user {steamId} for using Profiler/ModSDK!"); UserRejected(steamId, JoinResult.ProfilingNotAllowed); } - - if (Players.ContainsKey(steamId)) - { - _log.Warn($"Player {steamId} has already joined!"); - UserRejected(steamId, JoinResult.AlreadyJoined); - } else if (Torch.CurrentSession.KeenSession.OnlineMode == MyOnlineModeEnum.OFFLINE && promoteLevel < MyPromoteLevel.Admin) { @@ -311,6 +321,11 @@ namespace Torch.Server.Managers _log.Error(task.Exception, $"Future validation verdict faulted"); verdict = JoinResult.TicketCanceled; } + else if (Players.ContainsKey(info.SteamID)) + { + _log.Warn($"Player {info.SteamID} has already joined!"); + verdict = JoinResult.AlreadyJoined; + } else verdict = task.Result; diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index ed48101..2f0d9eb 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -291,6 +291,9 @@ PluginBrowser.xaml + + PluginDownloader.xaml + RoleEditor.xaml @@ -462,6 +465,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -526,4 +533,4 @@ copy "$(SolutionDir)NLog.config" "$(TargetDir)" & copy "$(SolutionDir)NLog-user.config" "$(TargetDir)" - \ No newline at end of file + diff --git a/Torch.Server/ViewModels/ModItemInfo.cs b/Torch.Server/ViewModels/ModItemInfo.cs index 9212fa1..1b78d96 100644 --- a/Torch.Server/ViewModels/ModItemInfo.cs +++ b/Torch.Server/ViewModels/ModItemInfo.cs @@ -7,8 +7,10 @@ using System.Threading.Tasks; using System.Windows.Threading; using System.Runtime.CompilerServices; using NLog; +using Sandbox.Engine.Networking; using VRage.Game; using Torch.Server.Annotations; +using Torch.Utils; using Torch.Utils.SteamWorkshopTools; namespace Torch.Server.ViewModels @@ -84,6 +86,15 @@ namespace Torch.Server.ViewModels } } + public string UgcService + { + get { return _modItem.PublishedServiceName; } + set + { + SetValue(ref _modItem.PublishedServiceName, value); + } + } + /// /// Constructor, returns a new ModItemInfo instance /// @@ -101,6 +112,9 @@ namespace Torch.Server.ViewModels /// public async Task UpdateModInfoAsync() { + if (UgcService.ToLower() == "mod.io") + return true; + var msg = ""; var workshopService = WebAPI.Instance; PublishedItemDetails modInfo = null; @@ -127,5 +141,10 @@ namespace Torch.Server.ViewModels return true; } } + + public override string ToString() + { + return $"{PublishedFileId}-{UgcService}"; + } } } diff --git a/Torch.Server/Views/ConfigControl.xaml.cs b/Torch.Server/Views/ConfigControl.xaml.cs index dc94cc0..f16b980 100644 --- a/Torch.Server/Views/ConfigControl.xaml.cs +++ b/Torch.Server/Views/ConfigControl.xaml.cs @@ -133,6 +133,10 @@ namespace Torch.Server.Views var d = new RoleEditor(); var w = _instanceManager.DedicatedConfig.SelectedWorld; + if(w.Checkpoint.PromotedUsers == null) { + w.Checkpoint.PromotedUsers = new VRage.Serialization.SerializableDictionary(); + } + if (w == null) { MessageBox.Show("A world is not selected."); diff --git a/Torch.Server/Views/ModListControl.xaml b/Torch.Server/Views/ModListControl.xaml index 11969ab..b24ec07 100644 --- a/Torch.Server/Views/ModListControl.xaml +++ b/Torch.Server/Views/ModListControl.xaml @@ -103,6 +103,7 @@ + @@ -115,10 +116,11 @@ VerticalAlignment="Center" Grid.Column="0" Grid.Row="1"/> -