diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-07-04 17:14:35 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-07-04 17:14:35 -0500 |
| commit | 5111471cea28c1ce7da6e323fc549298a3625601 (patch) | |
| tree | 3df1a5b087a1142415e11a8345c630e0168fbb94 /src | |
| parent | 6e4166314c7cb9ce51f5c6ecff72258be26524b0 (diff) | |
| download | slskd-5111471cea28c1ce7da6e323fc549298a3625601.tar.gz | |
add options for pushbullet
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Options.cs | 70 | ||||
| -rw-r--r-- | src/slskd/Properties/slskd.yml | 10 |
2 files changed, 79 insertions, 1 deletions
diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index f8190fc7..d2f2ddef 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -568,6 +568,12 @@ namespace slskd public FTPOptions FTP { get; private set; } = new FTPOptions(); /// <summary> + /// Gets Pushbullet options. + /// </summary> + [Validate] + public PushbulletOptions Pushbullet { get; private set; } = new PushbulletOptions(); + + /// <summary> /// FTP options. /// </summary> public class FTPOptions : IValidatableObject @@ -676,6 +682,70 @@ namespace slskd return results; } } + + /// <summary> + /// Pushbullet options. + /// </summary> + public class PushbulletOptions + { + /// <summary> + /// Gets a value indicating whether the Pushbullet integration is enabled. + /// </summary> + [Argument(default, "pushbullet")] + [EnvironmentVariable("PUSHBULLET_ENABLED")] + [Description("enable Pushbullet integration")] + public bool Enabled { get; private set; } = false; + + /// <summary> + /// Gets the Pushbullet API access token. + /// </summary> + [Argument(default, "pushbullet-token")] + [EnvironmentVariable("PUSHBULLET_ACCESS_TOKEN")] + [Description("Pushbullet access token")] + public string AccessToken { get; private set; } + + /// <summary> + /// Gets the prefix for Pushbullet notification titles. + /// </summary> + [Argument(default, "pushbullet-prefix")] + [EnvironmentVariable("PUSHBULLET_NOTIFICATION_PREFIX")] + [Description("prefix for Pushbullet notification titles")] + public string NotificationPrefix { get; private set; } = "From slskd:"; + + /// <summary> + /// Gets a value indicating whether a Pushbullet notification should be sent when a private message is received. + /// </summary> + [Argument(default, "pushbullet-notify-on-pm")] + [EnvironmentVariable("PUSHBULLET_NOTIFY_ON_PRIVATE_MESSAGE")] + [Description("send Pushbullet notifications when private messages are received")] + public bool NotifyOnPrivateMessage { get; private set; } = true; + + /// <summary> + /// Gets a value indicating whether a Pushbullet notification should be sent when the currently logged + /// in user's username is mentioned in a room. + /// </summary> + [Argument(default, "pushbullet-notify-on-room-mention")] + [EnvironmentVariable("PUSHBULLET_NOTIFY_ON_ROOM_MENTION")] + [Description("send Pushbullet notifications when your username is mentioned in a room")] + public bool NotifyOnRoomMention { get; private set; } = true; + + /// <summary> + /// Gets the number of times failing Pushbullet notifications will be retried. + /// </summary> + [Argument(default, "pushbullet-retry-attempts")] + [EnvironmentVariable("PUSHBULLET_RETRY_ATTEMPTS")] + [Description("number of times failing Pushbullet notifications will be retried")] + [Range(0, 5)] + public int RetryAttempts { get; private set; } = 3; + + /// <summary> + /// Gets the cooldown time for Pushbullet notifications, in milliseconds. + /// </summary> + [Argument(default, "pushbullet-cooldown")] + [EnvironmentVariable("PUSHBULLET_COOLDOWN_TIME")] + [Description("cooldown time for Pushbullet notifications, in milliseconds")] + public int CooldownTime { get; private set; } = 900000; // 15 minutes + } } } }
\ No newline at end of file diff --git a/src/slskd/Properties/slskd.yml b/src/slskd/Properties/slskd.yml index a0356e6f..c5e46b5d 100644 --- a/src/slskd/Properties/slskd.yml +++ b/src/slskd/Properties/slskd.yml @@ -61,4 +61,12 @@ # remote_path: / # overwrite_existing: true # connection_timeout: 5000 -# retry_attempts: 5
\ No newline at end of file +# retry_attempts: 3 +# pushbullet: +# enabled: false +# access_token: ~ +# notification_prefix: ~ +# notify_on_private_message: true +# notify_on_room_mention: true +# retry_attempts: 3 +# cooldown_time: 900000
\ No newline at end of file |
