aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-04-23 18:40:41 -0500
committerGitHub <noreply@github.com>2026-04-23 18:40:41 -0500
commitfc722e4a78aa5369fcd5ca0d8e88bd98d874a1d8 (patch)
tree1ebad506bc42f3bc20e6825bf9f03715031c06ba /src/slskd/Application.cs
parent7961741f740abd240754ff6e39cda6d69f727268 (diff)
parent2f20ac833dca19e87e7980ac83f94206685409d9 (diff)
downloadslskd-fc722e4a78aa5369fcd5ca0d8e88bd98d874a1d8.tar.gz
Merge pull request #1713 from slskd/blacklist-regex
Allow blacklisting of username patterns
Diffstat (limited to 'src/slskd/Application.cs')
-rw-r--r--src/slskd/Application.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 86dd9dd1..e36a5539 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -94,6 +94,7 @@ namespace slskd
/// <summary>
/// The name of the blacklisted user group.
/// </summary>
+ [Obsolete("use IsBlacklisted instead")]
public const string BlacklistedGroup = "blacklisted";
private static readonly string ApplicationShutdownTransferExceptionMessage = "Application shut down";
@@ -1380,6 +1381,12 @@ namespace slskd
private Task<int?> PlaceInQueueResolver(string username, IPEndPoint endpoint, string filename)
{
+ if (Users.IsBlacklisted(username, endpoint.Address))
+ {
+ Log.Information("Returned empty directory listing for blacklisted user {Username} ({IP})", username, endpoint.Address);
+ return Task.FromResult<int?>(null);
+ }
+
try
{
var place = Transfers.Uploads.Queue.EstimatePosition(username, filename);
@@ -1651,7 +1658,9 @@ namespace slskd
var sw = new Stopwatch();
sw.Start();
- if (Users.IsBlacklisted(username))
+ // opportunistically try and avoid performing the search if we have a cached blacklisted value, otherwise
+ // hold off on computing it and filling the cache until we have the user's IP
+ if (Users.IsBlacklisted(username, bypassCache: false))
{
return null;
}