From f2c14f9ad65cca096ea811bae2df0cfc21ab456f Mon Sep 17 00:00:00 2001 From: Renato Alcara Date: Sat, 7 Mar 2026 00:25:07 -0300 Subject: [PATCH] fix: carousel renders on WhatsApp Web without F5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes: 1. Stanza type="media" for carousel messages — WhatsApp Web needs this to render carousel in real-time. Without it, only shows header until page refresh (F5). 2. Fix jimp detection: typeof Jimp === 'function' (not just 'object') so jpegThumbnail is generated for card images. Co-Authored-By: Claude Opus 4.6 --- src/Socket/messages-send.ts | 5 +++++ src/Utils/messages-media.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Socket/messages-send.ts b/src/Socket/messages-send.ts index 542587dc..9a63b668 100644 --- a/src/Socket/messages-send.ts +++ b/src/Socket/messages-send.ts @@ -1068,6 +1068,11 @@ export const makeMessagesSocket = (config: SocketConfig) => { return 'media' } + // Carousel with images → media type for Web real-time rendering + if (normalizedMessage.interactiveMessage?.carouselMessage) { + return 'media' + } + return 'text' } diff --git a/src/Utils/messages-media.ts b/src/Utils/messages-media.ts index 53a1fa95..fe10f21d 100644 --- a/src/Utils/messages-media.ts +++ b/src/Utils/messages-media.ts @@ -160,7 +160,7 @@ export const extractImageThumb = async (bufferOrFilePath: Readable | Buffer | st height: dimensions.height } } - } else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'object') { + } else if ('jimp' in lib && (typeof lib.jimp?.Jimp === 'object' || typeof lib.jimp?.Jimp === 'function')) { const jimp = await (lib.jimp.Jimp as any).read(bufferOrFilePath) const dimensions = { width: jimp.width,