aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-09-08 09:13:53 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-09-08 09:13:53 -0500
commit4407fadc62b4edbe51854aa94b74b990b88e8316 (patch)
tree721959044153492a92002454a046a97ef209bc10 /src
parent161f3517d703658bf296282a2e9fab44f9149134 (diff)
downloadslskd-4407fadc62b4edbe51854aa94b74b990b88e8316.tar.gz
remove old version check
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application/Management/IManagementService.cs6
-rw-r--r--src/slskd/Application/Management/ManagementService.cs49
-rw-r--r--src/slskd/Program.cs10
3 files changed, 1 insertions, 64 deletions
diff --git a/src/slskd/Application/Management/IManagementService.cs b/src/slskd/Application/Management/IManagementService.cs
index ba5ba69a..9a06d961 100644
--- a/src/slskd/Application/Management/IManagementService.cs
+++ b/src/slskd/Application/Management/IManagementService.cs
@@ -58,11 +58,5 @@ namespace slskd.Management
/// </summary>
/// <returns>The operation context.</returns>
Task RescanSharesAsync();
-
- /// <summary>
- /// Gets the version of the latest application release.
- /// </summary>
- /// <returns>The operation context.</returns>
- Task CheckVersionAsync();
}
} \ No newline at end of file
diff --git a/src/slskd/Application/Management/ManagementService.cs b/src/slskd/Application/Management/ManagementService.cs
index 0aff7658..4319c9e3 100644
--- a/src/slskd/Application/Management/ManagementService.cs
+++ b/src/slskd/Application/Management/ManagementService.cs
@@ -20,9 +20,6 @@ using Microsoft.Extensions.Options;
namespace slskd.Management
{
using System;
- using System.Net.Http;
- using System.Net.Http.Json;
- using System.Text.Json;
using System.Threading.Tasks;
using Serilog;
using Soulseek;
@@ -39,22 +36,18 @@ namespace slskd.Management
/// <param name="applicationStateMonitor">The state monitor for application service state.</param>
/// <param name="soulseekClient">The Soulseek client.</param>
/// <param name="sharedFileCache">The shared file cache.</param>
- /// <param name="httpClientFactory">The HttpClientFactory to use.</param>
public ManagementService(
IOptionsMonitor<Options> optionsMonitor,
IStateMonitor<ApplicationState> applicationStateMonitor,
ISoulseekClient soulseekClient,
- ISharedFileCache sharedFileCache,
- IHttpClientFactory httpClientFactory)
+ ISharedFileCache sharedFileCache)
{
OptionsMonitor = optionsMonitor;
ApplicationStateMonitor = applicationStateMonitor;
Client = soulseekClient;
SharedFileCache = sharedFileCache;
- HttpClientFactory = httpClientFactory;
}
- private IHttpClientFactory HttpClientFactory { get; }
private ILogger Log { get; } = Serilog.Log.ForContext<ManagementService>();
/// <summary>
@@ -105,45 +98,5 @@ namespace slskd.Management
/// </summary>
/// <returns>The operation context.</returns>
public Task RescanSharesAsync() => SharedFileCache.FillAsync();
-
- /// <summary>
- /// Gets the version of the latest application release.
- /// </summary>
- /// <returns>The operation context.</returns>
- public async Task CheckVersionAsync()
- {
- if (Program.InformationalVersion.EndsWith("65534"))
- {
- Log.Information("Skipping version check for Canary build; check for updates manually.");
- }
-
- try
- {
- using var http = HttpClientFactory.CreateClient();
- http.DefaultRequestHeaders.UserAgent.TryParseAdd(Program.AppName + Program.Version);
-
- Log.Information("Checking {LatestReleaseUrl} for latest version", Program.RepositoryAPILatestReleaseUrl);
-
- var response = await http.GetFromJsonAsync<JsonDocument>(Program.RepositoryAPILatestReleaseUrl);
- var latestVersion = Version.Parse(response.RootElement.GetProperty("tag_name").GetString());
- var currentVersion = Version.Parse(Program.InformationalVersion);
-
- if (latestVersion > currentVersion)
- {
- ApplicationStateMonitor.SetValue(state => state with { LatestVersion = latestVersion.ToString(), UpdateAvailable = true });
- Log.Information("A new version is available! {CurrentVersion} -> {LatestVersion}", currentVersion, latestVersion);
- }
- else
- {
- Log.Information("Version {Version} is up to date.", currentVersion);
- }
-
- }
- catch (Exception ex)
- {
- Log.Warning("Failed to check version: {Message}", ex.Message);
- throw;
- }
- }
}
} \ No newline at end of file
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index ab14ab9e..529388a1 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -119,16 +119,6 @@ namespace slskd
/// </summary>
public static bool IsCanary { get; } = InformationalVersion.EndsWith("65534");
- /// <summary>
- /// Gets the API url for the application repository.
- /// </summary>
- public static string RepositoryAPIUrl { get; } = "https://api.github.com/repos/slskd/slskd";
-
- /// <summary>
- /// Gets the API url for the latest application release.
- /// </summary>
- public static string RepositoryAPILatestReleaseUrl { get; } = $"{RepositoryAPIUrl}/releases/latest";
-
private static IConfigurationRoot Configuration { get; set; }
private static OptionsAtStartup OptionsAtStartup { get; } = new OptionsAtStartup();