diff --git a/Jellyfin.Plugin.Webhook/Configuration/PluginConfiguration.cs b/Jellyfin.Plugin.Webhook/Configuration/PluginConfiguration.cs
index 1bfcd3e..00675f2 100644
--- a/Jellyfin.Plugin.Webhook/Configuration/PluginConfiguration.cs
+++ b/Jellyfin.Plugin.Webhook/Configuration/PluginConfiguration.cs
@@ -10,78 +10,77 @@ using Jellyfin.Plugin.Webhook.Destinations.Slack;
using Jellyfin.Plugin.Webhook.Destinations.Smtp;
using MediaBrowser.Model.Plugins;
-namespace Jellyfin.Plugin.Webhook.Configuration
+namespace Jellyfin.Plugin.Webhook.Configuration;
+
+///
+/// Webhook plugin configuration.
+///
+public class PluginConfiguration : BasePluginConfiguration
{
///
- /// Webhook plugin configuration.
+ /// Initializes a new instance of the class.
///
- public class PluginConfiguration : BasePluginConfiguration
+ public PluginConfiguration()
{
- ///
- /// Initializes a new instance of the class.
- ///
- public PluginConfiguration()
- {
- ServerUrl = string.Empty;
- DiscordOptions = Array.Empty();
- GenericOptions = Array.Empty();
- GenericFormOptions = Array.Empty();
- GotifyOptions = Array.Empty();
- PushbulletOptions = Array.Empty();
- PushoverOptions = Array.Empty();
- SlackOptions = Array.Empty();
- SmtpOptions = Array.Empty();
- MqttOptions = Array.Empty();
- }
-
- ///
- /// Gets or sets the jellyfin server url.
- ///
- public string ServerUrl { get; set; }
-
- ///
- /// Gets or sets the discord options.
- ///
- public DiscordOption[] DiscordOptions { get; set; }
-
- ///
- /// Gets or sets the generic options.
- ///
- public GenericOption[] GenericOptions { get; set; }
-
- ///
- /// Gets or sets the generic form options.
- ///
- public GenericFormOption[] GenericFormOptions { get; set; }
-
- ///
- /// Gets or sets the gotify options.
- ///
- public GotifyOption[] GotifyOptions { get; set; }
-
- ///
- /// Gets or sets the pushbullet options.
- ///
- public PushbulletOption[] PushbulletOptions { get; set; }
-
- ///
- /// Gets or sets the pushover options.
- ///
- public PushoverOption[] PushoverOptions { get; set; }
-
- ///
- /// Gets or sets the slack options.
- ///
- public SlackOption[] SlackOptions { get; set; }
-
- ///
- /// Gets or sets the smtp options.
- ///
- public SmtpOption[] SmtpOptions { get; set; }
-
- ///
- /// Gets or sets the mqtt options.
- ///
- public MqttOption[] MqttOptions { get; set; }
+ ServerUrl = string.Empty;
+ DiscordOptions = Array.Empty();
+ GenericOptions = Array.Empty();
+ GenericFormOptions = Array.Empty();
+ GotifyOptions = Array.Empty();
+ PushbulletOptions = Array.Empty();
+ PushoverOptions = Array.Empty();
+ SlackOptions = Array.Empty();
+ SmtpOptions = Array.Empty();
+ MqttOptions = Array.Empty();
}
+
+ ///
+ /// Gets or sets the jellyfin server url.
+ ///
+ public string ServerUrl { get; set; }
+
+ ///
+ /// Gets or sets the discord options.
+ ///
+ public DiscordOption[] DiscordOptions { get; set; }
+
+ ///
+ /// Gets or sets the generic options.
+ ///
+ public GenericOption[] GenericOptions { get; set; }
+
+ ///
+ /// Gets or sets the generic form options.
+ ///
+ public GenericFormOption[] GenericFormOptions { get; set; }
+
+ ///
+ /// Gets or sets the gotify options.
+ ///
+ public GotifyOption[] GotifyOptions { get; set; }
+
+ ///
+ /// Gets or sets the pushbullet options.
+ ///
+ public PushbulletOption[] PushbulletOptions { get; set; }
+
+ ///
+ /// Gets or sets the pushover options.
+ ///
+ public PushoverOption[] PushoverOptions { get; set; }
+
+ ///
+ /// Gets or sets the slack options.
+ ///
+ public SlackOption[] SlackOptions { get; set; }
+
+ ///
+ /// Gets or sets the smtp options.
+ ///
+ public SmtpOption[] SmtpOptions { get; set; }
+
+ ///
+ /// Gets or sets the mqtt options.
+ ///
+ public MqttOption[] MqttOptions { get; set; }
}
diff --git a/Jellyfin.Plugin.Webhook/Destinations/BaseClient.cs b/Jellyfin.Plugin.Webhook/Destinations/BaseClient.cs
index a841f4a..2ac5fbd 100644
--- a/Jellyfin.Plugin.Webhook/Destinations/BaseClient.cs
+++ b/Jellyfin.Plugin.Webhook/Destinations/BaseClient.cs
@@ -2,39 +2,38 @@ using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
-namespace Jellyfin.Plugin.Webhook.Destinations
+namespace Jellyfin.Plugin.Webhook.Destinations;
+
+///
+/// The base destination.
+///
+public class BaseClient
{
///
- /// The base destination.
+ /// Determines whether the client should send the webhook.
///
- public class BaseClient
+ /// Instance of the interface.
+ /// The sender option.
+ /// The webhook data.
+ /// Whether the client should send the webhook.
+ protected bool SendWebhook(
+ ILogger logger,
+ BaseOption option,
+ Dictionary data)
{
- ///
- /// Determines whether the client should send the webhook.
- ///
- /// Instance of the interface.
- /// The sender option.
- /// The webhook data.
- /// Whether the client should send the webhook.
- protected bool SendWebhook(
- ILogger logger,
- BaseOption option,
- Dictionary data)
+ var notificationType = data[nameof(NotificationType)] as NotificationType? ?? NotificationType.None;
+
+ // Don't filter on UserId if the notification type is UserCreated.
+ if (notificationType is not NotificationType.UserCreated
+ && option.UserFilter.Length is not 0
+ && data.TryGetValue("UserId", out var userIdObj)
+ && userIdObj is Guid userId
+ && Array.IndexOf(option.UserFilter, userId) is -1)
{
- var notificationType = data[nameof(NotificationType)] as NotificationType? ?? NotificationType.None;
-
- // Don't filter on UserId if the notification type is UserCreated.
- if (notificationType is not NotificationType.UserCreated
- && option.UserFilter.Length is not 0
- && data.TryGetValue("UserId", out var userIdObj)
- && userIdObj is Guid userId
- && Array.IndexOf(option.UserFilter, userId) is -1)
- {
- logger.LogDebug("UserId {UserId} not found in user filter, ignoring event", userId);
- return false;
- }
-
- return true;
+ logger.LogDebug("UserId {UserId} not found in user filter, ignoring event", userId);
+ return false;
}
+
+ return true;
}
}
diff --git a/Jellyfin.Plugin.Webhook/Destinations/BaseOption.cs b/Jellyfin.Plugin.Webhook/Destinations/BaseOption.cs
index 5b68822..c51a0f7 100644
--- a/Jellyfin.Plugin.Webhook/Destinations/BaseOption.cs
+++ b/Jellyfin.Plugin.Webhook/Destinations/BaseOption.cs
@@ -5,97 +5,96 @@ using HandlebarsDotNet;
using Jellyfin.Extensions.Json;
using Jellyfin.Plugin.Webhook.Helpers;
-namespace Jellyfin.Plugin.Webhook.Destinations
+namespace Jellyfin.Plugin.Webhook.Destinations;
+
+///
+/// Base options for destination.
+///
+public abstract class BaseOption
{
+ private HandlebarsTemplate