Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix Space push delivery to Firefox Android

Anand Baburajanc7627daf822b
diff --git a/server/space/controller/notifications.go b/server/space/controller/notifications.go
index 3c23fb8715..8eccb044ff 100644
--- a/server/space/controller/notifications.go
+++ b/server/space/controller/notifications.go
@@ -31,8 +31,10 @@ const (
spaceActivityFriendRequested = "friend_requested"
spaceWebPushSendRate = "50-H"
spaceWebPushTTLSeconds = 24 * 60 * 60
- spaceWebPushSendTimeout = 30 * time.Second
- spaceWebPushConcurrency = 10
+ // Firefox Android's FCM bridge rejects encrypted records larger than 2744 bytes.
+ spaceWebPushRecordSize = 2744
+ spaceWebPushSendTimeout = 30 * time.Second
+ spaceWebPushConcurrency = 10
)
var sendSpaceWebPush = webpush.SendNotificationWithContext
@@ -88,6 +90,7 @@ func NewSpaceWebPushSender(
if config != nil {
sender.options = &webpush.Options{
HTTPClient: newSpaceWebPushHTTPClient(),
+ RecordSize: spaceWebPushRecordSize,
Subscriber: config.subscriber,
TTL: spaceWebPushTTLSeconds,
Urgency: webpush.UrgencyNormal,
diff --git a/server/space/controller/notifications_test.go b/server/space/controller/notifications_test.go
index c4db38e373..413ba91bc2 100644
--- a/server/space/controller/notifications_test.go
+++ b/server/space/controller/notifications_test.go
@@ -329,6 +329,7 @@ func TestSpaceWebPushSenderUsesGenericPayloadAndPrunesDeadEndpoint(t *testing.T)
var payload spaceWebPushPayload
sendSpaceWebPush = func(_ context.Context, message []byte, subscription *webpush.Subscription, options *webpush.Options) (*http.Response, error) {
require.Equal(t, "https://push.example/subscription", subscription.Endpoint)
+ require.Equal(t, uint32(spaceWebPushRecordSize), options.RecordSize)
require.Equal(t, spaceWebPushTTLSeconds, options.TTL)
require.Equal(t, webpush.UrgencyNormal, options.Urgency)
require.Equal(t, "[email protected]", options.Subscriber)