aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-06-07 16:40:56 -0500
committerGitHub <noreply@github.com>2026-06-07 16:40:56 -0500
commitd3dbc50b44ae12a7ae9f10bbef074adcbe75cfa5 (patch)
tree16b5c69f3363b4e2517b117b5c4eaaae3b223a41 /src
parentba9cf1be9c795ac0ef4ff72935427de362c9cdd0 (diff)
parentec0dd1430f8987fc7cc2550975ff4ec3d80a3147 (diff)
downloadslskd-d3dbc50b44ae12a7ae9f10bbef074adcbe75cfa5.tar.gz
Merge branch 'master' into master
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Common/Cryptography/X509.cs4
-rw-r--r--src/slskd/Common/OpenAPI/ContentNegotiationOperationFilter.cs2
-rw-r--r--src/slskd/Core/Options.cs100
-rw-r--r--src/slskd/Files/FileService.cs12
-rw-r--r--src/slskd/Program.cs15
-rw-r--r--src/slskd/Transfers/Downloads/DownloadService.cs4
-rw-r--r--src/slskd/slskd.csproj40
-rw-r--r--src/web/package-lock.json21
8 files changed, 101 insertions, 97 deletions
diff --git a/src/slskd/Common/Cryptography/X509.cs b/src/slskd/Common/Cryptography/X509.cs
index bed224cf..b003decf 100644
--- a/src/slskd/Common/Cryptography/X509.cs
+++ b/src/slskd/Common/Cryptography/X509.cs
@@ -64,7 +64,7 @@ namespace slskd.Cryptography
new DateTimeOffset(DateTime.UtcNow.AddDays(-1)),
new DateTimeOffset(DateTime.UtcNow.AddDays(36500)));
- return new X509Certificate2(certificate.Export(X509ContentType.Pkcs12, password), password, x509KeyStorageFlags);
+ return X509CertificateLoader.LoadPkcs12(certificate.Export(X509ContentType.Pkcs12, password), password, x509KeyStorageFlags);
}
/// <summary>
@@ -80,7 +80,7 @@ namespace slskd.Cryptography
try
{
- _ = new X509Certificate2(fileName, password);
+ _ = X509CertificateLoader.LoadPkcs12FromFile(fileName, password);
return true;
}
catch (Exception ex)
diff --git a/src/slskd/Common/OpenAPI/ContentNegotiationOperationFilter.cs b/src/slskd/Common/OpenAPI/ContentNegotiationOperationFilter.cs
index a7e7e0dc..760f7ba9 100644
--- a/src/slskd/Common/OpenAPI/ContentNegotiationOperationFilter.cs
+++ b/src/slskd/Common/OpenAPI/ContentNegotiationOperationFilter.cs
@@ -36,7 +36,7 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Formatters;
-using Microsoft.OpenApi.Models;
+using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;
/// <summary>
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 29d37806..d1062a2c 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -235,11 +235,8 @@ namespace slskd
[Validate]
public RelayOptions Relay { get; init; } = new RelayOptions();
- /// <summary>
- /// Gets permission options.
- /// </summary>
- [Validate]
- public PermissionsOptions Permissions { get; init; } = new PermissionsOptions();
+ [Obsolete("temporary sentinel to warn users about breaking change. use Transfers.Download.Destination.Permissions instead.")]
+ public object Permissions { get; init; } = null;
/// <summary>
/// Gets directory options.
@@ -364,6 +361,11 @@ namespace slskd
{
results.Add(new ValidationResult("The 'integration' key has been renamed to 'integrations'. Add an 's' to the end of the key to remove this error (no other changes were made)"));
}
+
+ if (Permissions is not null)
+ {
+ results.Add(new ValidationResult("The 'permissions' keys have been moved under a new 'destination' key under transfers -> download, and the behavior has changed. See https://github.com/slskd/slskd/pull/1756 for details"));
+ }
#pragma warning restore CS0618 // Type or member is obsolete
return results;
@@ -704,57 +706,6 @@ namespace slskd
}
/// <summary>
- /// Permission options.
- /// </summary>
- public class PermissionsOptions
- {
- /// <summary>
- /// Gets file permission options.
- /// </summary>
- [Validate]
- public FileOptions File { get; init; } = new FileOptions();
-
- /// <summary>
- /// File permission options.
- /// </summary>
- public class FileOptions : IValidatableObject
- {
- /// <summary>
- /// Gets the permissions to apply to newly created files.
- /// </summary>
- /// <remarks>
- /// Applicable to non-Windows operating systems, only.
- /// </remarks>
- [Argument(default, "file-permission-mode")]
- [EnvironmentVariable("FILE_PERMISSION_MODE")]
- [Description("the permissions to apply to newly created files (chmod syntax, non-Windows only)")]
- public string Mode { get; init; }
-
- /// <summary>
- /// Extended validation.
- /// </summary>
- /// <param name="validationContext"></param>
- /// <returns></returns>
- public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
- {
- var results = new List<ValidationResult>();
-
- if (!string.IsNullOrEmpty(Mode))
- {
- var regEx = new Regex("^[0-7]{3,4}$", RegexOptions.Compiled);
-
- if (!regEx.IsMatch(Mode))
- {
- results.Add(new ValidationResult($"Field {nameof(Mode)} is invalid. Specify a three- or four-character string consisting of only 0-7 (chmod syntax, [0]000-[7]777, inclusive)"));
- }
- }
-
- return results;
- }
- }
- }
-
- /// <summary>
/// Directory options.
/// </summary>
public class DirectoriesOptions
@@ -1082,6 +1033,43 @@ namespace slskd
/// </summary>
[Enum(typeof(DestinationExistsStrategy))]
public string Exists { get; init; } = DestinationExistsStrategy.Rename.ToString().ToLowerInvariant();
+
+ /// <summary>
+ /// Gets the permissions to apply to downloaded files and directories.
+ /// </summary>
+ [Validate]
+ public DestinationPermissionsOptions Permissions { get; init; } = new DestinationPermissionsOptions();
+
+ /// <summary>
+ /// Download destination permission options.
+ /// </summary>
+ public class DestinationPermissionsOptions : IValidatableObject
+ {
+ /// <summary>
+ /// Gets the permissions to apply to newly created files.
+ /// </summary>
+ /// <remarks>
+ /// Applicable to non-Windows operating systems, only.
+ /// </remarks>
+ public string Mode { get; init; }
+
+ public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
+ {
+ var results = new List<ValidationResult>();
+
+ if (!string.IsNullOrEmpty(Mode))
+ {
+ var regEx = new Regex("^[0-7]{3,4}$", RegexOptions.Compiled);
+
+ if (!regEx.IsMatch(Mode))
+ {
+ results.Add(new ValidationResult($"Field {nameof(Mode)} is invalid. Specify a three- or four-character string consisting of only 0-7 (chmod syntax, [0]000-[7]777, inclusive)"));
+ }
+ }
+
+ return results;
+ }
+ }
}
}
diff --git a/src/slskd/Files/FileService.cs b/src/slskd/Files/FileService.cs
index 3b304d99..62d17f20 100644
--- a/src/slskd/Files/FileService.cs
+++ b/src/slskd/Files/FileService.cs
@@ -389,13 +389,15 @@ namespace slskd.Files
var path = Path.GetDirectoryName(filename);
- UnixFileMode? unixCreateMode = options?.UnixCreateMode ?? OptionsMonitor.CurrentValue.Permissions.File.Mode?.ToUnixFileMode();
+ UnixFileMode? unixCreateMode = options?.UnixCreateMode ?? OptionsMonitor.CurrentValue.Transfers.Download.Destination.Permissions.Mode?.ToUnixFileMode();
if (!Directory.Exists(path))
{
if (!OperatingSystem.IsWindows() && unixCreateMode.HasValue)
{
- Directory.CreateDirectory(path, unixCreateMode.Value.WithExecuteFlagsForEachReadFlag());
+ var mode = unixCreateMode.Value.WithExecuteFlagsForEachReadFlag();
+ Directory.CreateDirectory(path, unixCreateMode: mode);
+ File.SetUnixFileMode(path, mode: mode);
}
else
{
@@ -469,13 +471,15 @@ namespace slskd.Files
throw new FileNotFoundException($"The specified source file does not exist", fileName: sourceFilename);
}
- UnixFileMode? unixCreateMode = unixFileMode ?? OptionsMonitor.CurrentValue.Permissions.File.Mode?.ToUnixFileMode();
+ UnixFileMode? unixCreateMode = unixFileMode ?? OptionsMonitor.CurrentValue.Transfers.Download.Destination.Permissions.Mode?.ToUnixFileMode();
if (!Directory.Exists(destinationDirectory))
{
if (!OperatingSystem.IsWindows() && unixCreateMode.HasValue)
{
- Directory.CreateDirectory(destinationDirectory, unixCreateMode.Value.WithExecuteFlagsForEachReadFlag());
+ var mode = unixCreateMode.Value.WithExecuteFlagsForEachReadFlag();
+ Directory.CreateDirectory(destinationDirectory, unixCreateMode: mode);
+ File.SetUnixFileMode(destinationDirectory, mode: mode);
}
else
{
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index d4baf276..9a2914ea 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -62,11 +62,12 @@ namespace slskd
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.FileProviders.Physical;
using Microsoft.IdentityModel.Tokens;
- using Microsoft.OpenApi.Models;
+ using Microsoft.OpenApi;
using Prometheus.DotNetRuntime;
using Prometheus.SystemMetrics;
using Serilog;
using Serilog.Events;
+ using Serilog.Formatting.Display;
using Serilog.Sinks.Grafana.Loki;
using Serilog.Sinks.SystemConsole.Themes;
using slskd.Authentication;
@@ -1007,6 +1008,7 @@ namespace slskd
services.AddSwaggerGen(options =>
{
options.DescribeAllParametersInCamelCase();
+ options.CustomSchemaIds(type => type.FullName);
options.SwaggerDoc("v0", new OpenApiInfo
{
Version = "v0",
@@ -1216,6 +1218,7 @@ namespace slskd
.MinimumLevel.Override("slskd.Authentication.PassthroughAuthenticationHandler", LogEventLevel.Warning)
.MinimumLevel.Override("slskd.Authentication.ApiKeyAuthenticationHandler", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore.Database.Command", LogEventLevel.Warning) // bump this down to Information to show SQL
+ .Enrich.WithProperty("App", AppName)
.Enrich.WithProperty("InstanceName", OptionsAtStartup.InstanceName)
.Enrich.WithProperty("InvocationId", InvocationId)
.Enrich.WithProperty("ProcessId", ProcessId)
@@ -1234,9 +1237,13 @@ namespace slskd
retainedFileTimeLimit: TimeSpan.FromDays(OptionsAtStartup.Retention.Logs))))
.WriteTo.Conditional(
e => !string.IsNullOrEmpty(OptionsAtStartup.Logger.Loki),
- config => config.GrafanaLoki(
- OptionsAtStartup.Logger.Loki ?? string.Empty,
- outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"))
+ config =>
+ {
+ if (!string.IsNullOrEmpty(OptionsAtStartup.Logger.Loki))
+ {
+ config.GrafanaLoki(OptionsAtStartup.Logger.Loki);
+ }
+ })
.WriteTo.Sink(new DelegatingSink(logEvent =>
{
string message = default;
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs
index c6892fc4..7c794e55 100644
--- a/src/slskd/Transfers/Downloads/DownloadService.cs
+++ b/src/slskd/Transfers/Downloads/DownloadService.cs
@@ -1218,8 +1218,8 @@ namespace slskd.Transfers.Downloads
}),
disposeOutputStreamOnCompletion: true);
- UnixFileMode? unixFileMode = !string.IsNullOrEmpty(OptionsMonitor.CurrentValue.Permissions.File.Mode)
- ? OptionsMonitor.CurrentValue.Permissions.File.Mode.ToUnixFileMode()
+ UnixFileMode? unixFileMode = !string.IsNullOrEmpty(OptionsMonitor.CurrentValue.Transfers.Download.Destination.Permissions.Mode)
+ ? OptionsMonitor.CurrentValue.Transfers.Download.Destination.Permissions.Mode.ToUnixFileMode()
: null;
/*
diff --git a/src/slskd/slskd.csproj b/src/slskd/slskd.csproj
index cf825701..cb6a7d83 100644
--- a/src/slskd/slskd.csproj
+++ b/src/slskd/slskd.csproj
@@ -43,41 +43,41 @@
</Target>
<ItemGroup>
- <PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
- <PackageReference Include="Dapper" Version="2.1.66" />
+ <PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="10.0.0" />
+ <PackageReference Include="Dapper" Version="2.1.79" />
<PackageReference Include="FluentFTP" Version="49.0.2" />
- <PackageReference Include="IPAddressRange" Version="6.0.0" />
- <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
- <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
- <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
+ <PackageReference Include="IPAddressRange" Version="6.3.0" />
+ <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.8" />
+ <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="10.0.8" />
+ <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.300">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.6" />
- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
- <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="8.0.6" />
+ <PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.8" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.8" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="10.0.8" />
<PackageReference Include="OneOf" Version="3.0.271" />
<PackageReference Include="prometheus-net" Version="8.2.1" />
<PackageReference Include="prometheus-net.AspNetCore" Version="8.2.1" />
<PackageReference Include="prometheus-net.AspNetCore.HealthChecks" Version="8.2.1" />
- <PackageReference Include="prometheus-net.DotNetRuntime" Version="4.4.0" />
+ <PackageReference Include="prometheus-net.DotNetRuntime" Version="4.4.1" />
<PackageReference Include="prometheus-net.SystemMetrics" Version="3.1.0" />
- <PackageReference Include="Serilog" Version="3.1.1" />
- <PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
- <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
- <PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
- <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
- <PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="7.1.1" />
- <PackageReference Include="Serilog.Sinks.Http" Version="8.0.0" />
- <PackageReference Include="Soulseek" Version="10.0.0" />
+ <PackageReference Include="Serilog" Version="4.3.1" />
+ <PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
+ <PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
+ <PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
+ <PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
+ <PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="9.0.0" />
+ <PackageReference Include="Serilog.Sinks.Http" Version="9.2.1" />
+ <PackageReference Include="Soulseek" Version="10.0.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
+ <PackageReference Include="Swashbuckle.AspNetCore" Version="10.2.1" />
<PackageReference Include="TagLibSharp" Version="2.3.0" />
<PackageReference Include="Utility.CommandLine.Arguments" Version="6.0.0" />
<PackageReference Include="Utility.EnvironmentVariables" Version="1.0.5" />
- <PackageReference Include="YamlDotNet" Version="15.3.0" />
+ <PackageReference Include="YamlDotNet" Version="18.0.0" />
</ItemGroup>
</Project>
diff --git a/src/web/package-lock.json b/src/web/package-lock.json
index 22d9c714..e64bc38d 100644
--- a/src/web/package-lock.json
+++ b/src/web/package-lock.json
@@ -14304,13 +14304,14 @@
}
},
"node_modules/launch-editor": {
- "version": "2.6.0",
- "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.6.0.tgz",
- "integrity": "sha512-JpDCcQnyAAzZZaZ7vEiSqL690w7dAEyLao+KC96zBplnYbJS7TYNjvM3M7y3dGz+v7aIsJk3hllWuc0kWAjyRQ==",
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.14.1.tgz",
+ "integrity": "sha512-QWBrQsMpH7gPr965dsKD/3cKWiNoTjpATQf++Xq63N6sKRGMwlVXz41O1IZTMfZQgBctD/K5Zt06+/I6pP6+HA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "picocolors": "^1.0.0",
- "shell-quote": "^1.7.3"
+ "picocolors": "^1.1.1",
+ "shell-quote": "^1.8.4"
}
},
"node_modules/less": {
@@ -18840,10 +18841,14 @@
}
},
"node_modules/shell-quote": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz",
- "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==",
+ "version": "1.8.4",
+ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.4.tgz",
+ "integrity": "sha512-VsC6n6vz1ihYYyZZwX7YZSF5l5x36ca17OC+a69h94YqB7X6XLwf+5MOgynYir2SLFUbl8gIYvBo8K8RoNQ6bQ==",
"dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
"funding": {
"url": "https://github.com/sponsors/ljharb"
}