diff --git a/Moonlight/App/Services/Notifications/NotificationServerService.cs b/Moonlight/App/Services/Notifications/NotificationServerService.cs index 92d76690..d2d41a9f 100644 --- a/Moonlight/App/Services/Notifications/NotificationServerService.cs +++ b/Moonlight/App/Services/Notifications/NotificationServerService.cs @@ -36,6 +36,11 @@ public class NotificationServerService private List connectedClients = new(); + public List GetConnectedClients() + { + return connectedClients.ToList(); + } + public List GetConnectedClients(User user) { return connectedClients.Where(x => x.User == user).ToList(); diff --git a/Moonlight/Shared/Views/Admin/Notifications/Debugging.razor b/Moonlight/Shared/Views/Admin/Notifications/Debugging.razor new file mode 100644 index 00000000..05ea9fdd --- /dev/null +++ b/Moonlight/Shared/Views/Admin/Notifications/Debugging.razor @@ -0,0 +1,33 @@ +@page "/admin/notifications/debugging" +@using Moonlight.App.Services.Notifications + +@inject NotificationServerService NotificationServerService + + + +

Notification Debugging

+ @foreach (var client in Clients) + { +
+
+

Id: @client.NotificationClient.Id User: @client.User.Email

+ +
+ } +
+
+ + +@code { + private List Clients; + + private async Task Load(LazyLoader loader) + { + Clients = NotificationServerService.GetConnectedClients(); + } + + private async Task SendSampleNotification(NotificationClientService client) + { + await client.SendAction(@"{""action"": ""notify"",""notification"":{""id"":999,""channel"":""Sample Channel"",""content"":""This is a sample Notification"",""title"":""Sample Notification""}}"); + } +} \ No newline at end of file