From c32e83489eb621a97a5395d31c3d90bd4c7b3666 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 12 Jan 2022 09:06:17 -0600 Subject: rough in group config --- src/slskd/Options.cs | 41 +++++++++++++++++++++++++++++++++++++++-- src/slskd/Startup.cs | 2 +- 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index 6b3d07ac..467c4bec 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) slskd Team. All rights reserved. // // This program is free software: you can redistribute it and/or modify @@ -233,6 +233,11 @@ namespace slskd [Validate] public GlobalOptions Global { get; init; } = new GlobalOptions(); + /// + /// Gets user groups. + /// + [Validate] + public GroupsOptions Groups { get; init; } = new GroupsOptions(); /// /// Gets filter options. @@ -413,6 +418,38 @@ namespace slskd } } + /// + /// User groups. + /// + public class GroupsOptions + { + public BuiltInGroupOptions Default { get; init; } = new BuiltInGroupOptions(); + public BuiltInGroupOptions Leechers { get; init; } = new BuiltInGroupOptions(); + + public class BuiltInGroupOptions + { + public GroupUploadOptions Upload { get; init; } = new GroupUploadOptions(); + } + + public class UserDefinedGroupOptions + { + public GroupUploadOptions Upload { get; init; } = new GroupUploadOptions(); + public string[] Members { get; init; } = Array.Empty(); + } + + public class GroupUploadOptions + { + [Range(1, int.MaxValue)] + public int Priority { get; init; } + + [Enum(typeof(QueueStrategy))] + public string QueueStrategy { get; init; } = slskd.QueueStrategy.RoundRobin.ToString().ToLowerInvariant(); + + [Range(1, int.MaxValue)] + public int Slots { get; init; } = 10; + } + } + /// /// Feature options. /// @@ -973,7 +1010,7 @@ namespace slskd [EnvironmentVariable("FTP_ENCRYPTION_MODE")] [Description("FTP encryption mode; none, implicit, explicit, auto")] [Enum(typeof(FtpEncryptionMode))] - public string EncryptionMode { get; init; } = "auto"; + public string EncryptionMode { get; init; } = FtpEncryptionMode.Auto.ToString().ToLowerInvariant(); /// /// Gets a value indicating whether FTP certificate errors should be ignored. diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs index 59557a81..dfe12824 100644 --- a/src/slskd/Startup.cs +++ b/src/slskd/Startup.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) slskd Team. All rights reserved. // // This program is free software: you can redistribute it and/or modify -- cgit v1.2.3