@violetix/baileys 0.5.3 → 0.5.4
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 +4 -2
- package/lib/Socket/socket.js +20 -1
- package/lib/Utils/chat-utils.js +1 -1
- package/package.json +123 -123
package/lib/Socket/chats.js
CHANGED
|
@@ -956,14 +956,16 @@ export const makeChatsSocket = (config) => {
|
|
|
956
956
|
const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
|
|
957
957
|
ev.emit('messages.upsert', { messages: [msg], type });
|
|
958
958
|
if (!!msg.pushName) {
|
|
959
|
-
let jid = msg.key.fromMe ? authState.creds.me
|
|
959
|
+
let jid = msg.key.fromMe ? authState.creds.me?.id : msg.key.participant || msg.key.remoteJid;
|
|
960
960
|
jid = jidNormalizedUser(jid);
|
|
961
961
|
if (!msg.key.fromMe) {
|
|
962
962
|
ev.emit('contacts.update', [{ id: jid, notify: msg.pushName, verifiedName: msg.verifiedBizName }]);
|
|
963
963
|
}
|
|
964
964
|
// update our pushname too
|
|
965
965
|
if (msg.key.fromMe && msg.pushName && authState.creds.me?.name !== msg.pushName) {
|
|
966
|
-
|
|
966
|
+
if (authState.creds.me?.id) {
|
|
967
|
+
ev.emit('creds.update', { me: { ...authState.creds.me, name: msg.pushName } });
|
|
968
|
+
}
|
|
967
969
|
}
|
|
968
970
|
}
|
|
969
971
|
const historyMsg = getHistoryMsg(msg.message);
|
package/lib/Socket/socket.js
CHANGED
|
@@ -393,6 +393,7 @@ export const makeSocket = (config) => {
|
|
|
393
393
|
* correct answer: a socket that is receiving stanzas is logged in as this user.
|
|
394
394
|
*/
|
|
395
395
|
let lastMe = creds.me;
|
|
396
|
+
let userMissingLogged = false;
|
|
396
397
|
// add transaction capability
|
|
397
398
|
const keys = addTransactionCapability(authState.keys, logger, transactionOpts);
|
|
398
399
|
const signalRepository = makeSignalRepository({ creds, keys }, logger, pnFromLIDUSync);
|
|
@@ -1194,6 +1195,11 @@ export const makeSocket = (config) => {
|
|
|
1194
1195
|
logger.info('opened connection to WA');
|
|
1195
1196
|
clearTimeout(qrTimer); // will never happen in all likelyhood -- but just in case WA sends success on first try
|
|
1196
1197
|
ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } });
|
|
1198
|
+
if (!authState.creds.me?.id) {
|
|
1199
|
+
// `me` absent: the spread above produced a lid-only identity, which hosts then read as
|
|
1200
|
+
// `sock.user.id === undefined`. Say so once per socket instead of letting it look healthy.
|
|
1201
|
+
logger.error({ credsKeys: Object.keys(authState.creds), registered: authState.creds.registered, hasAccount: !!authState.creds.account }, 'login completed but creds.me.id is missing — host reads sock.user.id unguarded');
|
|
1202
|
+
}
|
|
1197
1203
|
ev.emit('connection.update', { connection: 'open' });
|
|
1198
1204
|
void sendUnifiedSession();
|
|
1199
1205
|
if (node.attrs.lid && authState.creds.me?.id) {
|
|
@@ -1408,7 +1414,20 @@ export const makeSocket = (config) => {
|
|
|
1408
1414
|
authState: { creds, keys },
|
|
1409
1415
|
signalRepository,
|
|
1410
1416
|
get user() {
|
|
1411
|
-
|
|
1417
|
+
const me = authState.creds.me ?? lastMe;
|
|
1418
|
+
if (!me && !userMissingLogged) {
|
|
1419
|
+
userMissingLogged = true;
|
|
1420
|
+
logger.error(
|
|
1421
|
+
{
|
|
1422
|
+
credsKeys: Object.keys(authState.creds),
|
|
1423
|
+
registered: authState.creds.registered,
|
|
1424
|
+
hasAccount: !!authState.creds.account,
|
|
1425
|
+
sameAuthObject: authState === config.auth
|
|
1426
|
+
},
|
|
1427
|
+
'sock.user is undefined: creds.me never arrived on this socket (host reads sock.user.id unguarded)'
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
return me;
|
|
1412
1431
|
},
|
|
1413
1432
|
/**
|
|
1414
1433
|
* True while the transport is repairing itself. A host that reads this does not build a
|
package/lib/Utils/chat-utils.js
CHANGED
|
@@ -732,7 +732,7 @@ export const processSyncAction = (syncAction, ev, me, initialSyncOpts, logger) =
|
|
|
732
732
|
}
|
|
733
733
|
else if (action?.pushNameSetting) {
|
|
734
734
|
const name = action?.pushNameSetting?.name;
|
|
735
|
-
if (name && me?.name !== name) {
|
|
735
|
+
if (name && me?.id && me?.name !== name) {
|
|
736
736
|
ev.emit('creds.update', { me: { ...me, name } });
|
|
737
737
|
}
|
|
738
738
|
}
|
package/package.json
CHANGED
|
@@ -1,125 +1,125 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
2
|
+
"name": "@violetix/baileys",
|
|
3
|
+
"version": "0.5.4",
|
|
4
|
+
"description": "Enhanced Baileys v7 with fixes for newsletter media uploads, plus support for interactive messages, albums, and additional message types.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"preinstall": "node ./engine-requirements.js",
|
|
10
|
+
"test": "node --experimental-vm-modules --test",
|
|
11
|
+
"test:types": "tsc -p tests/types/tsconfig.json",
|
|
12
|
+
"check": "node scripts/check.mjs && npm run test:types && npm test",
|
|
13
|
+
"prepublishOnly": "npm run check",
|
|
14
|
+
"proto": "node scripts/generate-waproto.mjs"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20.0.0"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/cv3inx/bv2.git"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/**/*",
|
|
25
|
+
"WAProto/**/*",
|
|
26
|
+
"engine-requirements.js"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"automation",
|
|
30
|
+
"baileys",
|
|
31
|
+
"bot",
|
|
32
|
+
"interactive-messages",
|
|
33
|
+
"js-whatsapp",
|
|
34
|
+
"multi-device",
|
|
35
|
+
"whatsapp",
|
|
36
|
+
"whatsapp-api",
|
|
37
|
+
"whatsapp-bot",
|
|
38
|
+
"whatsapp-web"
|
|
39
|
+
],
|
|
40
|
+
"homepage": "https://github.com/cv3inx/bv2#readme",
|
|
41
|
+
"author": "Violetics",
|
|
42
|
+
"contributors": [
|
|
43
|
+
"Lia Wynn",
|
|
44
|
+
"Rajeh Taher / WhiskeySockets"
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@adiwajshing/keyed-db": "^0.2.4",
|
|
52
|
+
"@cacheable/node-cache": "^1.4.0",
|
|
53
|
+
"@hapi/boom": "^9.1.3",
|
|
54
|
+
"async-mutex": "^0.5.0",
|
|
55
|
+
"fflate": "^0.8.2",
|
|
56
|
+
"libsignal": "^6.0.0",
|
|
57
|
+
"lru-cache": "^11.2.6",
|
|
58
|
+
"music-metadata": "^11.12.3",
|
|
59
|
+
"p-queue": "^9.1.0",
|
|
60
|
+
"pino": "^9.6.0",
|
|
61
|
+
"protobufjs": "^7.5.6",
|
|
62
|
+
"whatsapp-rust-bridge": "0.5.5",
|
|
63
|
+
"ws": "^8.19.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@napi-rs/image": "~1.12.0",
|
|
67
|
+
"audio-decode": "^2.2.3",
|
|
68
|
+
"better-sqlite3": "^11.0.0",
|
|
69
|
+
"jimp": "^1.6.1",
|
|
70
|
+
"link-preview-js": "^3.0.0",
|
|
71
|
+
"sharp": ">=0.33.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependenciesMeta": {
|
|
74
|
+
"@napi-rs/image": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"audio-decode": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"better-sqlite3": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"jimp": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"link-preview-js": {
|
|
87
|
+
"optional": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"resolutions": {
|
|
91
|
+
"ajv@npm:^6.12.4": "^6.14.0",
|
|
92
|
+
"basic-ftp": "^5.2.4",
|
|
93
|
+
"brace-expansion@npm:^1.1.7": "^1.1.13",
|
|
94
|
+
"brace-expansion@npm:^2.0.1": "^2.0.3",
|
|
95
|
+
"flatted": "^3.4.2",
|
|
96
|
+
"glob@npm:^10.2.2": "^10.5.0",
|
|
97
|
+
"glob@npm:^10.3.10": "^10.5.0",
|
|
98
|
+
"glob@npm:^10.5.0": "^10.5.0",
|
|
99
|
+
"handlebars": "^4.7.9",
|
|
100
|
+
"ip-address": "^10.1.1",
|
|
101
|
+
"js-yaml@npm:^3.13.1": "^3.14.2",
|
|
102
|
+
"js-yaml@npm:^4.1.0": "^4.1.1",
|
|
103
|
+
"markdown-it": "^14.1.1",
|
|
104
|
+
"minimatch@npm:^3.0.4": "^3.1.5",
|
|
105
|
+
"minimatch@npm:^3.1.2": "^3.1.5",
|
|
106
|
+
"minimatch@npm:^5.0.1": "^5.1.8",
|
|
107
|
+
"minimatch@npm:^9.0.4": "^9.0.9",
|
|
108
|
+
"minimatch@npm:^9.0.5": "^9.0.9",
|
|
109
|
+
"picomatch@npm:^2.0.4": "^2.3.2",
|
|
110
|
+
"picomatch@npm:^2.3.1": "^2.3.2",
|
|
111
|
+
"picomatch@npm:^4.0.0": "^4.0.4",
|
|
112
|
+
"picomatch@npm:^4.0.2": "^4.0.4",
|
|
113
|
+
"socks": "^2.8.8",
|
|
114
|
+
"tar": "^7.5.11",
|
|
115
|
+
"tmp": "^0.2.5",
|
|
116
|
+
"underscore": "^1.13.8",
|
|
117
|
+
"yaml@npm:^2.6.1": "^2.8.4"
|
|
118
|
+
},
|
|
119
|
+
"packageManager": "yarn@4.9.2",
|
|
120
|
+
"devDependencies": {
|
|
121
|
+
"@types/node": "^20.19.43",
|
|
122
|
+
"protobufjs-cli": "^1.3.3",
|
|
123
|
+
"typescript": "^7.0.2"
|
|
124
|
+
}
|
|
125
125
|
}
|