From 54cabd98b4c0f97f343351552dfcad321f6dcbe2 Mon Sep 17 00:00:00 2001 From: Marius Nechifor Date: Tue, 19 Nov 2024 23:54:16 +0200 Subject: [PATCH] remove empty creds restriction (#10) * removed empty checks on qbit and deluge credentials * updated configuration readme --- README.md | 12 ++++++------ code/Common/Configuration/DelugeConfig.cs | 5 ----- code/Common/Configuration/QBitConfig.cs | 10 ---------- .../DownloadClient/QBittorrent/QBitService.cs | 5 +++++ 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1d7acf1..edf5ecc 100644 --- a/README.md +++ b/README.md @@ -134,16 +134,16 @@ services: | CONTENTBLOCKER__BLACKLIST__PATH | Yes if whitelist is enabled | Path to the whitelist (local file or url); Needs to be json compatible | empty | ||||| | QBITTORRENT__ENABLED | No | Enable or disable qBittorrent | true | -| QBITTORRENT__URL | Yes if qBittorrent is enabled | qBittorrent instance url | http://localhost:8112 | -| QBITTORRENT__USERNAME | Yes if qBittorrent is enabled | qBittorrent user | empty | -| QBITTORRENT__PASSWORD | Yes if qBittorrent is enabled | qBittorrent password | empty | +| QBITTORRENT__URL | No | qBittorrent instance url | http://localhost:8112 | +| QBITTORRENT__USERNAME | No | qBittorrent user | empty | +| QBITTORRENT__PASSWORD | No | qBittorrent password | empty | ||||| | DELUGE__ENABLED | No | Enable or disable Deluge | false | -| DELUGE__URL | Yes if Deluge is enabled | Deluge instance url | http://localhost:8080 | -| DELUGE__PASSWORD | Yes if Deluge is enabled | Deluge password | empty | +| DELUGE__URL | No | Deluge instance url | http://localhost:8080 | +| DELUGE__PASSWORD | No | Deluge password | empty | ||||| | TRANSMISSION__ENABLED | No | Enable or disable Transmission | true | -| TRANSMISSION__URL | Yes if Transmission is enabled | Transmission instance url | http://localhost:9091 | +| TRANSMISSION__URL | No | Transmission instance url | http://localhost:9091 | | TRANSMISSION__USERNAME | No | Transmission user | empty | | TRANSMISSION__PASSWORD | No | Transmission password | empty | ||||| diff --git a/code/Common/Configuration/DelugeConfig.cs b/code/Common/Configuration/DelugeConfig.cs index 80d31dc..dbf283d 100644 --- a/code/Common/Configuration/DelugeConfig.cs +++ b/code/Common/Configuration/DelugeConfig.cs @@ -23,10 +23,5 @@ public sealed record DelugeConfig : IConfig { throw new ArgumentNullException(nameof(Url)); } - - if (string.IsNullOrEmpty(Password)) - { - throw new ArgumentNullException(nameof(Password)); - } } } \ No newline at end of file diff --git a/code/Common/Configuration/QBitConfig.cs b/code/Common/Configuration/QBitConfig.cs index f0b727e..2bfaa2d 100644 --- a/code/Common/Configuration/QBitConfig.cs +++ b/code/Common/Configuration/QBitConfig.cs @@ -25,15 +25,5 @@ public sealed class QBitConfig : IConfig { throw new ArgumentNullException(nameof(Url)); } - - if (string.IsNullOrEmpty(Username)) - { - throw new ArgumentNullException(nameof(Username)); - } - - if (string.IsNullOrEmpty(Password)) - { - throw new ArgumentNullException(nameof(Password)); - } } } \ No newline at end of file diff --git a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs index 07a4e97..a3bbfa2 100644 --- a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs @@ -27,6 +27,11 @@ public sealed class QBitService : IDownloadService public async Task LoginAsync() { + if (string.IsNullOrEmpty(_config.Username) && string.IsNullOrEmpty(_config.Password)) + { + return; + } + await _client.LoginAsync(_config.Username, _config.Password); }