From 1fb7b1d85d04546dda66616030f427badff48ebd Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 1 Mar 2026 13:44:22 -0600 Subject: move transfer options into the same type, move limits under upload --- config/slskd.example.yml | 128 +++++++++++++++++++++++------------------------ 1 file changed, 64 insertions(+), 64 deletions(-) (limited to 'config') diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 7e820d9f..d0c0f27a 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -54,80 +54,78 @@ # storage_mode: memory # workers: 16 # retention: ~ # retain indefinitely (do not automatically re-scan) -# rooms: -# - ~ -# global: +# transfers: # upload: # slots: 20 # speed_limit: 1000 # in kibibytes -# limits: -# queued: -# files: 500 -# megabytes: 5000 -# daily: -# files: 1000 -# megabytes: 10000 -# failures: 200 -# weekly: -# files: 5000 -# megabytes: 50000 -# failures: 1000 -# download: -# slots: 500 -# speed_limit: 1000 -# groups: -# default: -# upload: -# priority: 500 -# strategy: roundrobin -# slots: 10 -# limits: -# queued: -# files: 150 -# megabytes: 1500 -# daily: ~ # no daily limits (weekly still apply) -# weekly: -# files: 1500 -# megabytes: 15000 -# failures: 150 -# leechers: -# thresholds: -# files: 1 -# directories: 1 -# upload: -# priority: 999 -# strategy: roundrobin -# slots: 1 -# speed_limit: 100 # limits: # queued: -# files: 15 -# megabytes: 150 +# files: 500 +# megabytes: 5000 # daily: -# files: 30 -# megabytes: 300 -# failures: 10 +# files: 1000 +# megabytes: 10000 +# failures: 200 # weekly: -# files: 150 -# megabytes: 1500 -# failures: 30 -# blacklisted: -# members: -# - -# cidrs: -# - -# user_defined: -# my_buddies: +# files: 5000 +# megabytes: 50000 +# failures: 1000 +# download: +# slots: 500 +# speed_limit: 1000 +# groups: +# default: # upload: -# priority: 250 -# strategy: firstinfirstout +# priority: 500 +# strategy: roundrobin # slots: 10 -# limits: -# queued: -# files: 1000 # override global default +# limits: +# queued: +# files: 150 +# megabytes: 1500 +# daily: ~ # no daily limits (weekly still apply) +# weekly: +# files: 1500 +# megabytes: 15000 +# failures: 150 +# leechers: +# thresholds: +# files: 1 +# directories: 1 +# upload: +# priority: 999 +# strategy: roundrobin +# slots: 1 +# speed_limit: 100 +# limits: +# queued: +# files: 15 +# megabytes: 150 +# daily: +# files: 30 +# megabytes: 300 +# failures: 10 +# weekly: +# files: 150 +# megabytes: 1500 +# failures: 30 +# blacklisted: # members: -# - alice -# - bob +# - +# cidrs: +# - +# user_defined: +# my_buddies: +# upload: +# priority: 250 +# strategy: firstinfirstout +# slots: 10 +# limits: +# queued: +# files: 1000 # override global default +# members: +# - alice +# - bob # blacklist: # enabled: true # file: @@ -135,6 +133,8 @@ # search: # request: # - ^.{1,2}$ +# rooms: +# - ~ # web: # port: 5030 # ip_address: 0.0.0.0,[::] -- cgit v1.2.3 From 83d10be53819a2185e8dc514e96ea6f76f87aa60 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 15 Mar 2026 15:32:35 -0500 Subject: also rename integrations while we're at it --- config/slskd.example.yml | 2 +- src/slskd/Application.cs | 4 ++-- src/slskd/Core/ConnectionWatchdog.cs | 4 ++-- src/slskd/Core/Options.cs | 5 +++-- src/slskd/Integrations/FTP/FTPClientFactory.cs | 4 ++-- src/slskd/Integrations/FTP/FTPService.cs | 4 ++-- src/slskd/Integrations/Pushbullet/PushbulletService.cs | 4 ++-- src/slskd/Integrations/Scripts/ScriptService.cs | 2 +- src/slskd/Integrations/VPN/Clients/Gluetun.cs | 6 +++--- src/slskd/Integrations/VPN/VPNService.cs | 8 ++++---- src/slskd/Integrations/Webhooks/WebhookService.cs | 2 +- src/slskd/Transfers/Downloads/DownloadService.cs | 2 +- 12 files changed, 24 insertions(+), 23 deletions(-) (limited to 'config') diff --git a/config/slskd.example.yml b/config/slskd.example.yml index d0c0f27a..b4843df6 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -230,7 +230,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..5519eeac 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); } 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 /// This should be called at application startup. 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 bf1378e6..fca2f91c 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -241,6 +241,7 @@ namespace slskd /// /// Gets transfer options. /// + [Validate] public TransfersOptions Transfers { get; init; } = new TransfersOptions(); /// @@ -312,7 +313,7 @@ namespace slskd /// Gets options for external integrations. /// [Validate] - public IntegrationOptions Integration { get; init; } = new IntegrationOptions(); + public IntegrationsOptions Integrations { get; init; } = new IntegrationsOptions(); /// /// Handles top-level validation that doesn't fit anywhere else. @@ -2264,7 +2265,7 @@ namespace slskd /// /// Options for external integrations. /// - public class IntegrationOptions + public class IntegrationsOptions { /// /// 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; /// /// 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 OptionsMonitor { get; set; } /// 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; /// /// 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 Log { get; set; } private IOptionsMonitor 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; /// /// Pushbullet integration service. @@ -57,7 +57,7 @@ namespace slskd.Integrations.Pushbullet private IHttpClientFactory HttpClientFactory { get; } private ILogger Log { get; } private IOptionsMonitor OptionsMonitor { get; } - private PushbulletOptions PushbulletOptions => OptionsMonitor.CurrentValue.Integration.Pushbullet; + private PushbulletOptions PushbulletOptions => OptionsMonitor.CurrentValue.Integrations.Pushbullet; private IMemoryCache RecentlySent { get; } /// 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; /// /// Gluetun VPN client. @@ -47,7 +47,7 @@ public class Gluetun : IVPNClient private ILogger Log { get; } = Serilog.Log.ForContext(); private IHttpClientFactory HttpClientFactory { get; } private IOptionsMonitor OptionsMonitor { get; } - private GluetunVpnOptions Options => OptionsMonitor.CurrentValue.Integration.Vpn.Gluetun; + private GluetunVpnOptions Options => OptionsMonitor.CurrentValue.Integrations.Vpn.Gluetun; /// /// 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(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/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index e6a65dcd..0affc4de 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -1089,7 +1089,7 @@ namespace slskd.Transfers.Downloads }); } - if (OptionsMonitor.CurrentValue.Integration.Ftp.Enabled) + if (OptionsMonitor.CurrentValue.Integrations.Ftp.Enabled) { _ = FTP.UploadAsync(finalFilename); } -- cgit v1.2.3 From 81ad3c08618eed605c0d2e89cfee1d9d4d696490 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 15 Mar 2026 17:53:39 -0500 Subject: remove whitespace --- config/slskd.example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config') diff --git a/config/slskd.example.yml b/config/slskd.example.yml index b4843df6..72aadaed 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -101,7 +101,7 @@ # queued: # files: 15 # megabytes: 150 -# daily: +# daily: # files: 30 # megabytes: 300 # failures: 10 -- cgit v1.2.3