violetics 7.0.3-alpha → 7.0.5-alpha
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/WAProto/index.js +502 -58
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/Client/websocket.js +10 -1
- package/lib/Socket/chats.js +3 -2
- package/lib/Socket/messages-recv.js +108 -146
- package/lib/Socket/socket.js +23 -13
- package/lib/Utils/event-buffer.js +2 -2
- package/lib/Utils/index.js +2 -1
- package/lib/Utils/message-retry-manager.js +1 -1
- package/lib/Utils/noise-handler.js +6 -0
- package/lib/Utils/offline-node-processor.js +39 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/WABinary/generic-utils.js +9 -9
- package/package.json +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds an ACK stanza for a received node.
|
|
3
|
+
* Pure function -- no I/O, no side effects.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors WhatsApp Web's ACK construction:
|
|
6
|
+
* - WAWebHandleMsgSendAck.sendAck / sendNack
|
|
7
|
+
* - WAWebCreateNackFromStanza.createNackFromStanza
|
|
8
|
+
*/
|
|
9
|
+
export function buildAckStanza(node, errorCode, meId) {
|
|
10
|
+
const { tag, attrs } = node;
|
|
11
|
+
const stanza = {
|
|
12
|
+
tag: 'ack',
|
|
13
|
+
attrs: {
|
|
14
|
+
id: attrs.id,
|
|
15
|
+
to: attrs.from,
|
|
16
|
+
class: tag
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
if (errorCode) {
|
|
20
|
+
stanza.attrs.error = errorCode.toString();
|
|
21
|
+
}
|
|
22
|
+
if (attrs.participant) {
|
|
23
|
+
stanza.attrs.participant = attrs.participant;
|
|
24
|
+
}
|
|
25
|
+
if (attrs.recipient) {
|
|
26
|
+
stanza.attrs.recipient = attrs.recipient;
|
|
27
|
+
}
|
|
28
|
+
// WA Web always includes type when present: `n.type || DROP_ATTR`
|
|
29
|
+
if (attrs.type) {
|
|
30
|
+
stanza.attrs.type = attrs.type;
|
|
31
|
+
}
|
|
32
|
+
// WA Web WAWebHandleMsgSendAck.sendAck/sendNack always include `from` for message-class ACKs
|
|
33
|
+
if (tag === 'message' && meId) {
|
|
34
|
+
stanza.attrs.from = meId;
|
|
35
|
+
}
|
|
36
|
+
return stanza;
|
|
37
|
+
}
|
|
@@ -111,7 +111,7 @@ export function binaryNodeToString(node, i = 0) {
|
|
|
111
111
|
return tag + content;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Lia@Changes 30-01-26
|
|
115
115
|
* ---
|
|
116
116
|
* Produce the binary node (WABinary-like JSON shape) required for the specific
|
|
117
117
|
* interactive button / list type.
|
|
@@ -124,12 +124,12 @@ export function binaryNodeToString(node, i = 0) {
|
|
|
124
124
|
* @returns {object} A node with shape { tag, attrs, [content] } to inject into additionalNodes.
|
|
125
125
|
*/
|
|
126
126
|
const FLOWS_MAP = {
|
|
127
|
-
mpm:
|
|
128
|
-
cta_catalog:
|
|
129
|
-
send_location:
|
|
130
|
-
call_permission_request:
|
|
131
|
-
wa_payment_transaction_details:
|
|
132
|
-
automated_greeting_message_view_catalog:
|
|
127
|
+
mpm: true,
|
|
128
|
+
cta_catalog: true,
|
|
129
|
+
send_location: true,
|
|
130
|
+
call_permission_request: true,
|
|
131
|
+
wa_payment_transaction_details: true,
|
|
132
|
+
automated_greeting_message_view_catalog: true
|
|
133
133
|
};
|
|
134
134
|
const qualityAttribute = {
|
|
135
135
|
tag: 'quality_control',
|
|
@@ -157,7 +157,7 @@ export const getBizBinaryNode = (message) => {
|
|
|
157
157
|
content: defaultContent
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
if (buttonName && FLOWS_MAP[buttonName]) {
|
|
161
161
|
return {
|
|
162
162
|
tag: 'biz',
|
|
163
163
|
attrs: {},
|
|
@@ -195,7 +195,7 @@ export const getBizBinaryNode = (message) => {
|
|
|
195
195
|
]
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
if (message.listMessage) {
|
|
199
199
|
return {
|
|
200
200
|
tag: 'biz',
|
|
201
201
|
attrs: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "violetics",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.5-alpha",
|
|
4
4
|
"description": "A simple fork of Baileys for WhatsApp automation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@hapi/boom": "^9.1.3",
|
|
43
43
|
"async-mutex": "^0.5.0",
|
|
44
44
|
"fflate": "^0.8.2",
|
|
45
|
-
"libsignal": "github
|
|
45
|
+
"libsignal": "git+https://github.com/whiskeysockets/libsignal-node",
|
|
46
46
|
"lru-cache": "^11.2.6",
|
|
47
47
|
"music-metadata": "^11.7.0",
|
|
48
48
|
"p-queue": "^9.1.0",
|