mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-17 19:26:20 +00:00
* Fix: Cannot read properties of undefined (reading 'features') (#1407) * Fix: Cannot read properties of undefined (reading 'features') Find MD backend without features * Fix for tests * Update Client.js * Update LegacySessionAuth.js Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
This commit is contained in:
@@ -733,7 +733,7 @@ class Client extends EventEmitter {
|
||||
const couldSet = await this.pupPage.evaluate(async displayName => {
|
||||
if(!window.Store.Conn.canSetMyPushname()) return false;
|
||||
|
||||
if(window.Store.Features.features.MD_BACKEND) {
|
||||
if(window.Store.MDBackend) {
|
||||
// TODO
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -51,7 +51,7 @@ class LegacySessionAuth extends BaseAuthStrategy {
|
||||
|
||||
async getAuthEventPayload() {
|
||||
const isMD = await this.client.pupPage.evaluate(() => {
|
||||
return window.Store.Features.features.MD_BACKEND;
|
||||
return window.Store.MDBackend;
|
||||
});
|
||||
|
||||
if(isMD) throw new Error('Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.');
|
||||
@@ -69,4 +69,4 @@ class LegacySessionAuth extends BaseAuthStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LegacySessionAuth;
|
||||
module.exports = LegacySessionAuth;
|
||||
|
||||
@@ -13,7 +13,7 @@ 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.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK;
|
||||
window.Store.MDBackend = window.mR.findModule('isMDBackend')[0].isMDBackend();
|
||||
window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default;
|
||||
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
|
||||
window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0];
|
||||
@@ -159,7 +159,7 @@ exports.LoadUtils = () => {
|
||||
delete options.linkPreview;
|
||||
|
||||
// Not supported yet by WhatsApp Web on MD
|
||||
if(!window.Store.Features.features.MD_BACKEND) {
|
||||
if(!window.Store.MDBackend) {
|
||||
const link = window.Store.Validators.findLink(content);
|
||||
if (link) {
|
||||
const preview = await window.Store.Wap.queryLinkPreview(link.url);
|
||||
@@ -211,7 +211,7 @@ exports.LoadUtils = () => {
|
||||
}
|
||||
|
||||
const meUser = window.Store.User.getMaybeMeUser();
|
||||
const isMD = window.Store.Features.features.MD_BACKEND;
|
||||
const isMD = window.Store.MDBackend;
|
||||
|
||||
const newMsgId = new window.Store.MsgKey({
|
||||
from: meUser,
|
||||
@@ -512,7 +512,7 @@ exports.LoadUtils = () => {
|
||||
};
|
||||
|
||||
window.WWebJS.sendChatstate = async (state, chatId) => {
|
||||
if (window.Store.Features.features.MD_BACKEND) {
|
||||
if (window.Store.MDBackend) {
|
||||
chatId = window.Store.WidFactory.createWid(chatId);
|
||||
}
|
||||
switch (state) {
|
||||
|
||||
Reference in New Issue
Block a user