@queenanya/baileys 7.3.1 → 7.3.3
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 { 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,12 +68,6 @@ 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>;
|
|
@@ -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");
|
|
@@ -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() / 574;
|
|
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');
|