aunubaileys 1.0.23 β 1.0.24
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/README.md +4 -0
- package/lib/Socket/chats.js +17 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,10 @@ Everything else is pure upstream. When upstream moves, we rebase the patch layer
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
### π What's new in 1.0.24 / Baru di 1.0.24
|
|
68
|
+
|
|
69
|
+
- πΌοΈ **`profilePictureUrl` no longer throws for βno pictureβ** β a contact with no photo (or one hidden by privacy settings) made the server answer 401/404 and upstream let the Boom crash every caller that forgot a try/catch. Those statuses now resolve to `undefined`, consistent with the existing empty-picture-node case; real failures (timeouts, 5xx) still throw.
|
|
70
|
+
|
|
67
71
|
### π What's new in 1.0.23 / Baru di 1.0.23
|
|
68
72
|
|
|
69
73
|
- πΌοΈ **Old-media downloads recover from 403** β the phone re-upload recovery path for failed media downloads only triggered on HTTP 404/410, but WhatsApp's media CDN answers **403** when a message's directPath/url auth has expired β the common case for older media. Downloads of old media therefore failed permanently even though the sender's phone could heal them. 403 now triggers the re-upload request; if the media is truly gone, the re-upload fails as well and the original error propagates unchanged.
|
package/lib/Socket/chats.js
CHANGED
|
@@ -468,6 +468,12 @@ export const makeChatsSocket = (config) => {
|
|
|
468
468
|
*/
|
|
469
469
|
const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
|
|
470
470
|
jid = jidNormalizedUser(jid);
|
|
471
|
+
// AunuBaileys: "no picture / not visible to us" is an expected answer,
|
|
472
|
+
// not an exception β the server replies 401/404 and upstream let the
|
|
473
|
+
// Boom crash every caller that forgot a try/catch (menus, welcome
|
|
474
|
+
// messages, profil commands all fetch avatars). Those statuses now
|
|
475
|
+
// resolve to undefined, matching the existing no-picture-node case;
|
|
476
|
+
// real failures (timeouts, 5xx) still throw.
|
|
471
477
|
const result = await query({
|
|
472
478
|
tag: 'iq',
|
|
473
479
|
attrs: {
|
|
@@ -477,7 +483,17 @@ export const makeChatsSocket = (config) => {
|
|
|
477
483
|
xmlns: 'w:profile:picture'
|
|
478
484
|
},
|
|
479
485
|
content: [{ tag: 'picture', attrs: { type, query: 'url' } }]
|
|
480
|
-
}, timeoutMs)
|
|
486
|
+
}, timeoutMs).catch((err) => {
|
|
487
|
+
// codebase convention (assertNodeErrorFree): IQ error codes ride in err.data as a number
|
|
488
|
+
const status = typeof err?.data === 'number' ? err.data : (err?.data?.attrs?.status || err?.data?.attrs?.code || err?.output?.statusCode || err?.status);
|
|
489
|
+
if (status === 401 || status === '401' || status === 404 || status === '404') {
|
|
490
|
+
return undefined;
|
|
491
|
+
}
|
|
492
|
+
throw err;
|
|
493
|
+
});
|
|
494
|
+
if (!result) {
|
|
495
|
+
return undefined;
|
|
496
|
+
}
|
|
481
497
|
const child = getBinaryNodeChild(result, 'picture');
|
|
482
498
|
return child?.attrs?.url;
|
|
483
499
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aunubaileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.24",
|
|
5
5
|
"description": "AunuBaileys \u2014 a WhatsApp Web API for bots that never sleep. Full upstream power with the beloved in-memory store restored and pairing that just works. Forged by AunuCore.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|