Skip to content

Commit 5d29c2d

Browse files
committed
fix: fix for container mode also work only with files
1 parent a08bbab commit 5d29c2d

File tree

8 files changed

+5
-217
lines changed

8 files changed

+5
-217
lines changed

docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ services:
3636
- DATABASE_CONNECTION_URI=mongodb://root:root@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false&directConnection=true
3737
- DATABASE_CONNECTION_DB_PREFIX_NAME=evolution
3838
# Choose the data you want to save in the application's database or store
39-
- DATABASE_SAVE_DATA_INSTANCE=false
39+
- DATABASE_SAVE_DATA_INSTANCE=true
4040
- DATABASE_SAVE_DATA_OLD_MESSAGE=false
4141
- DATABASE_SAVE_DATA_NEW_MESSAGE=true
42-
- DATABASE_SAVE_MESSAGE_UPDATE=false
42+
- DATABASE_SAVE_MESSAGE_UPDATE=true
4343
- DATABASE_SAVE_DATA_CONTACTS=true
4444
- DATABASE_SAVE_DATA_CHATS=true
4545
- REDIS_ENABLED=true

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"cross-env": "^7.0.3",
5252
"dayjs": "^1.11.7",
5353
"eventemitter2": "^6.4.9",
54+
"exiftool-vendored": "^22.0.0",
5455
"express": "^4.18.2",
5556
"express-async-errors": "^3.1.1",
5657
"hbs": "^4.2.0",

src/utils/poll-update-decrypt-message.ts

Lines changed: 0 additions & 164 deletions
This file was deleted.

src/whatsapp/services/monitor.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export class WAMonitoringService {
224224
await set(dirent.name);
225225
}
226226
}
227+
initInstance();
227228
} catch (error) {
228229
this.logger.error(error);
229230
}

src/whatsapp/services/whatsapp.service.ts

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ import makeWASocket, {
2929
WAMessage,
3030
WAMessageUpdate,
3131
WASocket,
32-
WAMessageKey,
33-
WAMessageContent,
3432
getAggregateVotesInPollMessage,
35-
jidNormalizedUser,
36-
getKeyAuthor,
37-
decryptPollVote,
3833
} from '@evolution/base';
3934
import {
4035
Auth,
@@ -44,10 +39,8 @@ import {
4439
Database,
4540
QrCode,
4641
Redis,
47-
StoreConf,
4842
Webhook,
4943
} from '../../config/env.config';
50-
import { PollUpdateDecrypt } from '../../utils/poll-update-decrypt-message';
5144
import fs from 'fs';
5245
import { Logger } from '../../config/logger.config';
5346
import { INSTANCE_DIR, ROOT_DIR } from '../../config/path.config';
@@ -119,7 +112,6 @@ import { WebhookRaw } from '../models/webhook.model';
119112
import { dbserver } from '../../db/db.connect';
120113
import NodeCache from 'node-cache';
121114
import { useMultiFileAuthStateRedisDb } from '../../utils/use-multi-file-auth-state-redis-db';
122-
import { promisify } from 'util';
123115
import sharp from 'sharp';
124116

125117
export class WAStartupService {
@@ -726,49 +718,6 @@ export class WAStartupService {
726718
received.messageTimestamp = received.messageTimestamp?.toNumber();
727719
}
728720

729-
// if (received.message?.pollUpdateMessage) {
730-
// const creationMsgKey = received.message.pollUpdateMessage.pollCreationMessageKey;
731-
// const pollCreation = (await this.getMessage(
732-
// creationMsgKey,
733-
// true,
734-
// )) as proto.IWebMessageInfo;
735-
736-
// if (pollCreation) {
737-
// const meIdNormalised = jidNormalizedUser(this.instance.wuid);
738-
// const pollCreatorJid = getKeyAuthor(creationMsgKey, meIdNormalised);
739-
// const voterJid = getKeyAuthor(received.key!, meIdNormalised);
740-
// const pollEncKey = pollCreation.message?.messageContextInfo?.messageSecret;
741-
// // const voteMsg = decryptPollVote(received.message.pollUpdateMessage.vote, {
742-
// // pollEncKey,
743-
// // pollCreatorJid,
744-
// // pollMsgId: creationMsgKey.id,
745-
// // voterJid,
746-
// // });
747-
// // console.log('voteMsg: ', voteMsg);
748-
// // console.log(
749-
// // pollEncKey,
750-
// // received.message?.pollUpdateMessage.vote.encPayload,
751-
// // received.message?.pollUpdateMessage.vote.encIv,
752-
// // pollCreatorJid,
753-
// // pollCreation.key.id,
754-
// // voterJid,
755-
// // );
756-
// const hash = await PollUpdateDecrypt.decrypt(
757-
// pollEncKey, // from PollCreationMessage, HAS to be Uint8Array
758-
// received.message?.pollUpdateMessage.vote.encPayload, // from PollUpdateMessage, HAS to be Uint8Array
759-
// received.message?.pollUpdateMessage.vote.encIv, // from PollUpdateMessage, HAS to be Uint8Array
760-
// pollCreatorJid, // PollCreationMessage sender jid (author)
761-
// pollCreation.key.id, // Message ID of the PollCreationMessage (can be gotten via the store & pollCreationMessageKey property on the update)
762-
// voterJid, // PollUpdateMessage sender jid (author) \\ from above
763-
// );
764-
// const opt = pollCreation.message?.pollCreationMessage?.options.map(
765-
// (o) => o.optionName,
766-
// );
767-
// const option = await PollUpdateDecrypt.compare(opt, hash);
768-
// console.log('option: ', option);
769-
// }
770-
// }
771-
772721
const messageRaw: MessageRaw = {
773722
key: received.key,
774723
pushName: received.pushName,
@@ -1218,6 +1167,7 @@ export class WAStartupService {
12181167
imagePath = `${join(process.cwd(), 'temp', 'temp-sticker.png')}`;
12191168
await sharp(imageBuffer).toFile(imagePath);
12201169
}
1170+
12211171
await sharp(imagePath).webp().toFile(outputPath);
12221172

12231173
return outputPath;

temp/sticker.webp

188 Bytes
Loading

temp/sticker.webp_original

8.42 KB
Binary file not shown.

temp/temp-sticker.png

-6.38 KB
Binary file not shown.

0 commit comments

Comments
 (0)