forked from snxraven/LinkUp-P2P-Chat
Up to date fork #1
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ chatBot/.env
|
||||
chatBot/commands/ai.js
|
||||
config.json
|
||||
.idea
|
||||
AIBot
|
21
app.js
21
app.js
@ -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) {
|
||||
console.log('Adding file message:', { from, fileName, fileUrl, fileType, avatar, topic }); // Debugging log
|
||||
const $div = document.createElement('div');
|
||||
|
Loading…
Reference in New Issue
Block a user