diff --git a/package.json b/package.json index dcae01ca2..91722ed4f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "session-desktop", "productName": "Session", "description": "Private messaging from your desktop", - "version": "1.5.3", + "version": "1.5.4", "license": "GPL-3.0", "author": { "name": "Loki Project", diff --git a/preload.js b/preload.js index 0358ec58b..fb8c72e1f 100644 --- a/preload.js +++ b/preload.js @@ -62,6 +62,7 @@ window.lokiFeatureFlags = { useFileOnionRequestsV2: true, // more compact encoding of files in response onionRequestHops: 3, useRequestEncryptionKeyPair: false, + padOutgoingAttachments: false, }; if ( diff --git a/ts/session/snode_api/onions.ts b/ts/session/snode_api/onions.ts index b10c70f7c..0f0c46d10 100644 --- a/ts/session/snode_api/onions.ts +++ b/ts/session/snode_api/onions.ts @@ -238,6 +238,13 @@ const processOnionResponse = async ( // FIXME: 401/500 handling? + // detect SNode is deregisted? + if (response.status === 502) { + log.warn(`(${reqIdx}) [path] Got 502: snode not found`); + + return RequestError.BAD_PATH; + } + // detect SNode is not ready (not in swarm; not done syncing) if (response.status === 503) { log.warn(`(${reqIdx}) [path] Got 503: snode not ready`); diff --git a/ts/session/utils/Attachments.ts b/ts/session/utils/Attachments.ts index 7ef410650..2d7b9bb0d 100644 --- a/ts/session/utils/Attachments.ts +++ b/ts/session/utils/Attachments.ts @@ -94,9 +94,10 @@ export class AttachmentUtils { pointer.key = new Uint8Array(crypto.randomBytes(64)); const iv = new Uint8Array(crypto.randomBytes(16)); - const dataToEncrypt = !shouldPad - ? attachment.data - : AttachmentUtils.addAttachmentPadding(attachment.data); + const dataToEncrypt = + !shouldPad || !window.lokiFeatureFlags.padOutgoingAttachments + ? attachment.data + : AttachmentUtils.addAttachmentPadding(attachment.data); const data = await window.textsecure.crypto.encryptAttachment( dataToEncrypt, pointer.key.buffer, diff --git a/ts/window.d.ts b/ts/window.d.ts index a8c48fd8c..8aff4549d 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -61,6 +61,7 @@ declare global { useFileOnionRequestsV2: boolean; onionRequestHops: number; useRequestEncryptionKeyPair: boolean; + padOutgoingAttachments: boolean; }; lokiFileServerAPI: LokiFileServerInstance; lokiMessageAPI: LokiMessageInterface;