diff --git a/build/Version.props b/build/Version.props
new file mode 100644
index 0000000000..68a795b9da
--- /dev/null
+++ b/build/Version.props
@@ -0,0 +1,7 @@
+
+
+ 4.0.1.4
+ 4.0.2
+ 4.0.3.0
+
+
diff --git a/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj b/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj
index ba131b26ce..f4a8f71249 100644
--- a/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj
+++ b/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj
@@ -1,8 +1,22 @@
+
netstandard2.0
Full
+ true
+ Cyberboss
+ /tg/station
+ API definitions for tgstation-server
+ LICENSE
+ tgs.ico
+ https://tgstation.github.io/tgstation-server
+ Git
+ https://github.com/tgstation/tgstation-server
+ 2018
+ json web api tgstation-server tgstation ss13 byond
+ Added ApiHeaders.RawUserAgent
+ $(TgsApiVersion)
../../build/analyzers.ruleset
latest
@@ -21,18 +35,16 @@
-
- all
- compile; build; native; contentfiles; analyzers
-
-
+
all
runtime; build; native; contentfiles; analyzers
-
+
+
+
diff --git a/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj b/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj
index 647a6ebe46..688664cfb2 100644
--- a/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj
+++ b/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj
@@ -1,9 +1,10 @@
-
+
+
netstandard2.0
Full
- 4.0.3.0
+ $(TgsClientVersion)
true
Cyberboss
/tg/station 13
@@ -13,8 +14,8 @@
https://github.com/tgstation/tgstation-server
Git
en-CA
- https://raw.githubusercontent.com/tgstation/tgstation-server/master/build/tgs.ico
- https://github.com/tgstation/tgstation-server/blob/master/LICENSE
+ LICENSE
+ tgs.ico
json web api tgstation-server tgstation ss13 byond client
Added the ability to change the Token of IServerClient
2018
@@ -40,7 +41,7 @@
compile; build; native; contentfiles; analyzers
-
+
all
runtime; build; native; contentfiles; analyzers
@@ -52,5 +53,7 @@
+
+
diff --git a/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj b/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj
index c29a5d688d..507129668e 100644
--- a/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj
+++ b/src/Tgstation.Server.Host.Console/Tgstation.Server.Host.Console.csproj
@@ -1,10 +1,11 @@
-
+
+
Exe
netcoreapp2.1
Full
- 4.0.1.4
+ $(TgsCoreVersion)
../../build/analyzers.ruleset
latest
diff --git a/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs b/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs
index dfc5c7f3e3..40d2c0f847 100644
Binary files a/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs and b/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs differ
diff --git a/src/Tgstation.Server.Host.Service/Properties/AssemblyInfo.cs b/src/Tgstation.Server.Host.Service/Properties/AssemblyInfo.cs
index 2b77d018db..d7c3dd8a1b 100644
--- a/src/Tgstation.Server.Host.Service/Properties/AssemblyInfo.cs
+++ b/src/Tgstation.Server.Host.Service/Properties/AssemblyInfo.cs
@@ -1,11 +1,3 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
-[assembly: AssemblyTitle("Tgstation.Server.Host.Service")]
-[assembly: ComVisible(false)]
-[assembly: Guid("29927416-3b78-49a7-a560-5ccaa638b6b4")]
-[assembly: InternalsVisibleTo("Tgstation.Server.Host.Service.Tests")]
-
-[assembly: AssemblyVersion("4.0.1.4")]
-[assembly: AssemblyFileVersion("4.0.1.4")]
+[assembly:InternalsVisibleTo("Tgstation.Server.Host.Service.Tests")]
diff --git a/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj b/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj
index 6bd52c6f69..fc30494bf2 100644
--- a/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj
+++ b/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj
@@ -1,116 +1,45 @@
-
-
-
+
+
+
- Debug
- AnyCPU
- {29927416-3B78-49A7-A560-5CCAA638B6B4}
- WinExe
- Tgstation.Server.Host.Service
- Tgstation.Server.Host.Service
- v4.7.1
- 512
- true
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
- latest
- 4
+ Exe
+ net471
+ win
+ Full
+ $(TgsCoreVersion)
../../build/analyzers.ruleset
- true
- AnyCPU
- prompt
-
+ latest
+ bin\Debug\Tgstation.Server.Host.Console.xml
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- bin\Debug\Tgstation.Server.Host.Service.xml
- SA1101;SA1121;SA1200;SA1202;SA1208;SA1400;SA1413;SA1501;SA1503;SA1519;SA1520;SA1623;SA1629;SA1633;SA1642
-
-
- pdbonly
- true
- bin\Release\
- TRACE
+
+
true
- bin\Release\Tgstation.Server.Host.Service.xml
- SA1101;SA1121;SA1200;SA1202;SA1208;SA1400;SA1413;SA1501;SA1503;SA1519;SA1520;SA1623;SA1629;SA1633;SA1642
+
-
- Tgstation.Server.Host.Service.Program
-
-
-
- ../../build/tgs.ico
+
+
+ 1701;1702;SA1652
+
-
-
-
-
- Component
-
-
-
-
- False
- Microsoft .NET Framework 4.7.1 %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
-
-
-
-
-
-
- {5d2d682c-6bf0-439c-850b-6ab945bbeaea}
- Tgstation.Server.Host.Watchdog
-
-
-
-
- 2.2.5
-
-
- all
- compile; build; native; contentfiles; analyzers
-
-
- 2.1.1
-
+
+
all
runtime; build; native; contentfiles; analyzers
+
-
- stylecop.json
-
+
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj b/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj
index 6bd413819f..eaf7347e67 100644
--- a/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj
+++ b/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj
@@ -1,10 +1,11 @@
+
netstandard2.0
Full
false
- 4.0.1.4
+ $(TgsCoreVersion)
../../build/analyzers.ruleset
latest
diff --git a/src/Tgstation.Server.Host.Watchdog/Watchdog.cs b/src/Tgstation.Server.Host.Watchdog/Watchdog.cs
index 9fce44bfbf..9f72e17de5 100644
--- a/src/Tgstation.Server.Host.Watchdog/Watchdog.cs
+++ b/src/Tgstation.Server.Host.Watchdog/Watchdog.cs
@@ -29,6 +29,32 @@ namespace Tgstation.Server.Host.Watchdog
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
+ string GetDotnetPath(bool isWindows)
+ {
+ var enviromentPath = Environment.GetEnvironmentVariable("PATH");
+ var paths = enviromentPath.Split(';');
+
+ var exeName = "dotnet";
+ IEnumerable enumerator;
+ if (isWindows)
+ {
+ exeName += ".exe";
+ enumerator = paths;
+ }
+ else
+ enumerator = paths.Select(x => x.Split(':')).SelectMany(x => x);
+
+ enumerator = enumerator.Select(x => Path.Combine(x, exeName));
+
+ return enumerator
+ .Where(x =>
+ {
+ logger.LogTrace("Checking for dotnet at {0}", x);
+ return File.Exists(x);
+ })
+ .FirstOrDefault();
+ }
+
///
#pragma warning disable CA1502 // TODO: Decomplexify
public async Task RunAsync(bool runConfigure, string[] args, CancellationToken cancellationToken)
@@ -38,30 +64,8 @@ namespace Tgstation.Server.Host.Watchdog
string updateDirectory = null;
try
{
- var enviromentPath = Environment.GetEnvironmentVariable("PATH");
- var paths = enviromentPath.Split(';');
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
-
- var exeName = "dotnet";
- IEnumerable enumerator;
- if (isWindows)
- {
- exeName += ".exe";
- enumerator = paths;
- }
- else
- enumerator = paths.Select(x => x.Split(':')).SelectMany(x => x);
-
- enumerator = enumerator.Select(x => Path.Combine(x, exeName));
-
- var dotnetPath = enumerator
- .Where(x =>
- {
- logger.LogTrace("Checking for dotnet at {0}", x);
- return File.Exists(x);
- })
- .FirstOrDefault();
-
+ var dotnetPath = GetDotnetPath(isWindows);
if (dotnetPath == default)
{
logger.LogCritical("Unable to locate dotnet executable in PATH! Please ensure the .NET Core runtime is installed and is in your PATH!");
@@ -126,7 +130,7 @@ namespace Tgstation.Server.Host.Watchdog
'"' + updateDirectory + '"'
};
- if (Environment.GetCommandLineArgs().Any(x => x == "--attach-host-debugger"))
+ if (Environment.GetCommandLineArgs().Any(x => x.Equals("--attach-host-debugger", StringComparison.OrdinalIgnoreCase)))
arguments.Add("--attach-debugger");
if (runConfigure)
diff --git a/src/Tgstation.Server.Host/ClientApp/package.json b/src/Tgstation.Server.Host/ClientApp/package.json
index fc8ab6e698..407902f50f 100644
--- a/src/Tgstation.Server.Host/ClientApp/package.json
+++ b/src/Tgstation.Server.Host/ClientApp/package.json
@@ -5,7 +5,7 @@
"tgstation-server-control-panel": "0.1.6"
},
"scripts": {
- "build": "npm run clean && tslint -p tsconfig.json && react-scripts build && cp-cli node_modules/tgstation-server-control-panel/build/public/ build/ && cp-cli ../../../build/tgs.ico build/favicon.ico && minify-json build && rimraf ../wwwroot && move-cli build ../wwwroot",
+ "msbuild": "npm run clean && tslint -p tsconfig.json && react-scripts build && cp-cli node_modules/tgstation-server-control-panel/build/public/ build/ && cp-cli ../../../build/tgs.ico build/favicon.ico && minify-json build && rimraf ../wwwroot && move-cli build ../wwwroot",
"clean": "rimraf build"
},
"devDependencies": {
diff --git a/src/Tgstation.Server.Host/Controllers/AdministrationController.cs b/src/Tgstation.Server.Host/Controllers/AdministrationController.cs
index 605be61107..61198121f6 100644
--- a/src/Tgstation.Server.Host/Controllers/AdministrationController.cs
+++ b/src/Tgstation.Server.Host/Controllers/AdministrationController.cs
@@ -98,6 +98,58 @@ namespace Tgstation.Server.Host.Controllers
return StatusCode(429);
}
+ ///
+ /// Try to download and apply an update with a given .
+ ///
+ /// The version of the server to update to.
+ /// The for the operation.
+ /// A resulting in the of the operation.
+ async Task CheckReleasesAndApplyUpdate(Version newVersion, CancellationToken cancellationToken)
+ {
+ Logger.LogDebug("Looking for GitHub releases version {0}...", newVersion);
+ IEnumerable releases;
+ try
+ {
+ var gitHubClient = GetGitHubClient();
+ releases = await gitHubClient
+ .Repository
+ .Release
+ .GetAll(updatesConfiguration.GitHubRepositoryId)
+ .WithToken(cancellationToken)
+ .ConfigureAwait(false);
+ }
+ catch (RateLimitExceededException e)
+ {
+ return RateLimit(e);
+ }
+ catch (ApiException e)
+ {
+ Logger.LogWarning(OctokitException, e);
+ return StatusCode((int)HttpStatusCode.FailedDependency);
+ }
+
+ releases = releases.Where(x => x.TagName.StartsWith(updatesConfiguration.GitTagPrefix, StringComparison.InvariantCulture));
+
+ Logger.LogTrace("Release query complete!");
+
+ foreach (var release in releases)
+ if (Version.TryParse(release.TagName.Replace(updatesConfiguration.GitTagPrefix, String.Empty, StringComparison.Ordinal), out var version) && version == newVersion)
+ {
+ var asset = release.Assets.Where(x => x.Name.Equals(updatesConfiguration.UpdatePackageAssetName, StringComparison.Ordinal)).FirstOrDefault();
+ if (asset == default)
+ continue;
+
+ if (!serverUpdater.ApplyUpdate(version, new Uri(asset.BrowserDownloadUrl), ioManager))
+ return Conflict(new ErrorMessage
+ {
+ Message = "An update operation is already in progress!"
+ });
+ return Accepted(); // gtfo of here before all the cancellation tokens fire
+ }
+
+ return StatusCode((int)HttpStatusCode.Gone);
+ }
+
IGitHubClient GetGitHubClient() => String.IsNullOrEmpty(generalConfiguration.GitHubAccessToken) ? gitHubClientFactory.CreateClient() : gitHubClientFactory.CreateClient(generalConfiguration.GitHubAccessToken);
///
@@ -163,41 +215,7 @@ namespace Tgstation.Server.Host.Controllers
Message = RestartNotSupportedException
});
- Logger.LogDebug("Looking for GitHub releases version {0}...", model.NewVersion);
- IEnumerable releases;
- try
- {
- var gitHubClient = GetGitHubClient();
- releases = (await gitHubClient.Repository.Release.GetAll(updatesConfiguration.GitHubRepositoryId).ConfigureAwait(false)).Where(x => x.TagName.StartsWith(updatesConfiguration.GitTagPrefix, StringComparison.InvariantCulture));
- cancellationToken.ThrowIfCancellationRequested();
- }
- catch (RateLimitExceededException e)
- {
- return RateLimit(e);
- }
- catch (ApiException e)
- {
- Logger.LogWarning(OctokitException, e);
- return StatusCode((int)HttpStatusCode.FailedDependency);
- }
-
- Logger.LogTrace("Release query complete!");
- foreach (var release in releases)
- if (Version.TryParse(release.TagName.Replace(updatesConfiguration.GitTagPrefix, String.Empty, StringComparison.Ordinal), out var version) && version == model.NewVersion)
- {
- var asset = release.Assets.Where(x => x.Name == updatesConfiguration.UpdatePackageAssetName).FirstOrDefault();
- if (asset == default)
- continue;
-
- if (!serverUpdater.ApplyUpdate(version, new Uri(asset.BrowserDownloadUrl), ioManager))
- return Conflict(new ErrorMessage
- {
- Message = "An update operation is already in progress!"
- });
- return Accepted(); // gtfo of here before all the cancellation tokens fire
- }
-
- return StatusCode((int)HttpStatusCode.Gone);
+ return await CheckReleasesAndApplyUpdate(model.NewVersion, cancellationToken).ConfigureAwait(false);
}
///
diff --git a/src/Tgstation.Server.Host/Core/TaskExtensions.cs b/src/Tgstation.Server.Host/Core/TaskExtensions.cs
new file mode 100644
index 0000000000..fb1b825313
--- /dev/null
+++ b/src/Tgstation.Server.Host/Core/TaskExtensions.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Tgstation.Server.Host.Core
+{
+ ///
+ /// Extensions for the .
+ ///
+ static class TaskExtensions
+ {
+ ///
+ /// Create a that can be awaited while respecting a given .
+ ///
+ /// The to add cancel support to.
+ /// The for the operation.
+ /// A representing the running operation.
+ public static Task WithToken(this Task task, CancellationToken cancellationToken)
+ {
+ if (task == null)
+ throw new ArgumentNullException(nameof(task));
+
+ async Task