mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
thumb generation fixes
This commit is contained in:
@@ -537,11 +537,13 @@ const makeMessagesSocket = (config: SocketConfig) => {
|
||||
content,
|
||||
{
|
||||
...options,
|
||||
logger,
|
||||
userJid: userJid,
|
||||
getUrlInfo: generateUrlInfo,
|
||||
upload: waUploadToServer
|
||||
}
|
||||
)
|
||||
|
||||
await relayWAMessage(msg, { waitForAck: options.waitForAck })
|
||||
return msg
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ export async function generateThumbnail(
|
||||
options.logger?.debug('could not generate video thumb: ' + err)
|
||||
}
|
||||
}
|
||||
|
||||
return thumbnail
|
||||
}
|
||||
export const getGotStream = async(url: string | URL, options: Options & { isStream?: true } = {}) => {
|
||||
@@ -174,9 +175,9 @@ export const encryptedStream = async(media: WAMediaUpload, mediaType: MediaType,
|
||||
for await(const data of stream) {
|
||||
fileLength += data.length
|
||||
sha256Plain = sha256Plain.update(data)
|
||||
if (writeStream && !writeStream.write(data)) await once(writeStream, 'drain')
|
||||
|
||||
writeStream && writeStream.write(data)
|
||||
if(writeStream) {
|
||||
if(!writeStream.write(data)) await once(writeStream, 'drain')
|
||||
}
|
||||
onChunk(aes.update(data))
|
||||
}
|
||||
onChunk(aes.final())
|
||||
|
||||
@@ -108,7 +108,7 @@ export const prepareWAMessageMedia = async(
|
||||
uploadData.seconds = await getAudioDuration(bodyPath)
|
||||
}
|
||||
} catch (error) {
|
||||
options.logger?.debug ({ error }, 'failed to obtain audio duration: ' + error.message)
|
||||
options.logger?.info({ trace: error.stack }, 'failed to obtain extra info')
|
||||
}
|
||||
const {mediaUrl} = await options.upload(
|
||||
createReadStream(encBodyPath),
|
||||
|
||||
Reference in New Issue
Block a user