From 088ec32b7bedae76f4e1b9fea06ed6a09cacc477 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Wed, 26 Oct 2022 22:43:19 -0400 Subject: [PATCH] Support for WhatsApp Web 2.2241.6 (#1762) * proposed fix * Fixes * Add condition for older versions of WA * fix for old node version support * fix: default to mdbackend = true Co-authored-by: purpshell --- src/util/Injected.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index b1ae286..4184de8 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -13,7 +13,6 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd; window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; - window.Store.MDBackend = window.mR.findModule('isMDBackend')[0].isMDBackend(); window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].LegacyPhoneFeatures; window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default; window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; @@ -39,7 +38,6 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default; window.Store.Validators = window.mR.findModule('findLinks')[0]; window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0]; - window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default; window.Store.WidFactory = window.mR.findModule('createWid')[0]; window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0]; window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0]; @@ -71,6 +69,19 @@ exports.ExposeStore = (moduleRaidStr) => { }); }; } + + // TODO remove these once everybody has been updated to WWebJS with legacy sessions removed + const _linkPreview = window.mR.findModule('queryLinkPreview'); + if (_linkPreview && _linkPreview[0] && _linkPreview[0].default) { + window.Store.Wap = _linkPreview[0].default; + } + + const _isMDBackend = window.mR.findModule('isMDBackend'); + if(_isMDBackend && _isMDBackend[0] && _isMDBackend[0].isMDBackend) { + window.Store.MDBackend = _isMDBackend[0].isMDBackend(); + } else { + window.Store.MDBackend = true; + } }; exports.LoadUtils = () => {