diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index becc19f..32649be 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Base.js + whatsapp-web.js 1.13.1 » Source: structures/Base.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index fdb6fc1..c6cca15 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.13.1 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 92743d2..d803b99 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Chat.js + whatsapp-web.js 1.13.1 » Source: structures/Chat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 30c490e..10b5d9d 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.13.1 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index e4bca9b..7b795d1 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Contact.js + whatsapp-web.js 1.13.1 » Source: structures/Contact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 12c1784..596dc2c 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.13.1 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 7cd27da..7e47344 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.13.1 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 20ad42a..08fc750 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Label.js + whatsapp-web.js 1.13.1 » Source: structures/Label.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index e8d387c..8a5a1ce 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Location.js + whatsapp-web.js 1.13.1 » Source: structures/Location.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 3adef21..30094ab 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Message.js + whatsapp-web.js 1.13.1 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -72,7 +72,7 @@ class Message extends Base { * Indicates if the message has media available for download * @type {boolean} */ - this.hasMedia = data.clientUrl || data.deprecatedMms3Url; + this.hasMedia = Boolean(data.mediaKey && data.directPath); /** * Message content @@ -343,14 +343,20 @@ class Message extends Base { return undefined; } - const mediaUrl = msg.clientUrl || msg.deprecatedMms3Url; + const decryptedMedia = await window.Store.DownloadManager.downloadAndDecrypt({ + directPath: msg.directPath, + encFilehash: msg.encFilehash, + filehash: msg.filehash, + mediaKey: msg.mediaKey, + mediaKeyTimestamp: msg.mediaKeyTimestamp, + type: msg.type, + signal: (new AbortController).signal + }); - const buffer = await window.WWebJS.downloadBuffer(mediaUrl); - const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype); - const data = await window.WWebJS.readBlobAsync(decrypted._blob); + const data = window.WWebJS.arrayBufferToBase64(decryptedMedia); return { - data: data.split(',')[1], + data, mimetype: msg.mimetype, filename: msg.filename }; diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 1e45235..66b146f 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.13.1 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index cb90fcf..c6c6757 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Order.js + whatsapp-web.js 1.13.1 » Source: structures/Order.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index d36a22d..f1fa410 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.13.1 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index e11f0d0..588e7dc 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.13.1 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 6dada75..4cf3680 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/Product.js + whatsapp-web.js 1.13.1 » Source: structures/Product.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 353739d..5480949 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.13.1 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index a4db26a..67b9853 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: util/Constants.js + whatsapp-web.js 1.13.1 » Source: util/Constants.js @@ -15,7 +15,7 @@ diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 365808e..536cf40 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.13.1 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index baaba6a..9f352c5 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.13.0 » Source: util/Util.js + whatsapp-web.js 1.13.1 » Source: util/Util.js @@ -15,7 +15,7 @@ diff --git a/package.json b/package.json index be18269..b74ad1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.13.0", + "version": "1.13.1", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts",