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
2 changed files with 1 additions and 21 deletions
Showing only changes of commit 7461dadf88 - Show all commits

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ chatBot/.env
chatBot/commands/ai.js chatBot/commands/ai.js
config.json config.json
.idea .idea
AIBot

21
app.js
View File

@ -440,27 +440,6 @@ async function handleFileInput(event) {
} }
} }
function sendFileMessage(name, fileUrl, fileType, avatar) {
const fileName = fileUrl.split('/').pop();
const messageObj = JSON.stringify({
type: 'file',
name,
fileName,
fileUrl,
fileType,
avatar,
topic: document.querySelector('#chat-room-topic').innerText,
timestamp: Date.now(),
});
const peers = [...swarm.connections];
for (const peer of peers) {
peer.write(messageObj);
}
addFileMessage(name, fileName, fileUrl, fileType, avatar, document.querySelector('#chat-room-topic').innerText);
}
function addFileMessage(from, fileName, fileUrl, fileType, avatar, topic) { function addFileMessage(from, fileName, fileUrl, fileType, avatar, topic) {
console.log('Adding file message:', { from, fileName, fileUrl, fileType, avatar, topic }); // Debugging log console.log('Adding file message:', { from, fileName, fileUrl, fileType, avatar, topic }); // Debugging log
const $div = document.createElement('div'); const $div = document.createElement('div');