diff --git a/Jellyfin.Webhooks/Dto/SessionInfoDto.cs b/Jellyfin.Webhooks/Dto/SessionInfoDto.cs index 926ac7b..9340730 100644 --- a/Jellyfin.Webhooks/Dto/SessionInfoDto.cs +++ b/Jellyfin.Webhooks/Dto/SessionInfoDto.cs @@ -13,6 +13,17 @@ public class SessionInfoDto public string ApplicationVersion { get; set; } public PlayerStateInfo PlayState { get; set; } + public SessionInfoDto(MediaBrowser.Model.Dto.SessionInfoDto session) + { + Id = session.Id; + Client = session.Client; + DeviceId = session.DeviceId; + DeviceName = session.DeviceName; + RemoteEndPoint = session.RemoteEndPoint; + ApplicationVersion = session.ApplicationVersion; + PlayState = session.PlayState; + } + public SessionInfoDto(SessionInfo session) { Id = session.Id; diff --git a/Jellyfin.Webhooks/Formats/DefaultFormat.cs b/Jellyfin.Webhooks/Formats/DefaultFormat.cs index a4047a3..365431a 100644 --- a/Jellyfin.Webhooks/Formats/DefaultFormat.cs +++ b/Jellyfin.Webhooks/Formats/DefaultFormat.cs @@ -52,7 +52,7 @@ public class DefaultFormatPayload public HookEvent Event { get; set; } public BaseItemDto Item { get; set; } public UserDto User { get; set; } - public SessionInfoDto Session { get; set; } + public Dto.SessionInfoDto Session { get; set; } public ServerInfoDto Server { get; set; } public object AdditionalData { get; set; } public BaseItemDto Series { get; set; } diff --git a/Jellyfin.Webhooks/Jellyfin.Webhooks.csproj b/Jellyfin.Webhooks/Jellyfin.Webhooks.csproj index 39edaa8..f2284d4 100644 --- a/Jellyfin.Webhooks/Jellyfin.Webhooks.csproj +++ b/Jellyfin.Webhooks/Jellyfin.Webhooks.csproj @@ -1,18 +1,18 @@ - + net8.0 Jellyfin.Webhooks - 3.7.0.0 - 3.7.0.0 + 3.8.0.0 + 3.8.0.0 - - - - - + + + + + diff --git a/Jellyfin.Webhooks/Notifiers/AuthenticationFailureNotifier.cs b/Jellyfin.Webhooks/Notifiers/AuthenticationFailureNotifier.cs index 9beafe1..804893f 100644 --- a/Jellyfin.Webhooks/Notifiers/AuthenticationFailureNotifier.cs +++ b/Jellyfin.Webhooks/Notifiers/AuthenticationFailureNotifier.cs @@ -1,21 +1,20 @@ using System.Threading.Tasks; -using Jellyfin.Data.Events; using MediaBrowser.Controller.Events; -using MediaBrowser.Controller.Session; using MediaBrowser.Controller; using Jellyfin.Webhooks.Configuration; using Jellyfin.Webhooks.Dto; +using MediaBrowser.Controller.Events.Authentication; namespace Jellyfin.Webhooks.Notifiers; public class AuthenticationFailureNotifier( IServerApplicationHost applicationHost, ISender sender -) : IEventConsumer> +) : IEventConsumer { - public async Task OnEvent(GenericEventArgs eventArgs) + public async Task OnEvent(AuthenticationRequestEventArgs eventArgs) { - if (eventArgs.Argument is null) + if (eventArgs is null) { return; } @@ -23,7 +22,7 @@ public async Task OnEvent(GenericEventArgs eventArgs) await sender.Send(new EventInfo { Event = HookEvent.AuthenticationFailed, - AdditionalData = eventArgs.Argument, + AdditionalData = eventArgs, Server = new ServerInfoDto { Id = applicationHost.SystemId, diff --git a/Jellyfin.Webhooks/Notifiers/AuthenticationSuccessNotifier.cs b/Jellyfin.Webhooks/Notifiers/AuthenticationSuccessNotifier.cs index 637e9fb..1b109ab 100644 --- a/Jellyfin.Webhooks/Notifiers/AuthenticationSuccessNotifier.cs +++ b/Jellyfin.Webhooks/Notifiers/AuthenticationSuccessNotifier.cs @@ -1,11 +1,10 @@ using System.Threading.Tasks; -using Jellyfin.Data.Events; using Jellyfin.Webhooks.Configuration; using Jellyfin.Webhooks.Dto; using MediaBrowser.Controller.Events; using MediaBrowser.Controller; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Authentication; +using MediaBrowser.Controller.Events.Authentication; namespace Jellyfin.Webhooks.Notifiers; @@ -13,20 +12,20 @@ public class AuthenticationSuccessNotifier( IServerApplicationHost applicationHost, IUserManager userManager, ISender sender -) : IEventConsumer> +) : IEventConsumer { - public async Task OnEvent(GenericEventArgs eventArgs) + public async Task OnEvent(AuthenticationResultEventArgs eventArgs) { - if (eventArgs.Argument is null) + if (eventArgs is null) { return; } - var user = userManager.GetUserById(eventArgs.Argument.User.Id); + var user = userManager.GetUserById(eventArgs.User.Id); await sender.Send(new EventInfo { Event = HookEvent.AuthenticationSucceeded, - Session = new SessionInfoDto(eventArgs.Argument.SessionInfo), + Session = new SessionInfoDto(eventArgs.SessionInfo), User = user, Server = new ServerInfoDto { diff --git a/Jellyfin.Webhooks/PluginServiceRegistrator.cs b/Jellyfin.Webhooks/PluginServiceRegistrator.cs index 5b959b2..f257906 100644 --- a/Jellyfin.Webhooks/PluginServiceRegistrator.cs +++ b/Jellyfin.Webhooks/PluginServiceRegistrator.cs @@ -1,11 +1,9 @@ -using Jellyfin.Data.Events; -using MediaBrowser.Controller.Authentication; using MediaBrowser.Controller.Events; using MediaBrowser.Controller; using MediaBrowser.Controller.Plugins; -using MediaBrowser.Controller.Session; using Microsoft.Extensions.DependencyInjection; using Jellyfin.Webhooks.Notifiers; +using MediaBrowser.Controller.Events.Authentication; namespace Jellyfin.Webhooks; @@ -17,7 +15,7 @@ public void RegisterServices(IServiceCollection serviceCollection, IServerApplic serviceCollection.AddScoped(); // Security consumers. - serviceCollection.AddScoped>, AuthenticationFailureNotifier>(); - serviceCollection.AddScoped>, AuthenticationSuccessNotifier>(); + serviceCollection.AddScoped, AuthenticationFailureNotifier>(); + serviceCollection.AddScoped, AuthenticationSuccessNotifier>(); } } diff --git a/build.yaml b/build.yaml index ddb37a9..ee41ba4 100644 --- a/build.yaml +++ b/build.yaml @@ -1,8 +1,8 @@ --- name: "Webhooks" guid: "eb5d7894-8eef-4b36-aa6f-5d124e828ce1" -version: "3.7.0.0" -targetAbi: "10.9.0.0" +version: "3.8.0.0" +targetAbi: "10.10.3.0" framework: "net8.0" overview: "Webhooks. Flexible and robust" description: > @@ -12,4 +12,4 @@ owner: "shemanaev" artifacts: - "Jellyfin.Webhooks.dll" changelog: > - Jellyfin 10.9 compatibility + Jellyfin 10.10 compatibility