@crysnovax/baileys 2.6.0 → 2.6.1

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.
@@ -5,6 +5,7 @@ import { DEFAULT_CACHE_TTLS, HISTORY_SYNC_PAUSED_TIMEOUT_MS, PROCESSABLE_HISTORY
5
5
  import { ALL_WA_PATCH_NAMES } from '../Types/index.js';
6
6
  import { SyncState } from '../Types/State.js';
7
7
  import { chatModificationToAppPatch, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, ensureLTHashStateVersion, extractSyncdPatches, generateProfilePicture, getHistoryMsg, isAppStateSyncIrrecoverable, isMissingKeyError, MAX_SYNC_ATTEMPTS, newLTHashState, processSyncAction } from '../Utils/index.js';
8
+ import { getStream, toBuffer } from '../Utils/messages-media.js';
8
9
  import { makeMutex } from '../Utils/make-mutex.js';
9
10
  import processMessage from '../Utils/process-message.js';
10
11
  import { buildTcTokenFromJid } from '../Utils/tc-token-utils.js';
@@ -207,7 +208,15 @@ export const makeChatsSocket = (config) => {
207
208
  }
208
209
  return userId;
209
210
  };
210
- /** update the profile picture for yourself or a group */
211
+ /** update the profile picture for yourself or a group
212
+ *
213
+ * Standard (crop + resize to 720×720):
214
+ * sock.updateProfilePicture(jid, content)
215
+ * sock.updateProfilePicture(jid, content, { width: 640, height: 640 })
216
+ *
217
+ * HD (full-size, no crop, no resize):
218
+ * sock.updateProfilePicture(jid, content, { hd: true })
219
+ */
211
220
  const updateProfilePicture = async (jid, content, dimensions) => {
212
221
  let targetJid;
213
222
  if (!jid) {
@@ -219,7 +228,18 @@ export const makeChatsSocket = (config) => {
219
228
  else {
220
229
  targetJid = undefined;
221
230
  }
222
- const { img } = await generateProfilePicture(content, dimensions);
231
+ let img;
232
+ if (dimensions?.hd) {
233
+ // crysnovax@HD-Profile --- bypass resize/crop, send raw buffer directly
234
+ if (Buffer.isBuffer(content)) {
235
+ img = content;
236
+ } else {
237
+ const { stream } = await getStream(content);
238
+ img = await toBuffer(stream);
239
+ }
240
+ } else {
241
+ ({ img } = await generateProfilePicture(content, dimensions));
242
+ }
223
243
  await query({
224
244
  tag: 'iq',
225
245
  attrs: {