aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Program.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-09-09 21:16:40 -0500
committerGitHub <noreply@github.com>2021-09-09 21:16:40 -0500
commit583325356493c0123a6410e6aa34e60bf148f219 (patch)
treef12cc20285998bbdf5d3313c621429f8096c87ea /src/slskd/Program.cs
parent3d645132c2613bcd376ec710e6d1d02e9912cf15 (diff)
parenteae8db1aecdae631edc0f2d370d3c704d49c58b9 (diff)
downloadslskd-583325356493c0123a6410e6aa34e60bf148f219.tar.gz
Merge pull request #191 from slskd/version-check
Add a version check on startup, and elements to the UI to indicate when a new version is available
Diffstat (limited to 'src/slskd/Program.cs')
-rw-r--r--src/slskd/Program.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 4489487a..ec672f23 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -89,7 +89,7 @@ namespace slskd
/// <remarks>
/// Inaccurate when running locally.
/// </remarks>
- public static Version AssemblyVersion { get; } = Assembly.GetExecutingAssembly().GetName().Version;
+ public static Version AssemblyVersion { get; } = Assembly.GetExecutingAssembly().GetName().Version.Equals(new Version(1,0,0,0)) ? new Version(0, 0, 0, 0) : Assembly.GetExecutingAssembly().GetName().Version;
/// <summary>
/// Gets the informational version of the application, including the git sha at the latest commit.
@@ -97,7 +97,7 @@ namespace slskd
/// <remarks>
/// Inaccurate when running locally.
/// </remarks>
- public static string InformationalVersion { get; } = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
+ public static string InformationalVersion { get; } = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion == "1.0.0" ? "0.0.0" : Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
/// <summary>
/// Gets the unique Id of this application invocation.
@@ -114,6 +114,11 @@ namespace slskd
/// </summary>
public static string Version { get; } = $"{AssemblyVersion} ({InformationalVersion})";
+ /// <summary>
+ /// Gets a value indicating whether the current version is a Canary build.
+ /// </summary>
+ public static bool IsCanary { get; } = InformationalVersion.EndsWith("65534");
+
private static IConfigurationRoot Configuration { get; set; }
private static OptionsAtStartup OptionsAtStartup { get; } = new OptionsAtStartup();
@@ -209,7 +214,8 @@ namespace slskd
Log.Logger = (OptionsAtStartup.Debug ? new LoggerConfiguration().MinimumLevel.Debug() : new LoggerConfiguration().MinimumLevel.Information())
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
- .MinimumLevel.Override("slskd.API.Authentication.PassthroughAuthenticationHandler", LogEventLevel.Information)
+ .MinimumLevel.Override("System.Net.Http.HttpClient", OptionsAtStartup.Debug ? LogEventLevel.Warning : LogEventLevel.Fatal)
+ .MinimumLevel.Override("slskd.Authentication.PassthroughAuthenticationHandler", LogEventLevel.Warning)
.Enrich.WithProperty("Version", Version)
.Enrich.WithProperty("InstanceName", OptionsAtStartup.InstanceName)
.Enrich.WithProperty("InvocationId", InvocationId)