whatsapp-web.js 1.33.1 → 1.33.3
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/package.json +1 -1
- package/src/Client.js +1 -1
- package/src/util/Injected/Store.js +12 -4
- package/src/util/Injected/Utils.js +4 -4
package/package.json
CHANGED
package/src/Client.js
CHANGED
|
@@ -234,7 +234,7 @@ class Client extends EventEmitter {
|
|
|
234
234
|
* @type {ClientInfo}
|
|
235
235
|
*/
|
|
236
236
|
this.info = new ClientInfo(this, await this.pupPage.evaluate(() => {
|
|
237
|
-
return { ...window.Store.Conn.serialize(), wid: window.Store.User.
|
|
237
|
+
return { ...window.Store.Conn.serialize(), wid: window.Store.User.getMaybeMePnUser() || window.Store.User.getMaybeMeLidUser() };
|
|
238
238
|
}));
|
|
239
239
|
|
|
240
240
|
this.interface = new InterfaceController(this);
|
|
@@ -102,6 +102,7 @@ exports.ExposeStore = () => {
|
|
|
102
102
|
window.Store.PinnedMsgUtils = window.require('WAWebSendPinMessageAction');
|
|
103
103
|
window.Store.UploadUtils = window.require('WAWebUploadManager');
|
|
104
104
|
window.Store.WAWebStreamModel = window.require('WAWebStreamModel');
|
|
105
|
+
window.Store.FindOrCreateChat = window.require('WAWebFindChatAction');
|
|
105
106
|
|
|
106
107
|
window.Store.Settings = {
|
|
107
108
|
...window.require('WAWebUserPrefsGeneral'),
|
|
@@ -210,14 +211,21 @@ exports.ExposeStore = () => {
|
|
|
210
211
|
* @param {Function} callback Modified function
|
|
211
212
|
*/
|
|
212
213
|
window.injectToFunction = (target, callback) => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
214
|
+
let module = window.require(target.module);
|
|
215
|
+
|
|
216
|
+
const path = target.function.split('.');
|
|
217
|
+
const funcName = path.pop();
|
|
218
|
+
for (const key of path) {
|
|
219
|
+
module = module[key];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const originalFunction = module[funcName];
|
|
223
|
+
module[funcName] = (...args) => callback(originalFunction, ...args);
|
|
217
224
|
};
|
|
218
225
|
|
|
219
226
|
window.injectToFunction({ module: 'WAWebBackendJobsCommon', function: 'mediaTypeFromProtobuf' }, (func, ...args) => { const [proto] = args; return proto.locationMessage ? null : func(...args); });
|
|
220
227
|
|
|
221
228
|
window.injectToFunction({ module: 'WAWebE2EProtoUtils', function: 'typeAttributeFromProtobuf' }, (func, ...args) => { const [proto] = args; return proto.locationMessage || proto.groupInviteMessage ? 'text' : func(...args); });
|
|
222
229
|
|
|
230
|
+
window.injectToFunction({ module: 'WAWebLid1X1MigrationGating', function: 'Lid1X1MigrationUtils.isLidMigrated' }, () => false);
|
|
223
231
|
};
|
|
@@ -242,14 +242,14 @@ exports.LoadUtils = () => {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
const lidUser = window.Store.User.getMaybeMeLidUser();
|
|
245
|
-
const meUser = window.Store.User.
|
|
245
|
+
const meUser = window.Store.User.getMaybeMePnUser();
|
|
246
246
|
const newId = await window.Store.MsgKey.newId();
|
|
247
247
|
let from = chat.id.isLid() ? lidUser : meUser;
|
|
248
248
|
let participant;
|
|
249
249
|
|
|
250
250
|
if (typeof chat.id?.isGroup === 'function' && chat.id.isGroup()) {
|
|
251
251
|
from = chat.groupMetadata && chat.groupMetadata.isLidAddressingMode ? lidUser : meUser;
|
|
252
|
-
participant = window.Store.WidFactory.
|
|
252
|
+
participant = window.Store.WidFactory.asUserWidOrThrow(from);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const newMsgKey = new window.Store.MsgKey({
|
|
@@ -539,7 +539,7 @@ exports.LoadUtils = () => {
|
|
|
539
539
|
chat = null;
|
|
540
540
|
}
|
|
541
541
|
} else {
|
|
542
|
-
chat = window.Store.Chat.get(chatWid) || (await window.Store.
|
|
542
|
+
chat = window.Store.Chat.get(chatWid) || (await window.Store.FindOrCreateChat.findOrCreateLatestChat(chatWid))?.chat;
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
return getAsModel && chat
|
|
@@ -839,7 +839,7 @@ exports.LoadUtils = () => {
|
|
|
839
839
|
|
|
840
840
|
window.WWebJS.rejectCall = async (peerJid, id) => {
|
|
841
841
|
peerJid = peerJid.split('@')[0] + '@s.whatsapp.net';
|
|
842
|
-
let userId = window.Store.User.
|
|
842
|
+
let userId = window.Store.User.getMaybeMePnUser().user + '@s.whatsapp.net';
|
|
843
843
|
const stanza = window.Store.SocketWap.wap('call', {
|
|
844
844
|
id: window.Store.SocketWap.generateId(),
|
|
845
845
|
from: window.Store.SocketWap.USER_JID(userId),
|