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

@ -45,6 +45,20 @@ public class ServerInfoResponse
public bool AllowMemberChannelCreation { get; set; } = true;
public bool AllowDmE2ee { get; set; } = true;
public int MaxGroupChatUsers { get; set; } = 10;
public string? VapidPublicKey { get; set; }
}
public class PushSubscribeRequest
{
public string Endpoint { get; set; } = string.Empty;
public string P256dh { get; set; } = string.Empty;
public string Auth { get; set; } = string.Empty;
public string? UserAgent { get; set; }
}
public class PushUnsubscribeRequest
{
public string Endpoint { get; set; } = string.Empty;
}
public class UploadFileResponse

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; }
}

View file

@ -109,6 +109,19 @@ public class ServerUiSync
new() { Name = "FileList", Position = "Center", ShowBorder = true, BorderTitle = "Available Files" },
new() { Name = "Actions", Position = "Bottom", Height = 3, ShowBorder = true, BorderTitle = "Transfer Commands" }
}
},
new()
{
ScreenId = "F5_Inbox",
Title = "Inbox",
ShortcutKey = "F5",
Description = "Notifications, mentions, announcements, and followed conversations",
Panels = new List<PanelDefinition>
{
new() { Name = "Header", Position = "Top", Height = 3, ShowBorder = true, BorderTitle = "Inbox & Notification Settings" },
new() { Name = "InboxList", Position = "Center", ShowBorder = true, BorderTitle = "Notifications" },
new() { Name = "Actions", Position = "Bottom", Height = 3, ShowBorder = true, BorderTitle = "Inbox Controls" }
}
}
}
};