@queenanya/baileys 7.3.2 → 7.3.5
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/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 {
|
|
259
|
+
const { preview } = await (0, Utils_1.generateProfilePictureFP)(content);
|
|
260
260
|
await query({
|
|
261
261
|
tag: 'iq',
|
|
262
262
|
attrs: {
|
|
@@ -269,7 +269,7 @@ const makeChatsSocket = (config) => {
|
|
|
269
269
|
{
|
|
270
270
|
tag: 'picture',
|
|
271
271
|
attrs: { type: 'image' },
|
|
272
|
-
content:
|
|
272
|
+
content: preview
|
|
273
273
|
}
|
|
274
274
|
]
|
|
275
275
|
});
|
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -68,6 +68,12 @@ 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
|
+
*/
|
|
71
77
|
setAt: Date;
|
|
72
78
|
} | undefined>;
|
|
73
79
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
@@ -31,13 +31,6 @@ 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
|
-
}>;
|
|
41
34
|
export declare const generatePP: (buffer: any) => Promise<{
|
|
42
35
|
img: any;
|
|
43
36
|
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.
|
|
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;
|
|
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() / 324;
|
|
200
200
|
}
|
|
201
201
|
;
|
|
202
202
|
width = width / ratio;
|
|
@@ -220,41 +220,6 @@ 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;
|
|
258
223
|
const generatePP = async (buffer) => {
|
|
259
224
|
const Jimp = require('jimp');
|
|
260
225
|
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|