Created
November 3, 2023 10:54
-
-
Save marcinwasowicz/039d35ce01414f3cfafa0d5b54cdea0c to your computer and use it in GitHub Desktop.
Test encrypted web notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js | |
index c75f2c248..44ea265e8 100644 | |
--- a/keyserver/src/push/send.js | |
+++ b/keyserver/src/push/send.js | |
@@ -361,15 +361,24 @@ async function sendPushNotif(input: { | |
}; | |
const deliveryPromise: Promise<PushResult> = (async () => { | |
- const targetedNotifications = await prepareWebNotification( | |
- { | |
- notifTexts, | |
- threadID: threadInfo.id, | |
- unreadCount, | |
- platformDetails, | |
- }, | |
- devices, | |
- ); | |
+ const notificationsPromises = []; | |
+ for (let i = 0; i < 100; i++) { | |
+ notificationsPromises.push( | |
+ prepareWebNotification( | |
+ { | |
+ notifTexts: { ...notifTexts, body: notifTexts.body + i }, | |
+ threadID: threadInfo.id, | |
+ unreadCount, | |
+ platformDetails, | |
+ }, | |
+ devices, | |
+ ), | |
+ ); | |
+ } | |
+ | |
+ const targetedNotifications = ( | |
+ await Promise.all(notificationsPromises) | |
+ ).flat(); | |
return await sendWebNotifications(targetedNotifications, { | |
...notificationInfo, | |
diff --git a/lib/shared/version-utils.js b/lib/shared/version-utils.js | |
index e3fc8978e..f559163e3 100644 | |
--- a/lib/shared/version-utils.js | |
+++ b/lib/shared/version-utils.js | |
@@ -6,7 +6,7 @@ import { type PlatformDetails, isWebPlatform } from '../types/device-types.js'; | |
* A code version used for features that are waiting to be released | |
* and we're not sure in which version they will be available. | |
*/ | |
-const FUTURE_CODE_VERSION = 1000000; | |
+const FUTURE_CODE_VERSION = 0; | |
/** | |
* A code version used for features that are waiting to be included | |
diff --git a/web/push-notif/service-worker.js b/web/push-notif/service-worker.js | |
index 066321328..bab041998 100644 | |
--- a/web/push-notif/service-worker.js | |
+++ b/web/push-notif/service-worker.js | |
@@ -43,7 +43,7 @@ function buildDecryptionErrorNotification( | |
}, | |
}; | |
- if (decryptionError.displayErrorMessage && decryptionError.error) { | |
+ if (decryptionError.error) { | |
return { | |
body: decryptionError.error, | |
...baseErrorPayload, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment