Add persistent Inbox and RFC 8291/8292 Web Push notification system

This commit is contained in:
tyuXX 2026-10-31 15:41:51 +03:00
parent 4714d25724
commit 7cc9ba7f4d
27 changed files with 3573 additions and 17 deletions

View file

@ -30,6 +30,11 @@ public static class MessageTypes
public const string Error = "ERROR";
public const string ExecuteCommand = "EXECUTE_COMMAND";
public const string CommandResult = "COMMAND_RESULT";
public const string InboxSync = "INBOX_SYNC";
public const string InboxNewItem = "INBOX_NEW_ITEM";
public const string InboxAction = "INBOX_ACTION";
public const string UpdateInboxPreferences = "UPDATE_INBOX_PREFERENCES";
public const string ToggleFollowChannel = "TOGGLE_FOLLOW_CHANNEL";
public const string Ping = "PING";
public const string Pong = "PONG";
}
@ -232,3 +237,38 @@ public class CommandResultPacket
public string Output { get; set; } = string.Empty;
public string ChannelId { get; set; } = string.Empty;
}
public class InboxSyncPacket
{
public List<InboxItem> Items { get; set; } = new();
public int UnreadCount { get; set; }
public InboxPreferences Preferences { get; set; } = new();
}
public class InboxNewItemPacket
{
public InboxItem Item { get; set; } = new();
public int UnreadCount { get; set; }
}
public class InboxActionPacket
{
public string Action { get; set; } = string.Empty; // "mark_read", "mark_all_read", "dismiss", "clear_read", "clear_all"
public string? ItemId { get; set; }
public string? ChannelId { get; set; }
}
public class UpdateInboxPreferencesPacket
{
public bool? MentionsEnabled { get; set; }
public bool? AnnouncementsEnabled { get; set; }
public bool? DirectMessagesEnabled { get; set; }
public bool? FollowedChannelsEnabled { get; set; }
public bool? PushNotificationsEnabled { get; set; }
}
public class ToggleFollowChannelPacket
{
public string ChannelId { get; set; } = string.Empty;
public bool? Follow { get; set; }
}