mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
chore: update CHANGELOG for Baileys v7.0.0-rc.2 and implement message content sanitization in Baileys service
Some checks are pending
Build Docker image / Build and Deploy (push) Waiting to run
Some checks are pending
Build Docker image / Build and Deploy (push) Waiting to run
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
* Baileys Updates: Support LIDs in Baileys ([Commit 20693a5](https://github.com/WhiskeySockets/Baileys/commit/20693a59d0973fbf57b28de1b90c55484ce27f8e))
|
* Baileys Updates: v7.0.0-rc.2 ([Link](https://github.com/WhiskeySockets/Baileys/releases/tag/v7.0.0-rc.2))
|
||||||
|
|
||||||
# 2.3.2 (2025-09-02)
|
# 2.3.2 (2025-09-02)
|
||||||
|
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -4986,8 +4986,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/baileys": {
|
"node_modules/baileys": {
|
||||||
"version": "6.7.19",
|
"version": "7.0.0-rc.2",
|
||||||
"resolved": "git+ssh://git@github.com/WhiskeySockets/Baileys.git#20693a59d0973fbf57b28de1b90c55484ce27f8e",
|
"resolved": "git+ssh://git@github.com/WhiskeySockets/Baileys.git#7970a6e9af73971a5fb0636aec4255504ac1f161",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -4299,6 +4299,32 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
throw new Error('Method not available in the Baileys service');
|
throw new Error('Method not available in the Baileys service');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sanitizeMessageContent(messageContent: any): any {
|
||||||
|
if (!messageContent) return messageContent;
|
||||||
|
|
||||||
|
// Deep clone to avoid modifying original
|
||||||
|
const sanitized = JSON.parse(JSON.stringify(messageContent, (key, value) => {
|
||||||
|
// Convert Long objects to numbers
|
||||||
|
if (Long.isLong(value)) {
|
||||||
|
return value.toNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert Uint8Array to regular arrays or remove them
|
||||||
|
if (value instanceof Uint8Array) {
|
||||||
|
return Array.from(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove functions and other non-serializable objects
|
||||||
|
if (typeof value === 'function') {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}));
|
||||||
|
|
||||||
|
return sanitized;
|
||||||
|
}
|
||||||
|
|
||||||
private prepareMessage(message: proto.IWebMessageInfo): any {
|
private prepareMessage(message: proto.IWebMessageInfo): any {
|
||||||
const contentType = getContentType(message.message);
|
const contentType = getContentType(message.message);
|
||||||
const contentMsg = message?.message[contentType] as any;
|
const contentMsg = message?.message[contentType] as any;
|
||||||
@@ -4311,10 +4337,12 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
? 'Você'
|
? 'Você'
|
||||||
: message?.participant || (message.key?.participant ? message.key.participant.split('@')[0] : null)),
|
: message?.participant || (message.key?.participant ? message.key.participant.split('@')[0] : null)),
|
||||||
status: status[message.status],
|
status: status[message.status],
|
||||||
message: { ...message.message },
|
message: this.sanitizeMessageContent({ ...message.message }),
|
||||||
contextInfo: contentMsg?.contextInfo,
|
contextInfo: contentMsg?.contextInfo,
|
||||||
messageType: contentType || 'unknown',
|
messageType: contentType || 'unknown',
|
||||||
messageTimestamp: message.messageTimestamp as number,
|
messageTimestamp: Long.isLong(message.messageTimestamp)
|
||||||
|
? (message.messageTimestamp as Long).toNumber()
|
||||||
|
: (message.messageTimestamp as number),
|
||||||
instanceId: this.instanceId,
|
instanceId: this.instanceId,
|
||||||
source: getDevice(message.key.id),
|
source: getDevice(message.key.id),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user