Comments (13)
NodeHandler.checkForEditedMessageNode = function (message, messageId, remoteJid) {
//
// Check if this is a message edit node
//
var messageEditValue = ProtocolMessage.Type.MESSAGE_EDIT.value;
if (message && message.editedMessage.message.protocolMessage.type == messageEditValue) {
var editedMessageId = message.editedMessage.message.protocolMessage.key.id;
if (saveEditedMsgsHookEnabled) {
onEditedMessageBlocked(message, remoteJid, messageId, editedMessageId);
}
return true;
}
return false;
};
That function works too, but i can't do the UI.
from whatsapp-web-incognito.
Do you mean saving the versions history of edited messages? Adding new features such as this is not so much of my priority right now, unless more people will show demand for them. Maybe in the future
from whatsapp-web-incognito.
Yes, Exactly.
I want to implement it myself but i couldn't found the object of edited message..
from whatsapp-web-incognito.
Perhaps they're sending a REVOKE
message first just like they do for deleted messages. I assume you have WADebugMode
on.
from whatsapp-web-incognito.
They just send this node with message tag
{
"tag": "message",
"attrs": {
"from": "62****:[email protected]",
"type": "text",
"edit": "1",
"id": "3EB07B07BB4AB8459ECF63",
"sender_lid": "***[email protected]",
"notify": "Neo",
"t": "1686930292"
},
"content": [
{
"tag": "enc",
"attrs": {
"v": "2",
"type": "pkmsg",
"decrypt-fail": "hide"
},
"content": {}
},
{
"tag": "device-identity",
"content": {}
}
]
}
from whatsapp-web-incognito.
Sure, but what does the encrypted protobuf contain?
from whatsapp-web-incognito.
Just found out that the WAProto
is very outdated 😂
I tried to update it from Baileys repo but it seems to break some function.
I see new MESSAGE_EDIT
protocol on Baileys WAProto
from whatsapp-web-incognito.
{
"stack": "Error: Failed to execute 'createElement' on 'Document': The tag name provided ('107') is not a valid name.\n at document.createElement (https://web.whatsapp.com/app.ab3cb96ce8b0b5e2ac7c.js:93:816907)\n at nodeToElement (chrome-extension://dgnhgkkblbdlgkebhopdhjfnliemgipp/core/utils.js:43:26)\n at nodeToElement (chrome-extension://dgnhgkkblbdlgkebhopdhjfnliemgipp/core/utils.js:52:29)\n at nodeToElement (chrome-extension://dgnhgkkblbdlgkebhopdhjfnliemgipp/core/utils.js:52:29)\n at nodeToElement (chrome-extension://dgnhgkkblbdlgkebhopdhjfnliemgipp/core/utils.js:52:29)\n at nodeToElement (chrome-extension://dgnhgkkblbdlgkebhopdhjfnliemgipp/core/utils.js:52:29)\n at printNode (chrome-extension://dgnhgkkblbdlgkebhopdhjfnliemgipp/core/interception.js:439:38)\n at Object.promise (chrome-extension://dgnhgkkblbdlgkebhopdhjfnliemgipp/core/interception.js:128:13)"
}
How to fix Error on this function?
function nodeToElement(node) {
if (!node.tag) {
var element = document.createElement("unknown");
element.innerHTML = node.toString();
return element;
}
console.log(node.tag);
if (node.tag == "0") node.tag = "zero"; // prevent "The tag name provided ('0') is not a valid name."
if (node.tag == "1") node.tag = "one"; // prevent "The tag name provided ('1') is not a valid name."
var element = document.createElement(node.tag);
for (var attribute in node.attrs) {
element.setAttribute(attribute, node.attrs[attribute]);
}
if (node.content) {
if (Array.isArray(node.content)) {
for (var subNode of node.content) {
element.appendChild(nodeToElement(subNode));
}
} else {
element.appendChild(nodeToElement(node.content));
}
}
return element;
}
file : /core/utils.js:43:26
from whatsapp-web-incognito.
Oh, the if (node.tag == "0") node.tag = "zero"
was just a dirtry hack I wrote to make exactly this error go away (numbers can't be tag names).
It'll be better to auto-detect all numbers, but for now you can add if (node.tag == "107")
or whatever
I see new MESSAGE_EDIT protocol on Baileys WAProto
Makes perfect sense, I'll update it
from whatsapp-web-incognito.
function numberstowords(number) {
var units = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
number = number.toString();
var result = "";
for (var i = 0; i < number.length; i++) {
result += units[number[i]];
}
return result;
}
function nodeToElement(node) {
if (!node.tag) {
var element = document.createElement("unknown");
element.innerHTML = node.toString();
return element;
}
if (node.tag == "0") node.tag = "zero"; // prevent "The tag name provided ('0') is not a valid name."
if (node.tag == "1") node.tag = "one"; // prevent "The tag name provided ('1') is not a valid name."
// if (node.tag == "107") node.tag = "onezeroseven"; // prevent "The tag name provided ('107') is not a valid name."
if (isNaN(node.tag) == false) node.tag = numberstowords(node.tag);
var element = document.createElement(node.tag);
for (var attribute in node.attrs) {
element.setAttribute(attribute, node.attrs[attribute]);
}
if (node.content) {
if (Array.isArray(node.content)) {
for (var subNode of node.content) {
element.appendChild(nodeToElement(subNode));
}
} else {
element.appendChild(nodeToElement(node.content));
}
}
return element;
}
Hahaha, it works after i did that
from whatsapp-web-incognito.
Nice :)
I agree, the UI is the more creative part. We do already have a context-menu detection in the code, so maybe you could add "Show original message" option or so when you open the context menu of a message
from whatsapp-web-incognito.
An alternative is to block the edited version entirely (which you seem to actually do), but this is probably not something everybody would want to happen. In this case, adding the UI option is easy
from whatsapp-web-incognito.
@neo2701 You are more than welcome to open a PR (even without UI)
from whatsapp-web-incognito.
Related Issues (20)
- WhatsApp Web gets stuck on "Loading your chats" when linking your device HOT 1
- Reactions remain unread HOT 19
- Jjj
- WhatsApp kh
- Feature Request: Script of the extension to work with Violent Monkey/TamperMonkey HOT 1
- Show Device of Messages stopped working HOT 35
- "Failed to restore message" HOT 21
- version 2.0.2+ doesn't work on Firefox: service_worker is not supported HOT 13
- Media stories not showing. (Only text stories) HOT 1
- Not syncing messages properly HOT 13
- Pinned, archived channels not synced HOT 3
- "Don't send "Last Seen" and "Typing" updates" checkbox changes don't update immediately HOT 9
- Restore edited message HOT 1
- Extension breaks after WhatsApp version 2.3000 HOT 31
- Icon appears twice in status bar sometimes [Race] HOT 1
- Profile Photo Change Notification HOT 2
- Could not decrypt Noise packet (multi_device.js:104 ReferenceError: pako is not defined) HOT 1
- Modal window is greyed out and freeze the page
- Bugs and Improvement HOT 1
- When having a password, Icon disappear right after unlocking WhatsApp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whatsapp-web-incognito.