@queenanya/baileys 7.3.0 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Socket/business.d.ts +2 -2
- package/lib/Socket/chats.d.ts +2 -2
- package/lib/Socket/chats.js +1 -1
- package/lib/Socket/groups.d.ts +2 -8
- package/lib/Socket/index.d.ts +2 -2
- package/lib/Socket/messages-recv.d.ts +2 -2
- package/lib/Socket/messages-send.d.ts +2 -2
- package/lib/Socket/newsletter.d.ts +2 -2
- package/lib/Socket/registration.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +7 -0
- package/lib/Utils/messages-media.js +37 -2
- package/package.json +1 -1
package/lib/Socket/business.d.ts
CHANGED
|
@@ -118,8 +118,8 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
118
118
|
setAt: Date;
|
|
119
119
|
} | undefined>;
|
|
120
120
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
121
|
-
updateProfilePictureFull: (jid:
|
|
122
|
-
updateProfilePictureFull2: (jid:
|
|
121
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
122
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
123
123
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
124
124
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
125
125
|
updateProfileName: (name: string) => Promise<void>;
|
package/lib/Socket/chats.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
32
32
|
setAt: Date;
|
|
33
33
|
} | undefined>;
|
|
34
34
|
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
35
|
-
updateProfilePictureFull: (jid:
|
|
36
|
-
updateProfilePictureFull2: (jid:
|
|
35
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
36
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
37
37
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
38
38
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
39
39
|
updateProfileName: (name: string) => Promise<void>;
|
package/lib/Socket/chats.js
CHANGED
|
@@ -256,7 +256,7 @@ const makeChatsSocket = (config) => {
|
|
|
256
256
|
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
257
257
|
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
258
258
|
}
|
|
259
|
-
const { img } = await (0, Utils_1.
|
|
259
|
+
const { img } = await (0, Utils_1.generateProfilePictureFull2)(content);
|
|
260
260
|
await query({
|
|
261
261
|
tag: 'iq',
|
|
262
262
|
attrs: {
|
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -68,17 +68,11 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
68
68
|
}[]>;
|
|
69
69
|
fetchStatus: (jid: string) => Promise<{
|
|
70
70
|
status: string | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* revoke a v4 invite for someone
|
|
73
|
-
* @param groupJid group jid
|
|
74
|
-
* @param invitedJid jid of person you invited
|
|
75
|
-
* @returns true if successful
|
|
76
|
-
*/
|
|
77
71
|
setAt: Date;
|
|
78
72
|
} | undefined>;
|
|
79
73
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
80
|
-
updateProfilePictureFull: (jid:
|
|
81
|
-
updateProfilePictureFull2: (jid:
|
|
74
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
75
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
82
76
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
83
77
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
84
78
|
updateProfileName: (name: string) => Promise<void>;
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -119,8 +119,8 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
119
119
|
setAt: Date;
|
|
120
120
|
} | undefined>;
|
|
121
121
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
122
|
-
updateProfilePictureFull: (jid:
|
|
123
|
-
updateProfilePictureFull2: (jid:
|
|
122
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
123
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
124
124
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
125
125
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
126
126
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -105,8 +105,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
105
105
|
setAt: Date;
|
|
106
106
|
} | undefined>;
|
|
107
107
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
108
|
-
updateProfilePictureFull: (jid:
|
|
109
|
-
updateProfilePictureFull2: (jid:
|
|
108
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
109
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
110
110
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
111
111
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
112
112
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -98,8 +98,8 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
|
98
98
|
setAt: Date;
|
|
99
99
|
} | undefined>;
|
|
100
100
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
101
|
-
updateProfilePictureFull: (jid:
|
|
102
|
-
updateProfilePictureFull2: (jid:
|
|
101
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
102
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
103
103
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
104
104
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
105
105
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -83,8 +83,8 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
|
83
83
|
setAt: Date;
|
|
84
84
|
} | undefined>;
|
|
85
85
|
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
86
|
-
updateProfilePictureFull: (jid:
|
|
87
|
-
updateProfilePictureFull2: (jid:
|
|
86
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
87
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
88
88
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
89
89
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
90
90
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -120,8 +120,8 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
|
120
120
|
setAt: Date;
|
|
121
121
|
} | undefined>;
|
|
122
122
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
123
|
-
updateProfilePictureFull: (jid:
|
|
124
|
-
updateProfilePictureFull2: (jid:
|
|
123
|
+
updateProfilePictureFull: (jid: any, content: any) => Promise<void>;
|
|
124
|
+
updateProfilePictureFull2: (jid: any, content: any) => Promise<void>;
|
|
125
125
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
126
126
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
127
127
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -31,6 +31,13 @@ export declare const generateProfilePictureFP: (buffer: any) => Promise<{
|
|
|
31
31
|
img: any;
|
|
32
32
|
preview: any;
|
|
33
33
|
}>;
|
|
34
|
+
export declare const generateProfilePictureFull2: (img: any) => Promise<{
|
|
35
|
+
img: any;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const generateProfilePictureFP2: (buffer: any) => Promise<{
|
|
38
|
+
img: any;
|
|
39
|
+
preview: any;
|
|
40
|
+
}>;
|
|
34
41
|
export declare const generatePP: (buffer: any) => Promise<{
|
|
35
42
|
img: any;
|
|
36
43
|
preview: any;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioWaveform = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.changeprofileFull = exports.generatePP = exports.generateProfilePictureFP = exports.generateProfilePictureFull = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.getMediaKeys = exports.hkdfInfoKey = void 0;
|
|
29
|
+
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioWaveform = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.changeprofileFull = exports.generatePP = exports.generateProfilePictureFP2 = exports.generateProfilePictureFull2 = exports.generateProfilePictureFP = exports.generateProfilePictureFull = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.getMediaKeys = exports.hkdfInfoKey = void 0;
|
|
30
30
|
const boom_1 = require("@hapi/boom");
|
|
31
31
|
const axios_1 = __importDefault(require("axios"));
|
|
32
32
|
const child_process_1 = require("child_process");
|
|
@@ -196,7 +196,7 @@ const generateProfilePictureFull = async (img) => {
|
|
|
196
196
|
ratio = jimp.getWidth() / 720;
|
|
197
197
|
}
|
|
198
198
|
else {
|
|
199
|
-
ratio = jimp.getWidth() /
|
|
199
|
+
ratio = jimp.getWidth() / 720;
|
|
200
200
|
}
|
|
201
201
|
;
|
|
202
202
|
width = width / ratio;
|
|
@@ -220,6 +220,41 @@ const generateProfilePictureFP = async (buffer) => {
|
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
222
|
exports.generateProfilePictureFP = generateProfilePictureFP;
|
|
223
|
+
const generateProfilePictureFull2 = async (img) => {
|
|
224
|
+
const Jimp = require('jimp');
|
|
225
|
+
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|
|
226
|
+
const jimp = await read(img);
|
|
227
|
+
const min = Math.min(jimp.getWidth(), jimp.getHeight());
|
|
228
|
+
const cropped = jimp.crop(0, 0, jimp.getWidth(), jimp.getHeight());
|
|
229
|
+
let width = jimp.getWidth(), hight = jimp.getHeight(), ratio;
|
|
230
|
+
if (width > hight) {
|
|
231
|
+
ratio = jimp.getWidth() / 1280;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
ratio = jimp.getWidth() / 1280;
|
|
235
|
+
}
|
|
236
|
+
;
|
|
237
|
+
width = width / ratio;
|
|
238
|
+
hight = hight / ratio;
|
|
239
|
+
img = cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG);
|
|
240
|
+
return {
|
|
241
|
+
img: await img
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
exports.generateProfilePictureFull2 = generateProfilePictureFull2;
|
|
245
|
+
const generateProfilePictureFP2 = async (buffer) => {
|
|
246
|
+
const Jimp = require('jimp');
|
|
247
|
+
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|
|
248
|
+
const jimp = await Jimp.read(buffer);
|
|
249
|
+
const min = jimp.getWidth();
|
|
250
|
+
const max = jimp.getHeight();
|
|
251
|
+
const cropped = jimp.crop(0, 0, min, max);
|
|
252
|
+
return {
|
|
253
|
+
img: await cropped.scaleToFit(1280, 1280).getBufferAsync(Jimp.MIME_JPEG),
|
|
254
|
+
preview: await cropped.normalize().getBufferAsync(Jimp.MIME_JPEG),
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
exports.generateProfilePictureFP2 = generateProfilePictureFP2;
|
|
223
258
|
const generatePP = async (buffer) => {
|
|
224
259
|
const Jimp = require('jimp');
|
|
225
260
|
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|