diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-11-05 08:24:56 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-11-05 08:24:56 -0500 |
| commit | a79b0b20e576fde74067614c48398586e7eeb958 (patch) | |
| tree | 2c1d5925a47360806bc4b4ffa23276ca676ccf73 /src | |
| parent | c97abdba209bc96886b28b6cb4bdd5886ed3de33 (diff) | |
| download | slskd-a79b0b20e576fde74067614c48398586e7eeb958.tar.gz | |
bump dependencies
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Common/Configuration/CommandLineConfigurationSource.cs | 53 | ||||
| -rw-r--r-- | src/slskd/Common/ManagedState.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Core/API/Controllers/ConfigurationController.cs | 1 | ||||
| -rw-r--r-- | src/slskd/Core/API/Hubs/ApplicationHub.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Options.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Program.cs | 6 | ||||
| -rw-r--r-- | src/slskd/Shares/SharedFileCache.cs | 5 | ||||
| -rw-r--r-- | src/slskd/slskd.csproj | 22 |
9 files changed, 48 insertions, 51 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 681384b3..f15d80ec 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -441,9 +441,9 @@ namespace slskd } } - private void Client_UserStatusChanged(object sender, UserStatusChangedEventArgs args) + private void Client_UserStatusChanged(object sender, UserStatus args) { - Console.WriteLine($"[USER] {args.Username}: {args.Status}"); + Console.WriteLine($"[USER] {args.Username}: {args.Presence}"); } /// <summary> diff --git a/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs b/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs index 0436c922..96d8d623 100644 --- a/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs +++ b/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs @@ -111,45 +111,42 @@ namespace slskd.Configuration var longName = (string)attribute.ConstructorArguments[1].Value; var arguments = new[] { shortName, longName }.Where(i => !string.IsNullOrEmpty(i)); - foreach (var argument in arguments) + foreach (var argument in arguments.Where(argument => dictionary.ContainsKey(argument))) { - if (dictionary.ContainsKey(argument)) + // if the backing type is an array, it supports multiple values. + if (property.PropertyType.IsArray) { - // if the backing type is an array, it supports multiple values. - if (property.PropertyType.IsArray) - { - var value = dictionary[argument]; + var value = dictionary[argument]; - // Parse() will stuff multiple values into a List<T> if the argument name is - // in the list of those supporting multiple values, and more than one value was supplied. - // detect this, and add the values to the target. - if (value.GetType().IsGenericType && value.GetType().GetGenericTypeDefinition() == typeof(List<>)) - { - var elements = (List<object>)dictionary[argument]; + // Parse() will stuff multiple values into a List<T> if the argument name is + // in the list of those supporting multiple values, and more than one value was supplied. + // detect this, and add the values to the target. + if (value.GetType().IsGenericType && value.GetType().GetGenericTypeDefinition() == typeof(List<>)) + { + var elements = (List<object>)dictionary[argument]; - for (int i = 0; i < elements.Count; i++) - { - Data[ConfigurationPath.Combine(key, i.ToString())] = elements[i].ToString(); - } - } - else + for (int i = 0; i < elements.Count; i++) { - // there may have only been one value supplied, in which case the value is just a - // string. stick it in index 0 of the target. - Data[ConfigurationPath.Combine(key, "0")] = value.ToString(); + Data[ConfigurationPath.Combine(key, i.ToString())] = elements[i].ToString(); } } else { - var value = dictionary[argument].ToString(); - - if (property.PropertyType == typeof(bool) && string.IsNullOrEmpty(value)) - { - value = "true"; - } + // there may have only been one value supplied, in which case the value is just a + // string. stick it in index 0 of the target. + Data[ConfigurationPath.Combine(key, "0")] = value.ToString(); + } + } + else + { + var value = dictionary[argument].ToString(); - Data[key] = value; + if (property.PropertyType == typeof(bool) && string.IsNullOrEmpty(value)) + { + value = "true"; } + + Data[key] = value; } } } diff --git a/src/slskd/Common/ManagedState.cs b/src/slskd/Common/ManagedState.cs index bfde3c80..26fbcb2a 100644 --- a/src/slskd/Common/ManagedState.cs +++ b/src/slskd/Common/ManagedState.cs @@ -193,7 +193,9 @@ namespace slskd } #pragma warning disable CS0693 // Type parameter has the same name as the type parameter from outer type +#pragma warning disable S3260 // Non-derived "private" classes and records should be "sealed" private class ManagedStateDisposable<T> : IDisposable +#pragma warning restore S3260 // Non-derived "private" classes and records should be "sealed" #pragma warning restore CS0693 // Type parameter has the same name as the type parameter from outer type { public ManagedStateDisposable(ManagedState<T> stateMonitor, Action<(T Previous, T Current)> listener) diff --git a/src/slskd/Core/API/Controllers/ConfigurationController.cs b/src/slskd/Core/API/Controllers/ConfigurationController.cs index 01c8bbc1..63b30a64 100644 --- a/src/slskd/Core/API/Controllers/ConfigurationController.cs +++ b/src/slskd/Core/API/Controllers/ConfigurationController.cs @@ -51,7 +51,6 @@ namespace slskd.Core.API [Authorize] public IActionResult GetOptions() { - // todo: sanitize this to remove passwords return Ok(OptionsShapshot.Value); } diff --git a/src/slskd/Core/API/Hubs/ApplicationHub.cs b/src/slskd/Core/API/Hubs/ApplicationHub.cs index 46a1fef9..d30b4a28 100644 --- a/src/slskd/Core/API/Hubs/ApplicationHub.cs +++ b/src/slskd/Core/API/Hubs/ApplicationHub.cs @@ -71,8 +71,8 @@ namespace slskd.Core.API OptionsMonitor = optionsMonitor; } - IStateMonitor<State> StateMonitor { get; } - IOptionsMonitor<Options> OptionsMonitor { get; } + private IStateMonitor<State> StateMonitor { get; } + private IOptionsMonitor<Options> OptionsMonitor { get; } public override async Task OnConnectedAsync() { diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index 3bc4903f..83844551 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -308,7 +308,7 @@ namespace slskd } bool IsRoot((string Raw, string Mask, string Alias, string Path) share) => share.Path == "/" || share.Path == "\\" || Path.GetPathRoot(share.Path) == share.Path; - + // starts with '/', 'X:\', or '\\' bool IsAbsolutePath(string share) => Regex.IsMatch(share.ToLocalOSPath(), @"^(\[.*\])?(\/|[a-zA-Z]:\\|\\\\).*$"); diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 8af0e557..edecf4e8 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -547,7 +547,7 @@ namespace slskd Console.WriteLine(banner); } - private static bool VerifyDirectory(string directory, bool createIfMissing = true, bool verifyWriteable = true) + private static void VerifyDirectory(string directory, bool createIfMissing = true, bool verifyWriteable = true) { if (!Directory.Exists(directory)) { @@ -564,7 +564,7 @@ namespace slskd } else { - return false; + throw new IOException($"Directory {directory} does not exist"); } } @@ -582,8 +582,6 @@ namespace slskd throw new IOException($"Directory {directory} is not writeable: {ex.Message}", ex); } } - - return true; } } }
\ No newline at end of file diff --git a/src/slskd/Shares/SharedFileCache.cs b/src/slskd/Shares/SharedFileCache.cs index f87c5d0e..30105d1f 100644 --- a/src/slskd/Shares/SharedFileCache.cs +++ b/src/slskd/Shares/SharedFileCache.cs @@ -356,7 +356,8 @@ namespace slskd.Shares resolved = resolved.ReplaceFirst(share.RemotePath, share.LocalPath); - if (resolved == filename) { + if (resolved == filename) + { Log.Warning($"Failed to resolve shared file {filename}"); } @@ -439,7 +440,7 @@ namespace slskd.Shares State.SetValue(state => state with { Directories = 0, Files = 0 }); } - private class Share + private sealed class Share { public Share(string share) { diff --git a/src/slskd/slskd.csproj b/src/slskd/slskd.csproj index 3faf445a..4c33e6f0 100644 --- a/src/slskd/slskd.csproj +++ b/src/slskd/slskd.csproj @@ -42,39 +42,39 @@ </Target> <ItemGroup> - <PackageReference Include="FluentFTP" Version="35.0.1" /> - <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" /> + <PackageReference Include="FluentFTP" Version="35.0.5" /> + <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.11" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" /> <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> - <PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.9" /> - <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.9" /> + <PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.11" /> + <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.11" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.11" /> <PackageReference Include="prometheus-net" Version="5.0.1" /> <PackageReference Include="prometheus-net.AspNetCore" Version="5.0.1" /> <PackageReference Include="prometheus-net.AspNetCore.HealthChecks" Version="5.0.1" /> - <PackageReference Include="prometheus-net.DotNetRuntime" Version="4.2.0" /> + <PackageReference Include="prometheus-net.DotNetRuntime" Version="4.2.2" /> <PackageReference Include="prometheus-net.SystemMetrics" Version="2.0.0" /> <PackageReference Include="Serilog" Version="2.10.0" /> <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> - <PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="7.0.1" /> + <PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="7.1.0" /> <PackageReference Include="Serilog.Sinks.Http" Version="7.2.0" /> - <PackageReference Include="SonarAnalyzer.CSharp" Version="8.27.0.35380"> + <PackageReference Include="SonarAnalyzer.CSharp" Version="8.30.0.37606"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> - <PackageReference Include="Soulseek" Version="3.0.0-pre-918211156" /> + <PackageReference Include="Soulseek" Version="3.0.0-pre-1102210644" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.354"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> - <PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" /> - <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.12.2" /> + <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> + <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.14.1" /> <PackageReference Include="Utility.CommandLine.Arguments" Version="6.0.0" /> <PackageReference Include="Utility.EnvironmentVariables" Version="1.0.5" /> <PackageReference Include="YamlDotNet" Version="11.2.1" /> |
