From 07952c6ebe125120b848e0e9d5de85644185d9a5 Mon Sep 17 00:00:00 2001
From: Terry Wilson <103469370+dkschruteBeets@users.noreply.github.com>
Date: Sun, 2 Mar 2025 16:55:19 -0700
Subject: feat: add profile picture support
---
src/slskd/Application.cs | 8 +++++--
src/slskd/Core/Options.cs | 10 +++++++-
src/slskd/Program.cs | 5 ++++
src/slskd/Users/IUserService.cs | 7 ++++++
src/slskd/Users/UserService.cs | 51 ++++++++++++++++++++++++++++++++++++++++-
5 files changed, 77 insertions(+), 4 deletions(-)
(limited to 'src')
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 791cf245..6a539fa9 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1662,13 +1662,16 @@ namespace slskd
/// A Task resolving the UserInfo instance.
private async Task UserInfoResolver(string username, IPEndPoint endpoint)
{
+ var profilePicture = Users.GetProfilePicture(Options.Soulseek.ProfilePicture);
+
if (Users.IsBlacklisted(username, endpoint.Address))
{
return new UserInfo(
description: Options.Soulseek.Description,
uploadSlots: 0,
queueLength: int.MaxValue,
- hasFreeUploadSlot: false);
+ hasFreeUploadSlot: false,
+ picture: profilePicture);
}
try
@@ -1692,7 +1695,8 @@ namespace slskd
description: Options.Soulseek.Description,
uploadSlots: group.Slots,
queueLength: forecastedPosition,
- hasFreeUploadSlot: forecastedPosition == 0);
+ hasFreeUploadSlot: forecastedPosition == 0,
+ picture: profilePicture);
return info;
}
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 266d04aa..68856b36 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -1531,6 +1531,14 @@ namespace slskd
[Description("user description for the Soulseek network")]
public string Description { get; init; } = "A slskd user. https://github.com/slskd/slskd";
+ ///
+ /// Gets the file path for the user's profile picture.
+ ///
+ [Argument(default, "slsk-profile-picture")]
+ [EnvironmentVariable("SLSK_PROFILE_PICTURE")]
+ [Description("path to the user's profile picture file")]
+ public string ProfilePicture { get; init; } = Program.DefaultProfilePicturePath;
+
///
/// Gets the local IP address on which to listen for incoming connections.
///
@@ -1656,7 +1664,7 @@ namespace slskd
[EnvironmentVariable("SLSK_INACTIVITY_TIMEOUT")]
[Description("connection inactivity timeout, in milliseconds")]
[Range(1000, int.MaxValue)]
- public int Inactivity { get; init; } = 15000;
+ public int Inactivity { get; init; } = 30000;
}
///
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index b7fa47d2..c2b28cc9 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -202,6 +202,11 @@ namespace slskd
///
public static string DefaultIncompleteDirectory { get; private set; }
+ ///
+ /// Gets the default profile picture path.
+ ///
+ public static string DefaultProfilePicturePath { get; private set; } = Path.Combine(AppContext.BaseDirectory, "slsk-profile-picture.jpg");
+
///
/// Gets the path where application logs are saved.
///
diff --git a/src/slskd/Users/IUserService.cs b/src/slskd/Users/IUserService.cs
index 75afd442..e84d7461 100644
--- a/src/slskd/Users/IUserService.cs
+++ b/src/slskd/Users/IUserService.cs
@@ -152,5 +152,12 @@ namespace slskd.Users
/// The username of the peer.
/// The operation context.
Task WatchAsync(string username);
+
+ ///
+ /// Gets the profile picture as a byte array if it exists.
+ ///
+ /// The profile picture path to resolve.
+ /// The profile picture as a byte array if it exists and can be read, null otherwise.
+ byte[] GetProfilePicture(string profilePicture);
}
}
\ No newline at end of file
diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs
index ead1d812..d634704a 100644
--- a/src/slskd/Users/UserService.cs
+++ b/src/slskd/Users/UserService.cs
@@ -19,13 +19,16 @@ using Microsoft.Extensions.Options;
namespace slskd.Users
{
+ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
+ using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using NetTools;
using Serilog;
+ using slskd.Files;
using Soulseek;
///
@@ -65,16 +68,21 @@ namespace slskd.Users
///
public class UserService : IUserService
{
+ private readonly FileService fileService;
+
///
/// Initializes a new instance of the class.
///
///
///
+ ///
public UserService(
ISoulseekClient soulseekClient,
- IOptionsMonitor optionsMonitor)
+ IOptionsMonitor optionsMonitor,
+ FileService fileService)
{
Client = soulseekClient;
+ this.fileService = fileService;
OptionsMonitor = optionsMonitor;
OptionsMonitor.OnChange(options => Configure(options));
@@ -146,6 +154,47 @@ namespace slskd.Users
private ConcurrentDictionary UserDictionary { get; set; } = new ConcurrentDictionary();
private ConcurrentDictionary WatchedUsernamesDictionary { get; set; } = new ConcurrentDictionary();
+ ///
+ /// Gets the profile picture as a byte array if it exists.
+ ///
+ /// The profile picture path to resolve.
+ /// The profile picture as a byte array if it exists and can be read, null otherwise.
+ public byte[] GetProfilePicture(string profilePicture)
+ {
+ if (string.IsNullOrWhiteSpace(profilePicture))
+ {
+ Log.Warning("Profile picture path is not set");
+ return null;
+ }
+
+ try
+ {
+ // Ensure the path is relative to the app directory for security
+ var fullPath = Path.GetFullPath(
+ Path.Combine(AppContext.BaseDirectory, profilePicture));
+
+ var fileInfo = fileService.ResolveFileInfo(fullPath);
+ if (!fileInfo.Exists)
+ {
+ Log.Warning("Profile picture '{Path}' not found", profilePicture);
+ return null;
+ }
+
+ // Read the file into a byte array
+ return System.IO.File.ReadAllBytes(fileInfo.FullName);
+ }
+ catch (UnauthorizedException ex)
+ {
+ Log.Warning(ex, "Access to profile picture '{Path}' was denied", profilePicture);
+ return null;
+ }
+ catch (IOException ex)
+ {
+ Log.Warning(ex, "Failed to read profile picture '{Path}'", profilePicture);
+ return null;
+ }
+ }
+
///
/// Gets the name of the group for the specified .
///
--
cgit v1.2.3
From 01e41848bdf9e40930ea4b60f8f4f3fbe8ea4037 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sat, 5 Apr 2025 17:11:39 -0500
Subject: set inactivity back to 15s
---
config/slskd.example.yml | 2 +-
src/slskd/Core/Options.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
(limited to 'src')
diff --git a/config/slskd.example.yml b/config/slskd.example.yml
index 69725415..40ddcc5e 100644
--- a/config/slskd.example.yml
+++ b/config/slskd.example.yml
@@ -204,7 +204,7 @@
# connection:
# timeout:
# connect: 10000
-# inactivity: 30000
+# inactivity: 15000
# buffer:
# read: 16384
# write: 16384
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 68856b36..aeba446c 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -1664,7 +1664,7 @@ namespace slskd
[EnvironmentVariable("SLSK_INACTIVITY_TIMEOUT")]
[Description("connection inactivity timeout, in milliseconds")]
[Range(1000, int.MaxValue)]
- public int Inactivity { get; init; } = 30000;
+ public int Inactivity { get; init; } = 15000;
}
///
--
cgit v1.2.3
From 4b56b8eb282a9a32408b2b02c0e758f7bea23af2 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sat, 5 Apr 2025 17:12:27 -0500
Subject: tweak picture option
---
src/slskd/Core/Options.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'src')
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index aeba446c..22963eba 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -1534,10 +1534,10 @@ namespace slskd
///
/// Gets the file path for the user's profile picture.
///
- [Argument(default, "slsk-profile-picture")]
- [EnvironmentVariable("SLSK_PROFILE_PICTURE")]
- [Description("path to the user's profile picture file")]
- public string ProfilePicture { get; init; } = Program.DefaultProfilePicturePath;
+ [Argument(default, "slsk-picture")]
+ [EnvironmentVariable("SLSK_PICTURE")]
+ [Description("user picture for the Soulseek network")]
+ public string Picture { get; init; } = null;
///
/// Gets the local IP address on which to listen for incoming connections.
--
cgit v1.2.3
From 7f2cc8a2270340a17a46366e200fe832fd5137c1 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sat, 5 Apr 2025 17:13:47 -0500
Subject: ensure file exists if specified
---
src/slskd/Core/Options.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'src')
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 22963eba..cc662444 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -1537,6 +1537,7 @@ namespace slskd
[Argument(default, "slsk-picture")]
[EnvironmentVariable("SLSK_PICTURE")]
[Description("user picture for the Soulseek network")]
+ [FileExists(FileAccess.Read)]
public string Picture { get; init; } = null;
///
--
cgit v1.2.3
From 1a8c5cc0ea17d659e56a3b7d266939a6f74f03fc Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sun, 6 Apr 2025 17:25:22 -0500
Subject: remove unused default picture path
---
src/slskd/Program.cs | 5 -----
1 file changed, 5 deletions(-)
(limited to 'src')
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index c2b28cc9..b7fa47d2 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -202,11 +202,6 @@ namespace slskd
///
public static string DefaultIncompleteDirectory { get; private set; }
- ///
- /// Gets the default profile picture path.
- ///
- public static string DefaultProfilePicturePath { get; private set; } = Path.Combine(AppContext.BaseDirectory, "slsk-profile-picture.jpg");
-
///
/// Gets the path where application logs are saved.
///
--
cgit v1.2.3
From 831e9ce49abbcc64a7b75c6fb2c90ad20b233e00 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sun, 6 Apr 2025 17:25:46 -0500
Subject: formatting/docs
---
src/slskd/Application.cs | 3 ++-
tests/slskd.Tests.Unit/Users/UserServiceTests.cs | 16 ++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)
(limited to 'src')
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index acfecdbf..1e71652c 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1662,7 +1662,7 @@ namespace slskd
/// A Task resolving the UserInfo instance.
private async Task UserInfoResolver(string username, IPEndPoint endpoint)
{
- var profilePicture = Users.GetProfilePicture(Options.Soulseek.ProfilePicture);
+ var profilePicture = Users.GetProfilePicture(Options.Soulseek.Picture);
if (Users.IsBlacklisted(username, endpoint.Address))
{
@@ -1691,6 +1691,7 @@ namespace slskd
// i want to know how many slots they have, which gives me an idea of how fast their
// queue moves, and the length of the queue *ahead of me*, meaning how long i'd have to
// wait until my first download starts.
+ // revisited 3 years later: why was it important to leave this comment??
var info = new UserInfo(
description: Options.Soulseek.Description,
uploadSlots: group.Slots,
diff --git a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
index 28f54629..205ff0e2 100644
--- a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
+++ b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
@@ -130,9 +130,9 @@
public void Returns_Null_When_Path_Is_NullOrWhitespace(string path)
{
var (service, _) = GetFixture();
-
+
var result = service.GetProfilePicture(path);
-
+
Assert.Null(result);
}
@@ -141,9 +141,9 @@
{
const string nonExistentPath = "nonexistent-file.jpg";
var (service, _) = GetFixture();
-
+
var result = service.GetProfilePicture(nonExistentPath);
-
+
Assert.Null(result);
}
@@ -155,11 +155,11 @@
{
// Write some test data to the temp file
System.IO.File.WriteAllBytes(tempFile, new byte[] { 1, 2, 3, 4, 5 });
-
+
var (service, _) = GetFixture();
-
+
var result = service.GetProfilePicture(tempFile);
-
+
Assert.NotNull(result);
Assert.Equal(new byte[] { 1, 2, 3, 4, 5 }, result);
}
@@ -174,7 +174,7 @@
}
}
- private static (UserService governor, Mocks mocks) GetFixture(Options options = null)
+ private static (UserService service, Mocks mocks) GetFixture(Options options = null)
{
var mocks = new Mocks(options);
var service = new UserService(
--
cgit v1.2.3
From 21da11dfae33529d2672da06a8fa52b5343b5239 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Mon, 7 Apr 2025 12:33:22 -0500
Subject: simplify fetch of picture bytes
---
src/slskd/Application.cs | 15 +++++--
src/slskd/Users/IUserService.cs | 7 ---
src/slskd/Users/UserService.cs | 49 +--------------------
tests/slskd.Tests.Unit/Users/UserServiceTests.cs | 56 +-----------------------
4 files changed, 14 insertions(+), 113 deletions(-)
(limited to 'src')
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 1e71652c..4ed9d092 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1662,7 +1662,16 @@ namespace slskd
/// A Task resolving the UserInfo instance.
private async Task UserInfoResolver(string username, IPEndPoint endpoint)
{
- var profilePicture = Users.GetProfilePicture(Options.Soulseek.Picture);
+ byte[] pictureBytes = null;
+
+ try
+ {
+ pictureBytes = await System.IO.File.ReadAllBytesAsync(Options.Soulseek.Picture);
+ }
+ catch (Exception ex)
+ {
+ Log.Warning("Failed to read Soulseek picture {Picture}: {Message}", Options.Soulseek.Picture, ex.Message);
+ }
if (Users.IsBlacklisted(username, endpoint.Address))
{
@@ -1671,7 +1680,7 @@ namespace slskd
uploadSlots: 0,
queueLength: int.MaxValue,
hasFreeUploadSlot: false,
- picture: profilePicture);
+ picture: pictureBytes);
}
try
@@ -1697,7 +1706,7 @@ namespace slskd
uploadSlots: group.Slots,
queueLength: forecastedPosition,
hasFreeUploadSlot: forecastedPosition == 0,
- picture: profilePicture);
+ picture: pictureBytes);
return info;
}
diff --git a/src/slskd/Users/IUserService.cs b/src/slskd/Users/IUserService.cs
index e84d7461..75afd442 100644
--- a/src/slskd/Users/IUserService.cs
+++ b/src/slskd/Users/IUserService.cs
@@ -152,12 +152,5 @@ namespace slskd.Users
/// The username of the peer.
/// The operation context.
Task WatchAsync(string username);
-
- ///
- /// Gets the profile picture as a byte array if it exists.
- ///
- /// The profile picture path to resolve.
- /// The profile picture as a byte array if it exists and can be read, null otherwise.
- byte[] GetProfilePicture(string profilePicture);
}
}
\ No newline at end of file
diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs
index d634704a..55b02134 100644
--- a/src/slskd/Users/UserService.cs
+++ b/src/slskd/Users/UserService.cs
@@ -68,22 +68,16 @@ namespace slskd.Users
///
public class UserService : IUserService
{
- private readonly FileService fileService;
-
///
/// Initializes a new instance of the class.
///
///
///
- ///
public UserService(
ISoulseekClient soulseekClient,
- IOptionsMonitor optionsMonitor,
- FileService fileService)
+ IOptionsMonitor optionsMonitor)
{
Client = soulseekClient;
- this.fileService = fileService;
-
OptionsMonitor = optionsMonitor;
OptionsMonitor.OnChange(options => Configure(options));
@@ -154,47 +148,6 @@ namespace slskd.Users
private ConcurrentDictionary UserDictionary { get; set; } = new ConcurrentDictionary();
private ConcurrentDictionary WatchedUsernamesDictionary { get; set; } = new ConcurrentDictionary();
- ///
- /// Gets the profile picture as a byte array if it exists.
- ///
- /// The profile picture path to resolve.
- /// The profile picture as a byte array if it exists and can be read, null otherwise.
- public byte[] GetProfilePicture(string profilePicture)
- {
- if (string.IsNullOrWhiteSpace(profilePicture))
- {
- Log.Warning("Profile picture path is not set");
- return null;
- }
-
- try
- {
- // Ensure the path is relative to the app directory for security
- var fullPath = Path.GetFullPath(
- Path.Combine(AppContext.BaseDirectory, profilePicture));
-
- var fileInfo = fileService.ResolveFileInfo(fullPath);
- if (!fileInfo.Exists)
- {
- Log.Warning("Profile picture '{Path}' not found", profilePicture);
- return null;
- }
-
- // Read the file into a byte array
- return System.IO.File.ReadAllBytes(fileInfo.FullName);
- }
- catch (UnauthorizedException ex)
- {
- Log.Warning(ex, "Access to profile picture '{Path}' was denied", profilePicture);
- return null;
- }
- catch (IOException ex)
- {
- Log.Warning(ex, "Failed to read profile picture '{Path}'", profilePicture);
- return null;
- }
- }
-
///
/// Gets the name of the group for the specified .
///
diff --git a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
index 205ff0e2..8581a966 100644
--- a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
+++ b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
@@ -121,66 +121,12 @@
}
}
- public class GetProfilePicture
- {
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData(" ")]
- public void Returns_Null_When_Path_Is_NullOrWhitespace(string path)
- {
- var (service, _) = GetFixture();
-
- var result = service.GetProfilePicture(path);
-
- Assert.Null(result);
- }
-
- [Fact]
- public void Returns_Null_When_File_Does_Not_Exist()
- {
- const string nonExistentPath = "nonexistent-file.jpg";
- var (service, _) = GetFixture();
-
- var result = service.GetProfilePicture(nonExistentPath);
-
- Assert.Null(result);
- }
-
- [Fact]
- public void Returns_File_Bytes_When_File_Exists()
- {
- var tempFile = Path.GetTempFileName();
- try
- {
- // Write some test data to the temp file
- System.IO.File.WriteAllBytes(tempFile, new byte[] { 1, 2, 3, 4, 5 });
-
- var (service, _) = GetFixture();
-
- var result = service.GetProfilePicture(tempFile);
-
- Assert.NotNull(result);
- Assert.Equal(new byte[] { 1, 2, 3, 4, 5 }, result);
- }
- finally
- {
- // Clean up
- if (System.IO.File.Exists(tempFile))
- {
- System.IO.File.Delete(tempFile);
- }
- }
- }
- }
-
private static (UserService service, Mocks mocks) GetFixture(Options options = null)
{
var mocks = new Mocks(options);
var service = new UserService(
mocks.SoulseekClient.Object,
- mocks.OptionsMonitor,
- mocks.FileService);
+ mocks.OptionsMonitor);
return (service, mocks);
}
--
cgit v1.2.3
From f174c680f6133580033d9baaff71d40bce43e753 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Mon, 7 Apr 2025 12:33:36 -0500
Subject: leave some notes
---
src/slskd/Application.cs | 4 ++++
src/slskd/Users/UserService.cs | 3 ---
tests/slskd.Tests.Unit/Users/UserServiceTests.cs | 4 ----
3 files changed, 4 insertions(+), 7 deletions(-)
(limited to 'src')
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 4ed9d092..f13a1c9b 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1666,10 +1666,14 @@ namespace slskd
try
{
+ // note: the Picture setting is validated at startup to ensure it exists and that
+ // it is readable
pictureBytes = await System.IO.File.ReadAllBytesAsync(Options.Soulseek.Picture);
}
catch (Exception ex)
{
+ // this isn't a serious enough problem to prevent us from continuing, so we'll just
+ // log a warning and continue, omitting the picture
Log.Warning("Failed to read Soulseek picture {Picture}: {Message}", Options.Soulseek.Picture, ex.Message);
}
diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs
index 55b02134..2e312f69 100644
--- a/src/slskd/Users/UserService.cs
+++ b/src/slskd/Users/UserService.cs
@@ -19,16 +19,13 @@ using Microsoft.Extensions.Options;
namespace slskd.Users
{
- using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
- using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using NetTools;
using Serilog;
- using slskd.Files;
using Soulseek;
///
diff --git a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
index 8581a966..ca45d5b9 100644
--- a/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
+++ b/tests/slskd.Tests.Unit/Users/UserServiceTests.cs
@@ -1,10 +1,8 @@
namespace slskd.Tests.Unit.Users
{
using System.Collections.Generic;
- using System.IO;
using AutoFixture.Xunit2;
using Moq;
- using slskd.Files;
using slskd.Users;
using Soulseek;
using Xunit;
@@ -136,12 +134,10 @@
public Mocks(Options options = null)
{
OptionsMonitor = new TestOptionsMonitor(options ?? new Options());
- FileService = new FileService(OptionsMonitor);
}
public Mock SoulseekClient { get; } = new Mock();
public TestOptionsMonitor OptionsMonitor { get; init; }
- public FileService FileService { get; init; }
}
}
}
--
cgit v1.2.3
From 8571f94db79d118bf5a2c62a713bb96e5deb9330 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Mon, 7 Apr 2025 13:59:25 -0500
Subject: docs
---
docs/config.md | 2 ++
src/slskd/Users/UserService.cs | 1 +
2 files changed, 3 insertions(+)
(limited to 'src')
diff --git a/docs/config.md b/docs/config.md
index 92798196..a582c783 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -683,11 +683,13 @@ soulseek:
| Command-Line | Environment Variable | Description |
| -------------------- | -------------------------- | --------------------------------------------- |
| `--slsk-description` | `SLSKD_SLSK_DESCRIPTION` | The user description for the Soulseek network |
+| `--slsk-picture` | `SLSKD_SLSK_PICTURE` | The user picture for the Soulseek network |
#### **YAML**
```yaml
soulseek:
description: A slskd user. https://github.com/slskd/slskd
+ picture: path/to/slsk-profile-picture.jpg
```
## Connection Options
diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs
index 2e312f69..ead1d812 100644
--- a/src/slskd/Users/UserService.cs
+++ b/src/slskd/Users/UserService.cs
@@ -75,6 +75,7 @@ namespace slskd.Users
IOptionsMonitor optionsMonitor)
{
Client = soulseekClient;
+
OptionsMonitor = optionsMonitor;
OptionsMonitor.OnChange(options => Configure(options));
--
cgit v1.2.3
From 8c98fc35ca41cf52e6af746e608926b516fe3ad8 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Mon, 7 Apr 2025 14:46:58 -0500
Subject: check for configured file before trying to read it
---
src/slskd/Application.cs | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
(limited to 'src')
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index f13a1c9b..9179987e 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1664,17 +1664,20 @@ namespace slskd
{
byte[] pictureBytes = null;
- try
+ if (!string.IsNullOrWhiteSpace(Options.Soulseek.Picture))
{
- // note: the Picture setting is validated at startup to ensure it exists and that
- // it is readable
- pictureBytes = await System.IO.File.ReadAllBytesAsync(Options.Soulseek.Picture);
- }
- catch (Exception ex)
- {
- // this isn't a serious enough problem to prevent us from continuing, so we'll just
- // log a warning and continue, omitting the picture
- Log.Warning("Failed to read Soulseek picture {Picture}: {Message}", Options.Soulseek.Picture, ex.Message);
+ try
+ {
+ // note: the Picture setting is validated at startup to ensure it exists and that
+ // it is readable
+ pictureBytes = await System.IO.File.ReadAllBytesAsync(Options.Soulseek.Picture);
+ }
+ catch (Exception ex)
+ {
+ // this isn't a serious enough problem to prevent us from continuing, so we'll just
+ // log a warning and continue, omitting the picture
+ Log.Warning("Failed to read Soulseek picture {Picture}: {Message}", Options.Soulseek.Picture, ex.Message);
+ }
}
if (Users.IsBlacklisted(username, endpoint.Address))
--
cgit v1.2.3
From 4d7db187c45ae651f2ee8fd3202535dc1e1818b7 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sat, 12 Apr 2025 15:58:23 -0500
Subject: bump Soulseek to 7.0.3
---
src/slskd/slskd.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/slskd/slskd.csproj b/src/slskd/slskd.csproj
index 0a5d0683..39248289 100644
--- a/src/slskd/slskd.csproj
+++ b/src/slskd/slskd.csproj
@@ -67,7 +67,7 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
--
cgit v1.2.3
From 3002b497f542e12f4b42eac949c3d1333932fb2a Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sat, 12 Apr 2025 15:58:48 -0500
Subject: update frontend to handle multiple directory responses
---
src/web/src/components/Search/Response.jsx | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/web/src/components/Search/Response.jsx b/src/web/src/components/Search/Response.jsx
index 40029b0c..f665c816 100644
--- a/src/web/src/components/Search/Response.jsx
+++ b/src/web/src/components/Search/Response.jsx
@@ -83,11 +83,17 @@ class Response extends Component {
const oldTree = { ...this.state.tree };
const oldFiles = oldTree[directory];
- const { files, name } = await getDirectoryContents({
+ // some clients might send more than one directory in the response,
+ // if the requested directory contains subdirectories. the root directory
+ // is always first, and for now we'll only display the contents of that.
+ const allDirectories = await getDirectoryContents({
directory,
username,
});
+ const theRootDirectory = allDirectories?.[0];
+ const { files, name } = theRootDirectory;
+
// the api returns file names only, so we need to prepend the directory
// to make it look like a search result. we also need to preserve
// any file selections, so check the old files and assign accordingly
--
cgit v1.2.3
From e3bb26aaad24e9cc914cc6c8f0d0575fc76b85ae Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sat, 12 Apr 2025 15:59:07 -0500
Subject: update swagger def to indicate multiple directory return type
---
src/slskd/Users/API/Controllers/UsersController.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/slskd/Users/API/Controllers/UsersController.cs b/src/slskd/Users/API/Controllers/UsersController.cs
index 01df31d1..da581ab8 100644
--- a/src/slskd/Users/API/Controllers/UsersController.cs
+++ b/src/slskd/Users/API/Controllers/UsersController.cs
@@ -152,7 +152,7 @@ namespace slskd.Users.API
///
[HttpPost("{username}/directory")]
[Authorize(Policy = AuthPolicy.Any)]
- [ProducesResponseType(typeof(Directory), 200)]
+ [ProducesResponseType(typeof(IEnumerable), 200)]
[ProducesResponseType(404)]
public async Task Directory([FromRoute, Required] string username, [FromBody, Required] DirectoryContentsRequest request)
{
--
cgit v1.2.3
From 66c60cadfa300d88f1b66d9e4d6174803b18c3ef Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sat, 12 Apr 2025 16:01:09 -0500
Subject: show Soulseek.NET diagnostic stack traces when debugging
---
src/slskd/Application.cs | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'src')
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 9179987e..2449e8e0 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -830,6 +830,12 @@ namespace slskd
var logger = Loggers.GetOrAdd(source, Log.ForContext("Context", "Soulseek").ForContext("SubContext", source));
+ if (args.IncludesException && OptionsAtStartup.Debug)
+ {
+ logger.Write(TranslateLogLevel(args.Level), exception: args.Exception, "{@Message}", args.Message);
+ return;
+ }
+
logger.Write(TranslateLogLevel(args.Level), "{@Message}", args.Message);
}
--
cgit v1.2.3
From ea9daa02426624080a5ea9322b198bbc893dacf4 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 12 Apr 2025 22:17:56 +0000
Subject: Bump @babel/runtime from 7.22.5 to 7.27.0 in /src/web
Bumps [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) from 7.22.5 to 7.27.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.27.0/packages/babel-runtime)
---
updated-dependencies:
- dependency-name: "@babel/runtime"
dependency-version: 7.27.0
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
---
src/web/package-lock.json | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
(limited to 'src')
diff --git a/src/web/package-lock.json b/src/web/package-lock.json
index a61bca8f..1d9bcac4 100644
--- a/src/web/package-lock.json
+++ b/src/web/package-lock.json
@@ -2316,11 +2316,12 @@
"dev": true
},
"node_modules/@babel/runtime": {
- "version": "7.22.5",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.5.tgz",
- "integrity": "sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA==",
+ "version": "7.27.0",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz",
+ "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==",
+ "license": "MIT",
"dependencies": {
- "regenerator-runtime": "^0.13.11"
+ "regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
@@ -2345,6 +2346,12 @@
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"dev": true
},
+ "node_modules/@babel/runtime/node_modules/regenerator-runtime": {
+ "version": "0.14.1",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
+ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
+ "license": "MIT"
+ },
"node_modules/@babel/template": {
"version": "7.23.9",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz",
@@ -17690,7 +17697,8 @@
"node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
- "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
+ "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
+ "dev": true
},
"node_modules/regenerator-transform": {
"version": "0.15.1",
--
cgit v1.2.3
From cec3695c366849276056f9df2a62ef742622a7c1 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 12 Apr 2025 23:43:35 +0000
Subject: Bump axios from 0.25.0 to 0.30.0 in /src/web
Bumps [axios](https://github.com/axios/axios) from 0.25.0 to 0.30.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.30.0/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.25.0...v0.30.0)
---
updated-dependencies:
- dependency-name: axios
dependency-version: 0.30.0
dependency-type: direct:production
...
Signed-off-by: dependabot[bot]
---
src/web/package-lock.json | 178 +++++++++++++++++++++++++++++++++-------------
src/web/package.json | 2 +-
2 files changed, 130 insertions(+), 50 deletions(-)
(limited to 'src')
diff --git a/src/web/package-lock.json b/src/web/package-lock.json
index 1d9bcac4..a6c3b7e0 100644
--- a/src/web/package-lock.json
+++ b/src/web/package-lock.json
@@ -13,7 +13,7 @@
"@codemirror/legacy-modes": "^6.0.0",
"@microsoft/signalr": "^7.0.7",
"@uiw/react-codemirror": "^4.2.4",
- "axios": "^0.25.0",
+ "axios": "^0.30.0",
"lz-string": "^1.4.4",
"react": "^16.8.6",
"react-dom": "^16.8.6",
@@ -5881,8 +5881,7 @@
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
- "dev": true
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/at-least-node": {
"version": "1.0.0",
@@ -5948,11 +5947,29 @@
}
},
"node_modules/axios": {
- "version": "0.25.0",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz",
- "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==",
+ "version": "0.30.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.30.0.tgz",
+ "integrity": "sha512-Z4F3LjCgfjZz8BMYalWdMgAQUnEtKDmpwNHjh/C8pQZWde32TF64cqnSeyL3xD/aTIASRU30RHTNzRiV/NpGMg==",
+ "license": "MIT",
+ "dependencies": {
+ "follow-redirects": "^1.15.4",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
+ "node_modules/axios/node_modules/form-data": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz",
+ "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
+ "license": "MIT",
"dependencies": {
- "follow-redirects": "^1.14.7"
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
}
},
"node_modules/axobject-query": {
@@ -6506,6 +6523,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -6905,7 +6935,6 @@
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "dev": true,
"dependencies": {
"delayed-stream": "~1.0.0"
},
@@ -7777,7 +7806,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
- "dev": true,
"engines": {
"node": ">=0.4.0"
}
@@ -8039,6 +8067,20 @@
"node": ">=4"
}
},
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
@@ -8233,13 +8275,10 @@
"dev": true
},
"node_modules/es-define-property": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
- "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
- "dev": true,
- "dependencies": {
- "get-intrinsic": "^1.2.4"
- },
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
"engines": {
"node": ">= 0.4"
}
@@ -8248,7 +8287,6 @@
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
- "dev": true,
"engines": {
"node": ">= 0.4"
}
@@ -8311,15 +8349,28 @@
"integrity": "sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA==",
"dev": true
},
+ "node_modules/es-object-atoms": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/es-set-tostringtag": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz",
- "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==",
- "dev": true,
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
+ "license": "MIT",
"dependencies": {
- "get-intrinsic": "^1.2.2",
- "has-tostringtag": "^1.0.0",
- "hasown": "^2.0.0"
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
@@ -10979,7 +11030,6 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
- "dev": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -11030,16 +11080,21 @@
}
},
"node_modules/get-intrinsic": {
- "version": "1.2.4",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
- "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
- "dev": true,
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
"dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
- "has-proto": "^1.0.1",
- "has-symbols": "^1.0.3",
- "hasown": "^2.0.0"
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
@@ -11063,6 +11118,19 @@
"node": ">=8.0.0"
}
},
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/get-set-props": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/get-set-props/-/get-set-props-0.1.0.tgz",
@@ -11239,12 +11307,12 @@
}
},
"node_modules/gopd": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
- "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
- "dev": true,
- "dependencies": {
- "get-intrinsic": "^1.1.3"
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -11454,10 +11522,10 @@
}
},
"node_modules/has-symbols": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
- "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
- "dev": true,
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
"engines": {
"node": ">= 0.4"
},
@@ -11469,7 +11537,6 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
- "dev": true,
"dependencies": {
"has-symbols": "^1.0.3"
},
@@ -11481,10 +11548,10 @@
}
},
"node_modules/hasown": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
- "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
- "dev": true,
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+ "license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
@@ -14499,6 +14566,15 @@
"css-mediaquery": "^0.1.2"
}
},
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/mdn-data": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz",
@@ -14611,7 +14687,6 @@
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
- "dev": true,
"engines": {
"node": ">= 0.6"
}
@@ -14620,7 +14695,6 @@
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
- "dev": true,
"dependencies": {
"mime-db": "1.52.0"
},
@@ -17021,6 +17095,12 @@
"node": ">= 0.10"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "license": "MIT"
+ },
"node_modules/prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
diff --git a/src/web/package.json b/src/web/package.json
index 49990771..46835e0e 100644
--- a/src/web/package.json
+++ b/src/web/package.json
@@ -18,7 +18,7 @@
"@codemirror/legacy-modes": "^6.0.0",
"@microsoft/signalr": "^7.0.7",
"@uiw/react-codemirror": "^4.2.4",
- "axios": "^0.25.0",
+ "axios": "^0.30.0",
"lz-string": "^1.4.4",
"react": "^16.8.6",
"react-dom": "^16.8.6",
--
cgit v1.2.3
From c08ac7740ac2bd0b7013a4ed7af107117f0dee76 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sun, 13 Apr 2025 15:13:06 -0500
Subject: improve directory response error handling
---
src/web/src/components/Search/Response.jsx | 45 ++++++++++++++++++++----------
1 file changed, 31 insertions(+), 14 deletions(-)
(limited to 'src')
diff --git a/src/web/src/components/Search/Response.jsx b/src/web/src/components/Search/Response.jsx
index f665c816..079b91ba 100644
--- a/src/web/src/components/Search/Response.jsx
+++ b/src/web/src/components/Search/Response.jsx
@@ -91,22 +91,39 @@ class Response extends Component {
username,
});
- const theRootDirectory = allDirectories?.[0];
- const { files, name } = theRootDirectory;
+ // todo: deleteme
+ console.log('allDirectories', allDirectories);
+ console.log('allDirectoriesJson', JSON.stringify(allDirectories));
- // the api returns file names only, so we need to prepend the directory
- // to make it look like a search result. we also need to preserve
- // any file selections, so check the old files and assign accordingly
- const fixedFiles = files.map((file) => ({
- ...file,
- filename: `${directory}\\${file.filename}`,
- selected:
- oldFiles.find((f) => f.filename === `${directory}\\${file.filename}`)
- ?.selected ?? false,
- }));
+ try {
+ const theRootDirectory = allDirectories?.[0];
+
+ if (!theRootDirectory) {
+ throw new Error('No directories were included in the response');
+ }
- oldTree[name] = fixedFiles;
- this.setState({ tree: { ...oldTree } });
+ const { files, name } = theRootDirectory;
+
+ // the api returns file names only, so we need to prepend the directory
+ // to make it look like a search result. we also need to preserve
+ // any file selections, so check the old files and assign accordingly
+ const fixedFiles = files.map((file) => ({
+ ...file,
+ filename: `${directory}\\${file.filename}`,
+ selected:
+ oldFiles.find(
+ (f) => f.filename === `${directory}\\${file.filename}`,
+ )?.selected ?? false,
+ }));
+
+ oldTree[name] = fixedFiles;
+ this.setState({ tree: { ...oldTree } });
+ } catch (error) {
+ throw new Error(
+ `Failed to process the requested folder response: ${error}`,
+ { cause: error },
+ );
+ }
} catch (error) {
console.error(error);
toast.error(error?.response?.data ?? error?.message ?? error);
--
cgit v1.2.3
From 860593e7f576cfe133cb594a331ceb87748af938 Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sun, 13 Apr 2025 15:20:48 -0500
Subject: log result
---
src/slskd/Users/API/Controllers/UsersController.cs | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'src')
diff --git a/src/slskd/Users/API/Controllers/UsersController.cs b/src/slskd/Users/API/Controllers/UsersController.cs
index da581ab8..821baa9b 100644
--- a/src/slskd/Users/API/Controllers/UsersController.cs
+++ b/src/slskd/Users/API/Controllers/UsersController.cs
@@ -26,6 +26,8 @@ namespace slskd.Users.API
using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+ using Serilog;
+
using Soulseek;
///
@@ -57,6 +59,7 @@ namespace slskd.Users.API
private ISoulseekClient Client { get; }
private IUserService Users { get; }
private IOptionsSnapshot OptionsSnapshot { get; }
+ private ILogger Log { get; set; } = Serilog.Log.ForContext();
///
/// Retrieves the address of the specified .
@@ -169,6 +172,9 @@ namespace slskd.Users.API
try
{
var result = await Client.GetDirectoryContentsAsync(username, request.Directory);
+
+ Log.Debug("{Endpoint} response from {User} for directory '{Directory}': {@Response}", nameof(Directory), username, request.Directory, result);
+
return Ok(result);
}
catch (UserOfflineException ex)
--
cgit v1.2.3
From 951b65d273fd4dcfe1508aabf2b5b4e833ecc0fa Mon Sep 17 00:00:00 2001
From: JP Dillingham
Date: Sun, 13 Apr 2025 15:20:53 -0500
Subject: shorten message
---
src/web/src/components/Search/Response.jsx | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
(limited to 'src')
diff --git a/src/web/src/components/Search/Response.jsx b/src/web/src/components/Search/Response.jsx
index 079b91ba..0d94ee8c 100644
--- a/src/web/src/components/Search/Response.jsx
+++ b/src/web/src/components/Search/Response.jsx
@@ -83,21 +83,17 @@ class Response extends Component {
const oldTree = { ...this.state.tree };
const oldFiles = oldTree[directory];
- // some clients might send more than one directory in the response,
- // if the requested directory contains subdirectories. the root directory
- // is always first, and for now we'll only display the contents of that.
- const allDirectories = await getDirectoryContents({
- directory,
- username,
- });
-
- // todo: deleteme
- console.log('allDirectories', allDirectories);
- console.log('allDirectoriesJson', JSON.stringify(allDirectories));
-
try {
+ // some clients might send more than one directory in the response,
+ // if the requested directory contains subdirectories. the root directory
+ // is always first, and for now we'll only display the contents of that.
+ const allDirectories = await getDirectoryContents({
+ directory,
+ username,
+ });
const theRootDirectory = allDirectories?.[0];
+ // some clients might send an empty response for some reason
if (!theRootDirectory) {
throw new Error('No directories were included in the response');
}
@@ -119,10 +115,9 @@ class Response extends Component {
oldTree[name] = fixedFiles;
this.setState({ tree: { ...oldTree } });
} catch (error) {
- throw new Error(
- `Failed to process the requested folder response: ${error}`,
- { cause: error },
- );
+ throw new Error(`Failed to process directory response: ${error}`, {
+ cause: error,
+ });
}
} catch (error) {
console.error(error);
--
cgit v1.2.3