Skip to content

Instantly share code, notes, and snippets.

@marcinwasowicz
Created November 3, 2023 10:54
Show Gist options
  • Save marcinwasowicz/039d35ce01414f3cfafa0d5b54cdea0c to your computer and use it in GitHub Desktop.
Save marcinwasowicz/039d35ce01414f3cfafa0d5b54cdea0c to your computer and use it in GitHub Desktop.
Test encrypted web notifications
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