diff --git a/crypto/api/deps/Base64Message.js b/crypto/api/deps/Base64Message.js index bd6adef0..c09c0551 100644 --- a/crypto/api/deps/Base64Message.js +++ b/crypto/api/deps/Base64Message.js @@ -18,8 +18,8 @@ Base64Message.decode = function (string, keys, ref) { let hubSpecialId = '' let hubMessageStr = '' let newMessageObject = '' + let reactionStr = '' let messageUseEmbed = {} - let isHubReaction = false let editStr = false let embedFileStr = '"images":[""]' @@ -46,24 +46,12 @@ Base64Message.decode = function (string, keys, ref) { const res = decryptSingle(string, keys, false) if (res === 'noKey' || res === 'decryptionFailed') { - return '{"specialId":"","message":"
This message could not be decrypted
","repliedTo":"","isEdited":false,"isFromHub":true,"isReaction":false,"version": 3}' + return '{"specialId":"","message":"This message could not be decrypted
","repliedTo":"","isEdited":false,"isFromHub":true,"version": 3}' } const decryptToUnit8Array = base64ToUint8Array(res) const responseData = uint8ArrayToObject(decryptToUnit8Array) - if (responseData.type === "notification") { - hubMessageStr = responseData.data.message - } - - if (ref !== "noref") { - if (responseData.type === "reaction") { - isHubReaction = true - repliedToStr = ref - hubMessageStr = responseData.content - } - } - if (responseData.type === "edit") { editStr = true } @@ -76,11 +64,16 @@ Base64Message.decode = function (string, keys, ref) { hubSpecialId = responseData.specialId } - if (responseData.message.includes('qortal://use-embed/')) { + if (responseData.type === "notification") { + hubMessageStr = responseData.data.message + } else if (ref !== "noref" && responseData.type === "reaction") { + reactionStr = '"isReaction":true,' + repliedToStr = ref + hubMessageStr = responseData.content + } else if (responseData.message.includes('qortal://use-embed/')) { const useEmbed1 = extensionToPointer(responseData.message) const useEmbed2 = /This message could not be decrypted
","repliedTo":"","isEdited":false,"isFromHub":true,"isReaction":false,"version": 3}' + return '{"specialId":"","message":"This message could not be decrypted
","repliedTo":"","isEdited":false,"isFromHub":true,"version": 3}' } const decryptToUnit8Array = base64ToUint8Array(res) const responseData = uint8ArrayToObject(decryptToUnit8Array) - if (responseData.type === "notification") { - hubMessageStr = responseData.data.message - } - - if (ref !== "noref") { - if (responseData.type === "reaction") { - isHubReaction = true - repliedToStr = ref - hubMessageStr = responseData.content - } - } - if (responseData.type === "edit") { editStr = true } @@ -2829,11 +2817,16 @@ const decode = (string, keys, ref) => { hubSpecialId = responseData.specialId } - if (responseData.message.includes('qortal://use-embed/')) { + if (responseData.type === "notification") { + hubMessageStr = responseData.data.message + } else if (ref !== "noref" && responseData.type === "reaction") { + reactionStr = '"isReaction":true,' + repliedToStr = ref + hubMessageStr = responseData.content + } else if (responseData.message.includes('qortal://use-embed/')) { const useEmbed1 = extensionToPointer(responseData.message) const useEmbed2 = /