mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 08:00:19 +01:00
Merge branch 'master' into dev
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
||||
<Import Project="ControlPanelVersion.props" />
|
||||
<PropertyGroup>
|
||||
<TgsCoreVersion>5.1.0</TgsCoreVersion>
|
||||
<TgsConfigVersion>4.2.0</TgsConfigVersion>
|
||||
<TgsConfigVersion>4.3.0</TgsConfigVersion>
|
||||
<TgsApiVersion>9.6.0</TgsApiVersion>
|
||||
<TgsApiLibraryVersion>10.0.0</TgsApiLibraryVersion>
|
||||
<TgsClientVersion>11.0.0</TgsClientVersion>
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
readonly IProcessExecutor processExecutor;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="GeneralConfiguration"/> for the <see cref="WindowsByondInstaller"/>.
|
||||
/// </summary>
|
||||
readonly GeneralConfiguration generalConfiguration;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="SemaphoreSlim"/> for the <see cref="WindowsByondInstaller"/>.
|
||||
/// </summary>
|
||||
@@ -69,12 +77,14 @@ namespace Tgstation.Server.Host.Components.Byond
|
||||
/// Initializes a new instance of the <see cref="WindowsByondInstaller"/> class.
|
||||
/// </summary>
|
||||
/// <param name="processExecutor">The value of <see cref="processExecutor"/>.</param>
|
||||
/// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
|
||||
/// <param name="ioManager">The <see cref="IIOManager"/> for the <see cref="ByondInstallerBase"/>.</param>
|
||||
/// <param name="logger">The <see cref="ILogger"/> for the <see cref="ByondInstallerBase"/>.</param>
|
||||
public WindowsByondInstaller(IProcessExecutor processExecutor, IIOManager ioManager, ILogger<WindowsByondInstaller> logger)
|
||||
public WindowsByondInstaller(IProcessExecutor processExecutor, IIOManager ioManager, IOptions<GeneralConfiguration> generalConfigurationOptions, ILogger<WindowsByondInstaller> 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
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Task InstallByond(string path, Version version, CancellationToken cancellationToken)
|
||||
=> Task.WhenAll(
|
||||
{
|
||||
var tasks = new List<Task>
|
||||
{
|
||||
SetNoPromptTrusted(path, cancellationToken),
|
||||
InstallDirectX(path, cancellationToken),
|
||||
AddDreamDaemonToFirewall(path, cancellationToken));
|
||||
};
|
||||
|
||||
if (!generalConfiguration.SkipAddingByondFirewallException)
|
||||
tasks.Add(AddDreamDaemonToFirewall(path, cancellationToken));
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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));
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -111,6 +111,11 @@ namespace Tgstation.Server.Host.Configuration
|
||||
/// </summary>
|
||||
public bool HostApiDocumentation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the netsh.exe execution to exempt DreamDaemon from Windows firewall should be skipped.
|
||||
/// </summary>
|
||||
public bool SkipAddingByondFirewallException { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GeneralConfiguration"/> class.
|
||||
/// </summary>
|
||||
@@ -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)
|
||||
|
||||
@@ -11,6 +11,7 @@ General:
|
||||
InstanceLimit: 10
|
||||
ValidInstancePaths:
|
||||
HostApiDocumentation: false
|
||||
SkipAddingByondFirewallException: false
|
||||
Session:
|
||||
HighPriorityLiveDreamDaemon: false
|
||||
LowPriorityDeploymentProcesses: true
|
||||
|
||||
@@ -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<IOptions<GeneralConfiguration>>();
|
||||
generalConfigOptionsMock.SetupGet(x => x.Value).Returns(new GeneralConfiguration());
|
||||
|
||||
var byondInstaller = new PlatformIdentifier().IsWindows
|
||||
? (IByondInstaller)new WindowsByondInstaller(
|
||||
Mock.Of<IProcessExecutor>(),
|
||||
new DefaultIOManager(new AssemblyInformationProvider()),
|
||||
generalConfigOptionsMock.Object,
|
||||
Mock.Of<ILogger<WindowsByondInstaller>>())
|
||||
: new PosixByondInstaller(
|
||||
Mock.Of<IPostWriteHandler>(),
|
||||
|
||||
Reference in New Issue
Block a user