diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-03-15 18:46:38 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-03-15 18:46:38 -0500 |
| commit | c6d5d8eb687d0256293e0b4406716713d3a6b148 (patch) | |
| tree | 0e6c6c0e0545cfacbc9a334bfba5e0443766f5c0 | |
| parent | 4f511b1946953d2229f5ebb6fcb0ba47358d4db7 (diff) | |
| parent | 92c5d4c6b30075451a0a85e28981e794964c48d1 (diff) | |
| download | slskd-c6d5d8eb687d0256293e0b4406716713d3a6b148.tar.gz | |
Merge remote-tracking branch 'origin/master' into retries
| -rw-r--r-- | config/slskd.example.yml | 4 | ||||
| -rw-r--r-- | src/slskd/Application.cs | 11 | ||||
| -rw-r--r-- | src/slskd/Core/ConnectionWatchdog.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Core/Options.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Integrations/FTP/FTPClientFactory.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Integrations/FTP/FTPService.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Integrations/Pushbullet/PushbulletService.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Integrations/Scripts/ScriptService.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Integrations/VPN/Clients/Gluetun.cs | 6 | ||||
| -rw-r--r-- | src/slskd/Integrations/VPN/VPNService.cs | 8 | ||||
| -rw-r--r-- | src/slskd/Integrations/Webhooks/WebhookService.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Program.cs | 10 | ||||
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 2 |
13 files changed, 34 insertions, 31 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 00b984a2..752a8201 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -106,7 +106,7 @@ # queued: # files: 15 # megabytes: 150 -# daily: +# daily: # files: 30 # megabytes: 300 # failures: 10 @@ -235,7 +235,7 @@ # port: ~ # username: ~ # password: ~ -# integration: +# integrations: # vpn: # enabled: false # port_forwarding: false diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 2e9639c6..5a81ae8f 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -1068,7 +1068,7 @@ namespace slskd Messaging.Conversations.HandleMessageAsync(args.Username, PrivateMessage.FromEventArgs(args)); - if (Options.Integration.Pushbullet.Enabled && !args.Replayed) + if (Options.Integrations.Pushbullet.Enabled && !args.Replayed) { _ = Pushbullet.PushAsync($"Private Message from {args.Username}", args.Username, args.Message); } @@ -1086,7 +1086,7 @@ namespace slskd var message = RoomMessage.FromEventArgs(args, DateTime.UtcNow); - if (Options.Integration.Pushbullet.Enabled && message.Message.Contains(Client.Username)) + if (Options.Integrations.Pushbullet.Enabled && message.Message.Contains(Client.Username)) { _ = Pushbullet.PushAsync($"Room Mention by {message.Username} in {message.RoomName}", message.RoomName, message.Message); } @@ -1482,9 +1482,12 @@ namespace slskd // determine whether any Soulseek options changed. if so, we need to construct a patch and invoke ReconfigureOptionsAsync(). var slskDiff = PreviousOptions.Soulseek.DiffWith(newOptions.Soulseek); - var globalDiff = PreviousOptions.Transfers.DiffWith(newOptions.Transfers); - if (slskDiff.Any() || globalDiff.Any()) + // determine whether any global upload or download options changed + var transfersUploadDiff = PreviousOptions.Transfers.DiffWith(newOptions.Transfers.Upload); + var transfersDownloadDiff = PreviousOptions.Transfers.DiffWith(newOptions.Transfers.Download); + + if (slskDiff.Any() || transfersUploadDiff.Any() || transfersDownloadDiff.Any()) { var old = PreviousOptions.Soulseek; var update = newOptions.Soulseek; diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs index 1cf1779f..c802e489 100644 --- a/src/slskd/Core/ConnectionWatchdog.cs +++ b/src/slskd/Core/ConnectionWatchdog.cs @@ -115,7 +115,7 @@ namespace slskd /// <remarks>This should be called at application startup.</remarks> public virtual void Start() { - if (OptionsAtStartup.Integration.Vpn.Enabled) + if (OptionsAtStartup.Integrations.Vpn.Enabled) { VPN.StartPolling(); } @@ -250,7 +250,7 @@ namespace slskd return; } - if (OptionsAtStartup.Integration.Vpn.Enabled && !VPN.IsReady) + if (OptionsAtStartup.Integrations.Vpn.Enabled && !VPN.IsReady) { IsAwaitingVpn = true; return; diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 0d22cad3..271fe905 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -314,7 +314,7 @@ namespace slskd /// Gets options for external integrations. /// </summary> [Validate] - public IntegrationOptions Integration { get; init; } = new IntegrationOptions(); + public IntegrationsOptions Integrations { get; init; } = new IntegrationsOptions(); /// <summary> /// Handles top-level validation that doesn't fit anywhere else. @@ -2302,7 +2302,7 @@ namespace slskd /// <summary> /// Options for external integrations. /// </summary> - public class IntegrationOptions + public class IntegrationsOptions { /// <summary> /// Gets VPN options. diff --git a/src/slskd/Integrations/FTP/FTPClientFactory.cs b/src/slskd/Integrations/FTP/FTPClientFactory.cs index 9e5dfc2e..13f78554 100644 --- a/src/slskd/Integrations/FTP/FTPClientFactory.cs +++ b/src/slskd/Integrations/FTP/FTPClientFactory.cs @@ -20,7 +20,7 @@ using Microsoft.Extensions.Options; namespace slskd.Integrations.FTP { using FluentFTP; - using static slskd.Options.IntegrationOptions; + using static slskd.Options.IntegrationsOptions; /// <summary> /// FTP client factory. @@ -36,7 +36,7 @@ namespace slskd.Integrations.FTP OptionsMonitor = optionsMonitor; } - private FtpOptions FtpOptions => OptionsMonitor.CurrentValue.Integration.Ftp; + private FtpOptions FtpOptions => OptionsMonitor.CurrentValue.Integrations.Ftp; private IOptionsMonitor<Options> OptionsMonitor { get; set; } /// <summary> diff --git a/src/slskd/Integrations/FTP/FTPService.cs b/src/slskd/Integrations/FTP/FTPService.cs index ebf34708..81defaaa 100644 --- a/src/slskd/Integrations/FTP/FTPService.cs +++ b/src/slskd/Integrations/FTP/FTPService.cs @@ -26,7 +26,7 @@ namespace slskd.Integrations.FTP using FluentFTP; using FluentFTP.Exceptions; using Microsoft.Extensions.Logging; - using static slskd.Options.IntegrationOptions; + using static slskd.Options.IntegrationsOptions; /// <summary> /// FTP Integration service. @@ -50,7 +50,7 @@ namespace slskd.Integrations.FTP } private IFTPClientFactory Factory { get; set; } - private FtpOptions FtpOptions => OptionsMonitor.CurrentValue.Integration.Ftp; + private FtpOptions FtpOptions => OptionsMonitor.CurrentValue.Integrations.Ftp; private ILogger<FTPService> Log { get; set; } private IOptionsMonitor<Options> OptionsMonitor { get; } diff --git a/src/slskd/Integrations/Pushbullet/PushbulletService.cs b/src/slskd/Integrations/Pushbullet/PushbulletService.cs index 4c9df98c..2f24befd 100644 --- a/src/slskd/Integrations/Pushbullet/PushbulletService.cs +++ b/src/slskd/Integrations/Pushbullet/PushbulletService.cs @@ -26,7 +26,7 @@ namespace slskd.Integrations.Pushbullet using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Logging; - using static slskd.Options.IntegrationOptions; + using static slskd.Options.IntegrationsOptions; /// <summary> /// Pushbullet integration service. @@ -57,7 +57,7 @@ namespace slskd.Integrations.Pushbullet private IHttpClientFactory HttpClientFactory { get; } private ILogger<PushbulletService> Log { get; } private IOptionsMonitor<Options> OptionsMonitor { get; } - private PushbulletOptions PushbulletOptions => OptionsMonitor.CurrentValue.Integration.Pushbullet; + private PushbulletOptions PushbulletOptions => OptionsMonitor.CurrentValue.Integrations.Pushbullet; private IMemoryCache RecentlySent { get; } /// <summary> diff --git a/src/slskd/Integrations/Scripts/ScriptService.cs b/src/slskd/Integrations/Scripts/ScriptService.cs index f5cc4d4c..9b47afe7 100644 --- a/src/slskd/Integrations/Scripts/ScriptService.cs +++ b/src/slskd/Integrations/Scripts/ScriptService.cs @@ -88,7 +88,7 @@ public class ScriptService bool EqualsLiterallyAnyEvent(string type) => type.Equals(EventType.Any.ToString(), StringComparison.OrdinalIgnoreCase); var options = OptionsMonitor.CurrentValue; - var scriptsTriggeredByThisEventType = options.Integration.Scripts + var scriptsTriggeredByThisEventType = options.Integrations.Scripts .Where(kvp => kvp.Value.On.Any(EqualsThisEvent) || kvp.Value.On.Any(EqualsLiterallyAnyEvent)); foreach (var script in scriptsTriggeredByThisEventType) diff --git a/src/slskd/Integrations/VPN/Clients/Gluetun.cs b/src/slskd/Integrations/VPN/Clients/Gluetun.cs index d22c15f7..136c9c05 100644 --- a/src/slskd/Integrations/VPN/Clients/Gluetun.cs +++ b/src/slskd/Integrations/VPN/Clients/Gluetun.cs @@ -26,7 +26,7 @@ using System.Net.Http.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; using Serilog; -using static slskd.Options.IntegrationOptions.VpnOptions; +using static slskd.Options.IntegrationsOptions.VpnOptions; /// <summary> /// Gluetun VPN client. @@ -47,7 +47,7 @@ public class Gluetun : IVPNClient private ILogger Log { get; } = Serilog.Log.ForContext<Gluetun>(); private IHttpClientFactory HttpClientFactory { get; } private IOptionsMonitor<Options> OptionsMonitor { get; } - private GluetunVpnOptions Options => OptionsMonitor.CurrentValue.Integration.Vpn.Gluetun; + private GluetunVpnOptions Options => OptionsMonitor.CurrentValue.Integrations.Vpn.Gluetun; /// <summary> /// Fetch the VPN connection status from the Gluetun control server. @@ -85,7 +85,7 @@ public class Gluetun : IVPNClient int? port = null; - if (OptionsMonitor.CurrentValue.Integration.Vpn.PortForwarding) + if (OptionsMonitor.CurrentValue.Integrations.Vpn.PortForwarding) { port = (await MakeRequest<GluetunPortForwardResponse>(http, "/v1/portforward"))?.Port; diff --git a/src/slskd/Integrations/VPN/VPNService.cs b/src/slskd/Integrations/VPN/VPNService.cs index db09c041..c0a65f00 100644 --- a/src/slskd/Integrations/VPN/VPNService.cs +++ b/src/slskd/Integrations/VPN/VPNService.cs @@ -52,9 +52,9 @@ public class VPNService : IDisposable SoulseekClient = soulseekClient; HttpClientFactory = httpClientFactory; - if (OptionsAtStartup.Integration.Vpn.Enabled) + if (OptionsAtStartup.Integrations.Vpn.Enabled) { - Timer = new System.Timers.Timer(interval: OptionsAtStartup.Integration.Vpn.PollingInterval) + Timer = new System.Timers.Timer(interval: OptionsAtStartup.Integrations.Vpn.PollingInterval) { AutoReset = true, }; @@ -63,7 +63,7 @@ public class VPNService : IDisposable // detect VPN based on the configuration provided; this logic will determine the order // we can revisit this if/when we add other options besides gluetun - if (!string.IsNullOrEmpty(OptionsMonitor.CurrentValue.Integration.Vpn.Gluetun.Url)) + if (!string.IsNullOrEmpty(OptionsMonitor.CurrentValue.Integrations.Vpn.Gluetun.Url)) { Client = new Gluetun(HttpClientFactory, OptionsMonitor); @@ -154,7 +154,7 @@ public class VPNService : IDisposable throw new VPNClientException("VPN client not properly initialized; something went seriously wrong! Please report to GitHub."); } - var options = OptionsMonitor.CurrentValue.Integration.Vpn; + var options = OptionsMonitor.CurrentValue.Integrations.Vpn; bool isReadyNow = false; VPNStatus status = new VPNStatus(); diff --git a/src/slskd/Integrations/Webhooks/WebhookService.cs b/src/slskd/Integrations/Webhooks/WebhookService.cs index 8a009623..deff3368 100644 --- a/src/slskd/Integrations/Webhooks/WebhookService.cs +++ b/src/slskd/Integrations/Webhooks/WebhookService.cs @@ -73,7 +73,7 @@ public class WebhookService bool EqualsLiterallyAnyEvent(string type) => type.Equals(EventType.Any.ToString(), StringComparison.OrdinalIgnoreCase); var options = OptionsMonitor.CurrentValue; - var webhooksTriggeredByThisEventType = options.Integration.Webhooks + var webhooksTriggeredByThisEventType = options.Integrations.Webhooks .Where(kvp => kvp.Value.On.Any(EqualsThisEvent) || kvp.Value.On.Any(EqualsLiterallyAnyEvent)); foreach (var webhook in webhooksTriggeredByThisEventType) diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index a9504bb8..7c88f52d 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -691,11 +691,11 @@ namespace slskd new SoulseekClient( minorVersion: NetworkMinorVersion, options: new SoulseekClientOptions( - maximumConcurrentUploads: OptionsAtStartup.Transfers.Upload.Slots, - maximumConcurrentDownloads: OptionsAtStartup.Transfers.Download.Slots, - minimumDiagnosticLevel: OptionsAtStartup.Soulseek.DiagnosticLevel.ToEnum<Soulseek.Diagnostics.DiagnosticLevel>(), - maximumConcurrentSearches: 2, - raiseEventsAsynchronously: true))); + maximumConcurrentUploads: OptionsAtStartup.Transfers.Upload.Slots, + maximumConcurrentDownloads: OptionsAtStartup.Transfers.Download.Slots, + minimumDiagnosticLevel: OptionsAtStartup.Soulseek.DiagnosticLevel.ToEnum<Soulseek.Diagnostics.DiagnosticLevel>(), + maximumConcurrentSearches: 2, + raiseEventsAsynchronously: true))); // add the core application service to DI as well as a hosted service so that other services can // access instance methods diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 1a0c5e6c..0a27c904 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -1148,7 +1148,7 @@ namespace slskd.Transfers.Downloads }); } - if (OptionsMonitor.CurrentValue.Integration.Ftp.Enabled) + if (OptionsMonitor.CurrentValue.Integrations.Ftp.Enabled) { _ = FTP.UploadAsync(finalFilename); } |
