diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-01-29 08:03:01 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-01-29 08:03:01 -0600 |
| commit | 5c1cdfd24f4344bbc011a69b69979bfd5695e9aa (patch) | |
| tree | 129888795d2f26aaf47de1463c3693d5377e7b3d /src/slskd/Core | |
| parent | 95197676a8712df1e30edece4f20ec39726d1257 (diff) | |
| download | slskd-5c1cdfd24f4344bbc011a69b69979bfd5695e9aa.tar.gz | |
add redact for overlay
Diffstat (limited to 'src/slskd/Core')
| -rw-r--r-- | src/slskd/Core/Extensions.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/slskd/Core/Extensions.cs b/src/slskd/Core/Extensions.cs index db75cc9c..707daa88 100644 --- a/src/slskd/Core/Extensions.cs +++ b/src/slskd/Core/Extensions.cs @@ -42,6 +42,21 @@ namespace slskd } /// <summary> + /// Redacts this instance of Options, replacing properties marked with <see cref="SecretAttribute"/> with '*****'. + /// </summary> + /// <remarks> + /// Creates a deep clone before redacting. + /// </remarks> + /// <param name="options">The Options instance to redact.</param> + /// <returns>A redacted instance.</returns> + public static OptionsOverlay Redact(this OptionsOverlay options) + { + var redacted = options.ToJson().FromJson<OptionsOverlay>(); + Redactor.Redact(redacted, redactWith: "*****"); + return redacted; + } + + /// <summary> /// Creates a copy of this instance with the specified parameters changed. /// </summary> /// <param name="o">The options instance to copy.</param> |
