diff --git a/build/Version.props b/build/Version.props index 2376c6c4e1..7c313bb4f2 100644 --- a/build/Version.props +++ b/build/Version.props @@ -4,7 +4,7 @@ 5.1.0 - 4.2.0 + 4.3.0 9.6.0 10.0.0 11.0.0 diff --git a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs index 2368aa2af6..678e12347f 100644 --- a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs @@ -1,11 +1,14 @@ using System; +using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Tgstation.Server.Api.Models; +using Tgstation.Server.Host.Configuration; using Tgstation.Server.Host.Core; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Jobs; @@ -55,6 +58,11 @@ namespace Tgstation.Server.Host.Components.Byond /// readonly IProcessExecutor processExecutor; + /// + /// The for the . + /// + readonly GeneralConfiguration generalConfiguration; + /// /// The for the . /// @@ -69,12 +77,14 @@ namespace Tgstation.Server.Host.Components.Byond /// Initializes a new instance of the class. /// /// The value of . + /// The containing the value of . /// The for the . /// The for the . - public WindowsByondInstaller(IProcessExecutor processExecutor, IIOManager ioManager, ILogger logger) + public WindowsByondInstaller(IProcessExecutor processExecutor, IIOManager ioManager, IOptions generalConfigurationOptions, ILogger logger) : base(ioManager, logger) { this.processExecutor = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor)); + generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions)); PathToUserByondFolder = IOManager.ResolvePath(IOManager.ConcatPath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BYOND")); @@ -87,10 +97,18 @@ namespace Tgstation.Server.Host.Components.Byond /// public override Task InstallByond(string path, Version version, CancellationToken cancellationToken) - => Task.WhenAll( + { + var tasks = new List + { SetNoPromptTrusted(path, cancellationToken), InstallDirectX(path, cancellationToken), - AddDreamDaemonToFirewall(path, cancellationToken)); + }; + + if (!generalConfiguration.SkipAddingByondFirewallException) + tasks.Add(AddDreamDaemonToFirewall(path, cancellationToken)); + + return Task.WhenAll(tasks); + } /// /// Creates the BYOND cfg file that prevents the trusted mode dialog from appearing when launching DreamDaemon. @@ -104,7 +122,7 @@ namespace Tgstation.Server.Host.Components.Byond await IOManager.CreateDirectory(configPath, cancellationToken); var configFilePath = IOManager.ConcatPath(configPath, ByondDreamDaemonConfigFilename); - Logger.LogTrace("Disabling trusted prompts in {0}...", configFilePath); + Logger.LogTrace("Disabling trusted prompts in {configFilePath}...", configFilePath); await IOManager.WriteAllBytes( configFilePath, Encoding.UTF8.GetBytes(ByondNoPromptTrustedMode), @@ -186,7 +204,7 @@ namespace Tgstation.Server.Host.Components.Byond cancellationToken.ThrowIfCancellationRequested(); Logger.LogDebug( - "netsh.exe output:{0}{1}", + "netsh.exe output:{newLine}{output}", Environment.NewLine, await netshProcess.GetCombinedOutput(cancellationToken)); diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index 57125c0e1d..f89d57e9f1 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -527,9 +527,12 @@ namespace Tgstation.Server.Host.Components.Chat.Providers var shouldNotAnswer = !pm; if (shouldNotAnswer) lock (mappedChannels) - shouldNotAnswer = !mappedChannels.Contains(messageCreateEvent.ChannelID.Value); + shouldNotAnswer = !mappedChannels.Contains(messageCreateEvent.ChannelID.Value) && !mappedChannels.Contains(0); - var content = NormalizeMentions(messageCreateEvent.Content); + var refreshedMessage = !String.IsNullOrWhiteSpace(messageCreateEvent.Content) + ? messageCreateEvent + : (await channelsClient.GetChannelMessageAsync(messageCreateEvent.ChannelID, messageCreateEvent.ID, cancellationToken)).Entity; + var content = NormalizeMentions(refreshedMessage.Content); var mentionedUs = messageCreateEvent.Mentions.Any(x => x.ID == currentUserId) || (!shouldNotAnswer && content.Split(' ').First().Equals(ChatManager.CommonMention, StringComparison.OrdinalIgnoreCase)); diff --git a/src/Tgstation.Server.Host/Components/Repository/Repository.cs b/src/Tgstation.Server.Host/Components/Repository/Repository.cs index 4d20f4be52..f2d808bfc0 100644 --- a/src/Tgstation.Server.Host/Components/Repository/Repository.cs +++ b/src/Tgstation.Server.Host/Components/Repository/Repository.cs @@ -196,7 +196,7 @@ namespace Tgstation.Server.Host.Components.Repository var commitMessage = String.Format( CultureInfo.InvariantCulture, - "TGS Test merge #{0}{1}{2}", + "TGS Test Merge (#{0}){1}{2}", testMergeParameters.Number, testMergeParameters.Comment != null ? Environment.NewLine diff --git a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs index d7a1a91f06..7be48930ed 100644 --- a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs +++ b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs @@ -111,6 +111,11 @@ namespace Tgstation.Server.Host.Configuration /// public bool HostApiDocumentation { get; set; } + /// + /// If the netsh.exe execution to exempt DreamDaemon from Windows firewall should be skipped. + /// + public bool SkipAddingByondFirewallException { get; set; } + /// /// Initializes a new instance of the class. /// @@ -133,7 +138,7 @@ namespace Tgstation.Server.Host.Configuration if (ConfigVersion == null) logger.LogCritical( - "No `ConfigVersion` specified, your configuration may be out of date! The current version is \"{0}\"", + "No `ConfigVersion` specified, your configuration may be out of date! The current version is \"{currentVersion}\"", CurrentConfigVersion); else if (ConfigVersion != CurrentConfigVersion) if (ConfigVersion.Major != CurrentConfigVersion.Major) diff --git a/src/Tgstation.Server.Host/appsettings.yml b/src/Tgstation.Server.Host/appsettings.yml index ebab1c2470..3fb8ebb675 100644 --- a/src/Tgstation.Server.Host/appsettings.yml +++ b/src/Tgstation.Server.Host/appsettings.yml @@ -11,6 +11,7 @@ General: InstanceLimit: 10 ValidInstancePaths: HostApiDocumentation: false + SkipAddingByondFirewallException: false Session: HighPriorityLiveDreamDaemon: false LowPriorityDeploymentProcesses: true diff --git a/tests/Tgstation.Server.Tests/Instance/ByondTest.cs b/tests/Tgstation.Server.Tests/Instance/ByondTest.cs index a1dc699d70..db83ca4ad3 100644 --- a/tests/Tgstation.Server.Tests/Instance/ByondTest.cs +++ b/tests/Tgstation.Server.Tests/Instance/ByondTest.cs @@ -1,5 +1,6 @@ using Castle.Core.Logging; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System; @@ -13,6 +14,7 @@ using Tgstation.Server.Api.Models.Request; using Tgstation.Server.Client; using Tgstation.Server.Client.Components; using Tgstation.Server.Host.Components.Byond; +using Tgstation.Server.Host.Configuration; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.System; @@ -87,10 +89,14 @@ namespace Tgstation.Server.Tests.Instance async Task TestCustomInstalls(CancellationToken cancellationToken) { + var generalConfigOptionsMock = new Mock>(); + generalConfigOptionsMock.SetupGet(x => x.Value).Returns(new GeneralConfiguration()); + var byondInstaller = new PlatformIdentifier().IsWindows ? (IByondInstaller)new WindowsByondInstaller( Mock.Of(), new DefaultIOManager(new AssemblyInformationProvider()), + generalConfigOptionsMock.Object, Mock.Of>()) : new PosixByondInstaller( Mock.Of(),