@queenanya/baileys 6.6.5 → 6.6.7
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/Utils/generics.js
CHANGED
|
@@ -19,9 +19,9 @@ const PLATFORM_MAP = {
|
|
|
19
19
|
'android': 'Android'
|
|
20
20
|
};
|
|
21
21
|
exports.Browsers = {
|
|
22
|
-
ubuntu: browser =>
|
|
23
|
-
macOS: browser =>
|
|
24
|
-
baileys: browser =>
|
|
22
|
+
ubuntu: browser => ['Firefox (linux)', browser, '119.0'],
|
|
23
|
+
macOS: browser => ['Firefox (linux)', browser, '119.0'],
|
|
24
|
+
baileys: browser => ['Firefox (linux)', browser, '119.0'],
|
|
25
25
|
/** The appropriate browser based on your OS & release */
|
|
26
26
|
appropriate: browser => [PLATFORM_MAP[(0, os_1.platform)()] || 'Firefox (linux)', browser, (0, os_1.release)()]
|
|
27
27
|
};
|
|
@@ -76,6 +76,41 @@ const generateLoginNode = (userJid, config) => {
|
|
|
76
76
|
return WAProto_1.proto.ClientPayload.fromObject(payload);
|
|
77
77
|
};
|
|
78
78
|
exports.generateLoginNode = generateLoginNode;
|
|
79
|
+
const findPlatformType = (platform) => {
|
|
80
|
+
platform = platform.toLowerCase();
|
|
81
|
+
switch (platform) {
|
|
82
|
+
case 'Chrome':
|
|
83
|
+
return WAProto_1.proto.DeviceProps.PlatformType.CHROME;
|
|
84
|
+
case 'Firefox':
|
|
85
|
+
return WAProto_1.proto.DeviceProps.PlatformType.FIREFOX;
|
|
86
|
+
case 'Internet Explorer':
|
|
87
|
+
return WAProto_1.proto.DeviceProps.PlatformType.IE;
|
|
88
|
+
case 'Edge':
|
|
89
|
+
return WAProto_1.proto.DeviceProps.PlatformType.EDGE;
|
|
90
|
+
case 'Opera':
|
|
91
|
+
return WAProto_1.proto.DeviceProps.PlatformType.OPERA;
|
|
92
|
+
case 'Safari':
|
|
93
|
+
return WAProto_1.proto.DeviceProps.PlatformType.SAFARI;
|
|
94
|
+
case 'Desktop':
|
|
95
|
+
return WAProto_1.proto.DeviceProps.PlatformType.DESKTOP;
|
|
96
|
+
case 'chrome':
|
|
97
|
+
return WAProto_1.proto.DeviceProps.PlatformType.CHROME;
|
|
98
|
+
case 'firefox':
|
|
99
|
+
return WAProto_1.proto.DeviceProps.PlatformType.FIREFOX;
|
|
100
|
+
case 'internet explorer':
|
|
101
|
+
return WAProto_1.proto.DeviceProps.PlatformType.IE;
|
|
102
|
+
case 'edge':
|
|
103
|
+
return WAProto_1.proto.DeviceProps.PlatformType.EDGE;
|
|
104
|
+
case 'opera':
|
|
105
|
+
return WAProto_1.proto.DeviceProps.PlatformType.OPERA;
|
|
106
|
+
case 'safari':
|
|
107
|
+
return WAProto_1.proto.DeviceProps.PlatformType.SAFARI;
|
|
108
|
+
case 'desktop':
|
|
109
|
+
return WAProto_1.proto.DeviceProps.PlatformType.DESKTOP;
|
|
110
|
+
default:
|
|
111
|
+
return WAProto_1.proto.DeviceProps.PlatformType.DESKTOP;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
79
114
|
const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentityKey }, config) => {
|
|
80
115
|
// the app version needs to be md5 hashed
|
|
81
116
|
// and passed in
|
|
@@ -84,7 +119,7 @@ const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentity
|
|
|
84
119
|
.digest();
|
|
85
120
|
const companion = {
|
|
86
121
|
os: config.browser[0],
|
|
87
|
-
platformType:
|
|
122
|
+
platformType: findPlatformType(config.browser[1]),
|
|
88
123
|
requireFullSync: config.syncFullHistory,
|
|
89
124
|
};
|
|
90
125
|
const companionProto = WAProto_1.proto.DeviceProps.encode(companion).finish();
|