aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-03-04 07:12:01 -0600
committerGitHub <noreply@github.com>2024-03-04 07:12:01 -0600
commit3af712067a03640fd251f804ca532bd4cd5f7b10 (patch)
tree5e0ce1932f9d959b17d49fbc0a32b27434f13419 /src/slskd/Core
parentb39be34b05d6dd8e8d57e06512263d30634b9e1a (diff)
parent264019f11042fbffd789560635bf8943d4de9aa2 (diff)
downloadslskd-3af712067a03640fd251f804ca532bd4cd5f7b10.tar.gz
Merge branch 'master' into chore/codestyle
Diffstat (limited to 'src/slskd/Core')
-rw-r--r--src/slskd/Core/Options.cs110
1 files changed, 58 insertions, 52 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 68f3c3dc..cfe78eb1 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -787,6 +787,12 @@ namespace slskd
public GlobalUploadOptions Upload { get; init; } = new GlobalUploadOptions();
/// <summary>
+ /// Gets global limits.
+ /// </summary>
+ [Validate]
+ public LimitsOptions Limits { get; init; } = new LimitsOptions();
+
+ /// <summary>
/// Gets global download options.
/// </summary>
[Validate]
@@ -808,7 +814,7 @@ namespace slskd
public int Slots { get; init; } = 10;
/// <summary>
- /// Gets the total upload speed limit.
+ /// Gets the total upload speed limit, in kibibytes.
/// </summary>
[Argument(default, "upload-speed-limit")]
[EnvironmentVariable("UPLOAD_SPEED_LIMIT")]
@@ -833,7 +839,7 @@ namespace slskd
public int Slots { get; init; } = int.MaxValue;
/// <summary>
- /// Gets the total download speed limit.
+ /// Gets the total download speed limit, in kibibytes.
/// </summary>
[Argument(default, "download-speed-limit")]
[EnvironmentVariable("DOWNLOAD_SPEED_LIMIT")]
@@ -844,6 +850,54 @@ namespace slskd
}
/// <summary>
+ /// Limit options.
+ /// </summary>
+ public class LimitsOptions
+ {
+ /// <summary>
+ /// Gets limits for queued transfers.
+ /// </summary>
+ [Validate]
+ public Limits Queued { get; init; } = new Limits();
+
+ /// <summary>
+ /// Gets daily limits for transfers.
+ /// </summary>
+ [Validate]
+ public Limits Daily { get; init; } = new Limits();
+
+ /// <summary>
+ /// Gets weekly limits for transfers.
+ /// </summary>
+ [Validate]
+ public Limits Weekly { get; init; } = new Limits();
+
+ /// <summary>
+ /// Limits.
+ /// </summary>
+ public class Limits
+ {
+ /// <summary>
+ /// Gets the limit for number of files.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int? Files { get; init; } = null;
+
+ /// <summary>
+ /// Gets the limit for number of megabytes.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int? Megabytes { get; init; } = null;
+
+ /// <summary>
+ /// Gets the limit for number of failures.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int? Failures { get; init; } = null;
+ }
+ }
+
+ /// <summary>
/// User groups.
/// </summary>
public class GroupsOptions : IValidatableObject
@@ -1022,59 +1076,11 @@ namespace slskd
public int Slots { get; init; } = int.MaxValue;
/// <summary>
- /// Gets the total upload speed limit for the group.
+ /// Gets the total upload speed limit for the group, in kibibytes.
/// </summary>
[Range(1, int.MaxValue)]
public int SpeedLimit { get; init; } = int.MaxValue;
}
-
- /// <summary>
- /// Upload limit options.
- /// </summary>
- public class LimitsOptions
- {
- /// <summary>
- /// Gets limits for queued transfers.
- /// </summary>
- [Validate]
- public LimitsExtendedOptions Queued { get; init; } = new LimitsExtendedOptions();
-
- /// <summary>
- /// Gets daily limits for transfers.
- /// </summary>
- [Validate]
- public LimitsExtendedOptions Daily { get; init; } = new LimitsExtendedOptions();
-
- /// <summary>
- /// Gets weekly limits for transfers.
- /// </summary>
- [Validate]
- public LimitsExtendedOptions Weekly { get; init; } = new LimitsExtendedOptions();
- }
-
- /// <summary>
- /// Extended limit options.
- /// </summary>
- public class LimitsExtendedOptions
- {
- /// <summary>
- /// Gets the limit for number of files.
- /// </summary>
- [Range(1, int.MaxValue)]
- public int? Files { get; init; } = null;
-
- /// <summary>
- /// Gets the limit for number of megabytes.
- /// </summary>
- [Range(1, int.MaxValue)]
- public int? Megabytes { get; init; } = null;
-
- /// <summary>
- /// Gets the limit for number of failures.
- /// </summary>
- [Range(1, int.MaxValue)]
- public int? Failures { get; init; } = null;
- }
}
/// <summary>
@@ -1719,7 +1725,7 @@ namespace slskd
[Argument(default, "jwt-key")]
[EnvironmentVariable("JWT_KEY")]
[Description("JWT signing key")]
- [StringLength(255, MinimumLength = 16)]
+ [StringLength(255, MinimumLength = 32)]
[Secret]
[RequiresRestart]
public string Key { get; init; } = Cryptography.Random.GetBytes(32).ToBase62();