aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-01-28 09:19:26 -0600
committerGitHub <noreply@github.com>2024-01-28 09:19:26 -0600
commitd32fa80e5f50a70b0a9417b78f2d875ba5463a9d (patch)
treedf3a90617fc77777c4528988b6e4f721e301bbbc /src
parentcc708ea36d3983336c0ebaed6eba33c28d37e24f (diff)
parente298f5fb4c71a1e443a741b685b9d62a91a64fc2 (diff)
downloadslskd-d32fa80e5f50a70b0a9417b78f2d875ba5463a9d.tar.gz
Merge branch 'master' into chat-darktheme-fixes
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 70d726ab..be6213f3 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1318,8 +1318,7 @@ namespace slskd
if (Users.IsBlacklisted(username))
{
- Log.Information("Returned empty search response for blacklisted user {Username}", username);
- return new SearchResponse(username, token, hasFreeUploadSlot: false, uploadSpeed: 0, queueLength: int.MaxValue, fileList: Enumerable.Empty<Soulseek.File>());
+ return null;
}
if (CompiledSearchResponseFilters.Any(filter => filter.IsMatch(query.SearchText)))
@@ -1348,7 +1347,19 @@ namespace slskd
if (results.Any())
{
+ // fetch the user's IP address so that we can check whether it's blacklisted.
+ // it's unfortunate that we have to do this to get the IP, but we have to do it
+ // anyway to send the results, and the information is cached. whether we do it here
+ // or Soulseek.NET does it under the hood doesn't really matter.
+ var endpoint = await Client.GetUserEndPointAsync(username);
+
+ if (Users.IsBlacklisted(username, endpoint.Address))
+ {
+ return null;
+ }
+
// make sure our average speed (as reported by the server) is reasonably up to date
+ // we do this because we send the information along with the search response
await RefreshUserStatistics();
// note: the following uses cached user data to determine group, so if the user's data