@blurose/baileys 1.1.9 → 1.1.11
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/socket.js
CHANGED
|
@@ -594,9 +594,12 @@ export const makeSocket = (config) => {
|
|
|
594
594
|
void end(new Boom(msg || 'Intentional Logout', { statusCode: DisconnectReason.loggedOut }));
|
|
595
595
|
};
|
|
596
596
|
const requestPairingCode = async (phoneNumber, customPairingCode) => {
|
|
597
|
-
|
|
598
|
-
if (customPairingCode
|
|
599
|
-
|
|
597
|
+
let pairingCode = customPairingCode ?? bytesToCrockford(randomBytes(5));
|
|
598
|
+
if (customPairingCode) {
|
|
599
|
+
// Blurose Auto-Formatter: ensure pairing code is exactly 8 chars
|
|
600
|
+
pairingCode = customPairingCode.replace(/[^a-zA-Z0-9]/g, '').toUpperCase();
|
|
601
|
+
if (pairingCode.length > 8) pairingCode = pairingCode.substring(0, 8);
|
|
602
|
+
while (pairingCode.length < 8) pairingCode += '0';
|
|
600
603
|
}
|
|
601
604
|
authState.creds.pairingCode = pairingCode;
|
|
602
605
|
authState.creds.me = {
|
package/lib/Utils/messages.js
CHANGED
|
@@ -97,7 +97,7 @@ export const prepareWAMessageMedia = async (message, options) => {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
const isNewsletter = !!options.jid && isJidNewsletter(options.jid);
|
|
100
|
-
if (isNewsletter) {
|
|
100
|
+
if (false && isNewsletter) {
|
|
101
101
|
logger?.info({ key: cacheableKey }, 'Preparing raw media for newsletter');
|
|
102
102
|
const { filePath, fileSha256, fileLength } = await getRawMediaUploadData(uploadData.media, options.mediaTypeOverride || mediaType, logger);
|
|
103
103
|
const fileSha256B64 = fileSha256.toString('base64');
|
|
@@ -115,6 +115,15 @@ export const useMultiFileAuthState = async (folder) => {
|
|
|
115
115
|
},
|
|
116
116
|
saveCreds: async () => {
|
|
117
117
|
return writeData(creds, 'creds.json');
|
|
118
|
+
},
|
|
119
|
+
clearPreKeys: async () => {
|
|
120
|
+
try {
|
|
121
|
+
const files = await (0, fs_1.readdir)(folder);
|
|
122
|
+
const preKeyFiles = files.filter(f => f.startsWith('pre-key-') && f !== 'pre-key-record');
|
|
123
|
+
await Promise.all(preKeyFiles.map(f => removeData(f)));
|
|
124
|
+
} catch (err) {
|
|
125
|
+
// ignore if folder doesn't exist
|
|
126
|
+
}
|
|
118
127
|
}
|
|
119
128
|
};
|
|
120
129
|
};
|