Skip to content

Instantly share code, notes, and snippets.

@marcinwasowicz
Created November 23, 2023 16:38
Show Gist options
  • Save marcinwasowicz/2df9c9bd4491862173241744d54a016f to your computer and use it in GitHub Desktop.
Save marcinwasowicz/2df9c9bd4491862173241744d54a016f to your computer and use it in GitHub Desktop.
Dirt code: encrypt MacOS notitications on the keyserver
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
index 8eeeb2967..487c882c8 100644
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -895,9 +895,11 @@ async function prepareAPNsNotification(
platformDetails.codeVersion && platformDetails.codeVersion >= 267;
const shouldBeEncrypted =
- platformDetails.platform === 'ios' &&
- (canDecryptAllNotifTypes ||
- (isNonCollapsibleTextNotification && canDecryptNonCollapsibleTextNotifs));
+ platformDetails.platform === 'macos' ||
+ (platformDetails.platform === 'ios' &&
+ (canDecryptAllNotifTypes ||
+ (isNonCollapsibleTextNotification &&
+ canDecryptNonCollapsibleTextNotifs)));
const uniqueID = uuidv4();
const notification = new apn.Notification();
diff --git a/keyserver/src/session/cookies.js b/keyserver/src/session/cookies.js
index 9bc7f7910..68ea6589d 100644
--- a/keyserver/src/session/cookies.js
+++ b/keyserver/src/session/cookies.js
@@ -833,7 +833,8 @@ async function isCookieMissingOlmNotificationsSession(
!viewer.platformDetails ||
(viewer.platformDetails.platform !== 'ios' &&
viewer.platformDetails.platform !== 'android' &&
- !(viewer.platformDetails.platform === 'web' && isStaffOrDev)) ||
+ !(viewer.platformDetails.platform === 'web' && isStaffOrDev) &&
+ viewer.platformDetails.platform !== 'macos') ||
!hasMinCodeVersion(viewer.platformDetails, {
native: 222,
web: NEXT_CODE_VERSION,
diff --git a/lib/shared/version-utils.js b/lib/shared/version-utils.js
index e3fc8978e..8e7441fc7 100644
--- a/lib/shared/version-utils.js
+++ b/lib/shared/version-utils.js
@@ -12,7 +12,7 @@ const FUTURE_CODE_VERSION = 1000000;
* A code version used for features that are waiting to be included
* in the very next release
*/
-const NEXT_CODE_VERSION = 1000000;
+const NEXT_CODE_VERSION = 0;
function hasMinCodeVersion(
platformDetails: ?PlatformDetails,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment