Up to date fork #1

Merged
MiTask merged 33 commits from snxraven/LinkUp-P2P-Chat:main into main 2024-06-14 04:32:25 -04:00
Showing only changes of commit 98aa79f075 - Show all commits

14
app.js
View File

@ -768,7 +768,19 @@ function addMessageToStore(topic, messageObj) {
if (!messagesStore[topic]) { if (!messagesStore[topic]) {
messagesStore[topic] = []; messagesStore[topic] = [];
} }
messagesStore[topic].push(messageObj);
// Check for duplicates
const isDuplicate = messagesStore[topic].some(msg =>
msg.from === messageObj.from &&
msg.message === messageObj.message &&
msg.timestamp === messageObj.timestamp
);
if (!isDuplicate) {
messagesStore[topic].push(messageObj);
} else {
console.log('Duplicate message detected:', messageObj); // Debugging log
}
} }
function loadConfigFromFile() { function loadConfigFromFile() {