diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-10-26 18:32:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-26 18:32:35 -0500 |
| commit | e8238d19b3c7b29d2892caeafd66733b5622d1b2 (patch) | |
| tree | e8ced369b7631ef46d3043118aac5518dca76d35 /src/slskd/Core | |
| parent | 54590c78f2102634d982698608784e8d3c9043e0 (diff) | |
| parent | 334627cd06476df897cf3f3ec02ca70b51b7fec1 (diff) | |
| download | slskd-e8238d19b3c7b29d2892caeafd66733b5622d1b2.tar.gz | |
Merge pull request #1232 from slskd/scripts
Add the ability to run user-defined scripts when application events are raised
Diffstat (limited to 'src/slskd/Core')
| -rw-r--r-- | src/slskd/Core/Options.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 0f86ff62..306f9b87 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -32,6 +32,7 @@ namespace slskd using NetTools; using slskd.Authentication; using slskd.Configuration; + using slskd.Events; using slskd.Relay; using slskd.Shares; using slskd.Validation; @@ -2005,6 +2006,12 @@ namespace slskd public class IntegrationOptions { /// <summary> + /// Gets script configuration. + /// </summary> + [Validate] + public Dictionary<string, ScriptOptions> Scripts { get; init; } = []; + + /// <summary> /// Gets FTP options. /// </summary> [Validate] @@ -2017,6 +2024,25 @@ namespace slskd public PushbulletOptions Pushbullet { get; init; } = new PushbulletOptions(); /// <summary> + /// Script configuration. + /// </summary> + public class ScriptOptions + { + /// <summary> + /// Gets the list of Event types that trigger the script. + /// </summary> + [Enum(typeof(EventType))] + public string[] On { get; init; } = Array.Empty<string>(); + + /// <summary> + /// Gets the shell script to invoke. + /// </summary> + [StringLength(int.MaxValue, MinimumLength = 1)] + [NotNullOrWhiteSpace] + public string Run { get; init; } + } + + /// <summary> /// FTP options. /// </summary> public class FtpOptions : IValidatableObject |
