-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Injected.js remove .default #2822
Conversation
@@ -5,15 +5,15 @@ exports.ExposeStore = (moduleRaidStr) => { | |||
eval('var moduleRaid = ' + moduleRaidStr); | |||
// eslint-disable-next-line no-undef | |||
window.mR = moduleRaid(); | |||
window.Store = Object.assign({}, window.mR.findModule(m => m.default && m.default.Chat)[0].default); | |||
window.Store = Object.assign({}, window.mR.findModule(m => m && m.Chat)[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious - shouldn't it be 0 as in other cases?
window.Store = Object.assign({}, window.mR.findModule(m => m && m.Chat)[1]); | |
window.Store = Object.assign({}, window.mR.findModule(m => m && m.Chat)[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TY!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the reason of that is that we have many modules that have Chat function, so we need to check about something else than Chat method to define that this module is the Store, maybe if we check also for AdCollection or Blocklist or any other property we see in the picture, this will do the trick, like this:
window.Store = Object.assign({}, window.mR.findModule(m => m && m.Chat && m.Blocklist)[0]);
But it needs more test to ensure that Blocklist always found within Store module along the Chat function
Hope someone can test this and tell us if it does what we need, as currently i am not able to test it from my side !!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have new PR
i think the reason of that is that we have many modules that have Chat function, so we need to check about something else than Chat method to define that this module is the Store, maybe if we check also for AdCollection or Blocklist or any other property we see in the picture, this will do the trick, like this:
window.Store = Object.assign({}, window.mR.findModule(m => m && m.Chat && m.Blocklist)[0]);
But it needs more test to ensure that Blocklist always found within Store module along the Chat function
Hope someone can test this and tell us if it does what we need, as currently i am not able to test it from my side !!!
thx thats work. tested it on whatsapp version 2.3000.1012116664 |
Hello, |
yes, this will break the old Waweb version.
|
- Add isComet as property to the moduleRaid object with a boolean value that tell if current version is comet or not. - Add a property named `default` to the filled module and set the module itself as value of this property, in this way we do not need to make any change for the way we use findModule method inside 'injected.js', related pull request link : pedroslopez/whatsapp-web.js#2822
got to New PR |
PR Details
a change in the function on waweb 2.3000
Description
the function is not in default key, so I remove all .default in injected.js
Related Issue
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
How Has This Been Tested
Tested Sending and Receiving messages, using example from documentation
Windows 11
Android 8.1.0
Puppeter use Brave Browser
Node.js v20.9.0
WAWEB VERSION 2.3000.1012115560
Types of changes
Checklist