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,
|
content,
|
||||||
{
|
{
|
||||||
...options,
|
...options,
|
||||||
|
logger,
|
||||||
userJid: userJid,
|
userJid: userJid,
|
||||||
getUrlInfo: generateUrlInfo,
|
getUrlInfo: generateUrlInfo,
|
||||||
upload: waUploadToServer
|
upload: waUploadToServer
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
await relayWAMessage(msg, { waitForAck: options.waitForAck })
|
await relayWAMessage(msg, { waitForAck: options.waitForAck })
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ export async function generateThumbnail(
|
|||||||
options.logger?.debug('could not generate video thumb: ' + err)
|
options.logger?.debug('could not generate video thumb: ' + err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return thumbnail
|
return thumbnail
|
||||||
}
|
}
|
||||||
export const getGotStream = async(url: string | URL, options: Options & { isStream?: true } = {}) => {
|
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) {
|
for await(const data of stream) {
|
||||||
fileLength += data.length
|
fileLength += data.length
|
||||||
sha256Plain = sha256Plain.update(data)
|
sha256Plain = sha256Plain.update(data)
|
||||||
if (writeStream && !writeStream.write(data)) await once(writeStream, 'drain')
|
if(writeStream) {
|
||||||
|
if(!writeStream.write(data)) await once(writeStream, 'drain')
|
||||||
writeStream && writeStream.write(data)
|
}
|
||||||
onChunk(aes.update(data))
|
onChunk(aes.update(data))
|
||||||
}
|
}
|
||||||
onChunk(aes.final())
|
onChunk(aes.final())
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export const prepareWAMessageMedia = async(
|
|||||||
uploadData.seconds = await getAudioDuration(bodyPath)
|
uploadData.seconds = await getAudioDuration(bodyPath)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} 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(
|
const {mediaUrl} = await options.upload(
|
||||||
createReadStream(encBodyPath),
|
createReadStream(encBodyPath),
|
||||||
|
|||||||
Reference in New Issue
Block a user