mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-17 04:58:46 +00:00
Harden push notification delivery
Keep encrypted message content out of push payloads and improve cross-platform notification data. Add token registration validation and per-session unregister support, batch and deduplicate sends, remove only confirmed unregistered tokens, and protect queued retries with leases. Add delivery tests and document the push API and Firebase setup.
This commit is contained in:
@@ -67,12 +67,14 @@ public class ChatNotificationService : IChatNotificationService
|
||||
return true;
|
||||
var profile = await _profiles.GetUserProfileAsync(message.SenderId);
|
||||
var title = profile.IsSuccess ? profile.Value.Username : "Govor";
|
||||
var content = message.EncryptedContent ?? string.Empty;
|
||||
var body = content.Length == 0 ? "Attachment" : content[..Math.Min(40, content.Length)];
|
||||
// Message content is encrypted; never send ciphertext or a guessed preview to FCM.
|
||||
var body = "New message";
|
||||
var data = new Dictionary<string, string>
|
||||
{
|
||||
["chatId"] = message.RecipientId.ToString(),
|
||||
["messageId"] = message.MessageId.ToString(),
|
||||
["senderId"] = message.SenderId.ToString(),
|
||||
["type"] = "chat_message",
|
||||
["isGroup"] = message.RecipientType == RecipientType.Group ? "true" : "false"
|
||||
};
|
||||
var push = await _notificationService.SendToUsersAsync(recipients, title, body,
|
||||
|
||||
Reference in New Issue
Block a user