diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-04-24 09:44:44 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-04-24 09:44:44 -0500 |
| commit | 64fb4c12a013ed1b50ddcf57fb4bd16decb928f0 (patch) | |
| tree | 3d647cf4f912fa6437e0d0030e99f577e6f0a2c7 /src/slskd/Core/Options.cs | |
| parent | 19fba8293b472939d74ed23232577cbfdf523586 (diff) | |
| parent | fc722e4a78aa5369fcd5ca0d8e88bd98d874a1d8 (diff) | |
| download | slskd-64fb4c12a013ed1b50ddcf57fb4bd16decb928f0.tar.gz | |
Merge remote-tracking branch 'origin/master' into retries
Diffstat (limited to 'src/slskd/Core/Options.cs')
| -rw-r--r-- | src/slskd/Core/Options.cs | 79 |
1 files changed, 64 insertions, 15 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 271fe905..cc6a8316 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1,18 +1,33 @@ -// <copyright file="Options.cs" company="slskd Team"> -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. +// <copyright file="Options.cs" company="JP Dillingham"> +// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄ +// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █ +// █__ --█ █__ --█ ◄█ - █ +// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█ +// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉ +// │ Copyright (c) JP Dillingham. +// │ +// │ This program is free software: you can redistribute it and/or modify +// │ it under the terms of the GNU Affero General Public License as published +// │ by the Free Software Foundation, version 3. +// │ +// │ This program is distributed in the hope that it will be useful, +// │ but WITHOUT ANY WARRANTY; without even the implied warranty of +// │ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// │ GNU Affero General Public License for more details. +// │ +// │ You should have received a copy of the GNU Affero General Public License +// │ along with this program. If not, see https://www.gnu.org/licenses/. +// │ +// │ This program is distributed with Additional Terms pursuant to Section 7 +// │ of the AGPLv3. See the LICENSE file in the root directory of this +// │ project for the complete terms and conditions. +// │ +// │ https://slskd.org +// │ +// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌ +// │ SPDX-FileCopyrightText: JP Dillingham +// │ SPDX-License-Identifier: AGPL-3.0-only +// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈ // </copyright> using Microsoft.Extensions.Options; @@ -239,6 +254,12 @@ namespace slskd [Validate] public SharesOptions Shares { get; init; } = new SharesOptions(); + [Obsolete("temporary sentinel to warn users about breaking change. use Transfers instead.")] + public object Global { get; init; } = null; + + [Obsolete("temporary sentinel to warn users about breaking change. use Transfers instead.")] + public object Groups { get; init; } = null; + /// <summary> /// Gets transfer options. /// </summary> @@ -310,6 +331,9 @@ namespace slskd [Validate] public SoulseekOptions Soulseek { get; init; } = new SoulseekOptions(); + [Obsolete("temporary sentinel to warn users about breaking change. use Integrations instead.")] + public object Integration { get; init; } = null; + /// <summary> /// Gets options for external integrations. /// </summary> @@ -330,6 +354,18 @@ namespace slskd results.Add(new ValidationResult($"Instance name must be something other than '{Program.LocalHostName}' when operating in Relay Agent mode")); } +#pragma warning disable CS0618 // Type or member is obsolete + if (Groups is not null || Global is not null) + { + results.Add(new ValidationResult("The 'global' and 'groups' keys have been moved under a new 'transfers' key. See https://github.com/slskd/slskd/pull/1672 for details, and make the necessary changes to remove this error")); + } + + if (Integration is not null) + { + 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)")); + } +#pragma warning restore CS0618 // Type or member is obsolete + return results; } @@ -1151,6 +1187,11 @@ namespace slskd public string[] Members { get; init; } = Array.Empty<string>(); /// <summary> + /// Gets the list of regular expression patterns matched against usernames. + /// </summary> + public string[] Patterns { get; init; } = Array.Empty<string>(); + + /// <summary> /// Gets the list of group CIDRs. /// </summary> public string[] Cidrs { get; init; } = Array.Empty<string>(); @@ -1164,6 +1205,14 @@ namespace slskd { var results = new List<ValidationResult>(); + foreach (var pattern in Patterns ?? Array.Empty<string>()) + { + if (!pattern.IsValidRegex()) + { + results.Add(new ValidationResult($"Pattern '{pattern}' is not a valid regular expression")); + } + } + foreach (var cidr in Cidrs ?? Array.Empty<string>()) { try |
