@queenanya/baileys 7.0.6 → 7.1.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.
- package/README.md +2 -2
- package/lib/Defaults/index.js +4 -4
- package/lib/Socket/chats.js +2 -1
- package/lib/Socket/messages-send.js +3 -0
- package/lib/Utils/generics.d.ts +0 -9
- package/lib/Utils/generics.js +1 -11
- package/lib/Utils/messages-media.js +2 -10
- package/package.json +5 -17
package/README.md
CHANGED
|
@@ -324,13 +324,13 @@ const sock = makeWASocket({ })
|
|
|
324
324
|
// the store can listen from a new socket once the current socket outlives its lifetime
|
|
325
325
|
store.bind(sock.ev)
|
|
326
326
|
|
|
327
|
-
sock.ev.on('chats.
|
|
327
|
+
sock.ev.on('chats.upsert', () => {
|
|
328
328
|
// can use "store.chats" however you want, even after the socket dies out
|
|
329
329
|
// "chats" => a KeyedDB instance
|
|
330
330
|
console.log('got chats', store.chats.all())
|
|
331
331
|
})
|
|
332
332
|
|
|
333
|
-
sock.ev.on('contacts.
|
|
333
|
+
sock.ev.on('contacts.upsert', () => {
|
|
334
334
|
console.log('got contacts', Object.values(store.contacts))
|
|
335
335
|
})
|
|
336
336
|
|
package/lib/Defaults/index.js
CHANGED
|
@@ -48,14 +48,14 @@ exports.PROCESSABLE_HISTORY_TYPES = [
|
|
|
48
48
|
];
|
|
49
49
|
exports.DEFAULT_CONNECTION_CONFIG = {
|
|
50
50
|
version: baileys_version_json_1.version,
|
|
51
|
-
browser: Utils_1.Browsers.ubuntu('
|
|
51
|
+
browser: Utils_1.Browsers.ubuntu('Chrome'),
|
|
52
52
|
waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
|
|
53
53
|
connectTimeoutMs: 20000,
|
|
54
54
|
keepAliveIntervalMs: 30000,
|
|
55
55
|
logger: logger_1.default.child({ class: 'baileys' }),
|
|
56
|
-
printQRInTerminal:
|
|
56
|
+
printQRInTerminal: false,
|
|
57
57
|
emitOwnEvents: true,
|
|
58
|
-
defaultQueryTimeoutMs:
|
|
58
|
+
defaultQueryTimeoutMs: 60000,
|
|
59
59
|
customUploadHosts: [],
|
|
60
60
|
retryRequestDelayMs: 250,
|
|
61
61
|
maxMsgRetryCount: 5,
|
|
@@ -68,7 +68,7 @@ exports.DEFAULT_CONNECTION_CONFIG = {
|
|
|
68
68
|
shouldIgnoreJid: () => false,
|
|
69
69
|
linkPreviewImageThumbnailWidth: 192,
|
|
70
70
|
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
|
|
71
|
-
generateHighQualityLinkPreview:
|
|
71
|
+
generateHighQualityLinkPreview: false,
|
|
72
72
|
options: {},
|
|
73
73
|
appStateMacVerification: {
|
|
74
74
|
patch: false,
|
package/lib/Socket/chats.js
CHANGED
package/lib/Utils/generics.d.ts
CHANGED
|
@@ -4,15 +4,6 @@ import { Logger } from 'pino';
|
|
|
4
4
|
import { proto } from '../../WAProto';
|
|
5
5
|
import { BaileysEventEmitter, BaileysEventMap, BrowsersMap, WACallUpdateType, WAVersion } from '../Types';
|
|
6
6
|
import { BinaryNode } from '../WABinary';
|
|
7
|
-
/**
|
|
8
|
-
const COMPANION_PLATFORM_MAP = {
|
|
9
|
-
'Chrome': '49',
|
|
10
|
-
'Edge': '50',
|
|
11
|
-
'Firefox': '51',
|
|
12
|
-
'Opera': '53',
|
|
13
|
-
'Safari': '54'
|
|
14
|
-
}
|
|
15
|
-
*/
|
|
16
7
|
export declare const Browsers: BrowsersMap;
|
|
17
8
|
export declare const getPlatformId: (browser: string) => any;
|
|
18
9
|
export declare const BufferJSON: {
|
package/lib/Utils/generics.js
CHANGED
|
@@ -12,7 +12,6 @@ const WAProto_1 = require("../../WAProto");
|
|
|
12
12
|
const baileys_version_json_1 = require("../Defaults/baileys-version.json");
|
|
13
13
|
const Types_1 = require("../Types");
|
|
14
14
|
const WABinary_1 = require("../WABinary");
|
|
15
|
-
/** Added Extra Browsers or Platforms*/
|
|
16
15
|
const PLATFORM_MAP = {
|
|
17
16
|
'aix': 'AIX',
|
|
18
17
|
'darwin': 'Mac OS',
|
|
@@ -22,15 +21,6 @@ const PLATFORM_MAP = {
|
|
|
22
21
|
'openbsd': 'OpenBSD',
|
|
23
22
|
'sunos': 'Solaris'
|
|
24
23
|
};
|
|
25
|
-
/**
|
|
26
|
-
const COMPANION_PLATFORM_MAP = {
|
|
27
|
-
'Chrome': '49',
|
|
28
|
-
'Edge': '50',
|
|
29
|
-
'Firefox': '51',
|
|
30
|
-
'Opera': '53',
|
|
31
|
-
'Safari': '54'
|
|
32
|
-
}
|
|
33
|
-
*/
|
|
34
24
|
exports.Browsers = {
|
|
35
25
|
ubuntu: (browser) => ['Ubuntu', browser, '22.04.4'],
|
|
36
26
|
macOS: (browser) => ['Mac OS', browser, '14.4.1'],
|
|
@@ -41,7 +31,7 @@ exports.Browsers = {
|
|
|
41
31
|
};
|
|
42
32
|
const getPlatformId = (browser) => {
|
|
43
33
|
const platformType = WAProto_1.proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
44
|
-
return platformType ? platformType.toString().charCodeAt(0).toString() : '
|
|
34
|
+
return platformType ? platformType.toString().charCodeAt(0).toString() : '49'; //chrome
|
|
45
35
|
};
|
|
46
36
|
exports.getPlatformId = getPlatformId;
|
|
47
37
|
exports.BufferJSON = {
|
|
@@ -532,22 +532,14 @@ const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, options },
|
|
|
532
532
|
let uploadInfo = await refreshMediaConn(false);
|
|
533
533
|
let urls;
|
|
534
534
|
const hosts = [...customUploadHosts, ...uploadInfo.hosts];
|
|
535
|
-
const chunks = [];
|
|
536
|
-
for await (const chunk of stream) {
|
|
537
|
-
chunks.push(chunk);
|
|
538
|
-
}
|
|
539
|
-
const reqBody = Buffer.concat(chunks);
|
|
540
535
|
fileEncSha256B64 = (0, exports.encodeBase64EncodedStringForUpload)(fileEncSha256B64);
|
|
541
|
-
for (const { hostname
|
|
536
|
+
for (const { hostname } of hosts) {
|
|
542
537
|
logger.debug(`uploading to "${hostname}"`);
|
|
543
538
|
const auth = encodeURIComponent(uploadInfo.auth); // the auth token
|
|
544
539
|
const url = `https://${hostname}${Defaults_1.MEDIA_PATH_MAP[mediaType]}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}`;
|
|
545
540
|
let result;
|
|
546
541
|
try {
|
|
547
|
-
|
|
548
|
-
throw new boom_1.Boom(`Body too large for "${hostname}"`, { statusCode: 413 });
|
|
549
|
-
}
|
|
550
|
-
const body = await axios_1.default.post(url, reqBody, {
|
|
542
|
+
const body = await axios_1.default.post(url, stream, {
|
|
551
543
|
...options,
|
|
552
544
|
headers: {
|
|
553
545
|
...options.headers || {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@queenanya/baileys",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"description": "WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"changelog:preview": "conventional-changelog -p angular -u",
|
|
34
34
|
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
35
35
|
"example": "node --inspect -r ts-node/register Example/example.ts",
|
|
36
|
+
"example:mobile": "node --inspect -r ts-node/register Example/example.ts --mobile",
|
|
36
37
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
37
38
|
"lint": "eslint src --ext .js,.ts,.jsx,.tsx",
|
|
38
39
|
"lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
|
|
@@ -49,21 +50,13 @@
|
|
|
49
50
|
"axios": "^1.6.0",
|
|
50
51
|
"cache-manager": "4.0.1",
|
|
51
52
|
"futoin-hkdf": "^1.5.1",
|
|
52
|
-
"json": "^11.0.0",
|
|
53
53
|
"libphonenumber-js": "^1.10.20",
|
|
54
|
-
"libsignal": "
|
|
54
|
+
"libsignal": "github:WhiskeySockets/libsignal-node",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
|
-
"megajs": "1.1.7",
|
|
57
56
|
"music-metadata": "^7.12.3",
|
|
58
57
|
"node-cache": "^5.1.2",
|
|
59
|
-
"oldusera": "npm:axios@1.6.0",
|
|
60
|
-
"olduserm": "npm:megajs@1.1.7",
|
|
61
|
-
"pastebin-js": "latest",
|
|
62
|
-
"pastebin-ts": "latest",
|
|
63
|
-
"pastedeno": "npm:@teamolduser/pastedeno",
|
|
64
58
|
"pino": "^7.0.0",
|
|
65
59
|
"protobufjs": "^7.2.4",
|
|
66
|
-
"release-it": "^15.10.3",
|
|
67
60
|
"uuid": "^10.0.0",
|
|
68
61
|
"ws": "^8.13.0"
|
|
69
62
|
},
|
|
@@ -80,13 +73,7 @@
|
|
|
80
73
|
"jimp": "^0.16.1",
|
|
81
74
|
"json": "^11.0.0",
|
|
82
75
|
"link-preview-js": "^3.0.0",
|
|
83
|
-
"megajs": "1.1.7",
|
|
84
76
|
"open": "^8.4.2",
|
|
85
|
-
"oldusera": "npm:axios@1.6.0",
|
|
86
|
-
"olduserm": "npm:megajs@1.1.7",
|
|
87
|
-
"pastebin-js": "latest",
|
|
88
|
-
"pastebin-ts": "latest",
|
|
89
|
-
"pastedeno": "npm:@teamolduser/pastedeno",
|
|
90
77
|
"qrcode-terminal": "^0.12.0",
|
|
91
78
|
"release-it": "^15.10.3",
|
|
92
79
|
"sharp": "^0.32.6",
|
|
@@ -114,5 +101,6 @@
|
|
|
114
101
|
"sharp": {
|
|
115
102
|
"optional": true
|
|
116
103
|
}
|
|
117
|
-
}
|
|
104
|
+
},
|
|
105
|
+
"packageManager": "yarn@1.22.19"
|
|
118
106
|
}
|