diff --git a/app.js b/app.js index 20126ec..ead03a2 100644 --- a/app.js +++ b/app.js @@ -65,7 +65,6 @@ async function initialize() { } swarm.on('connection', async (connection, info) => { - console.log('New connection established'); peerCount++; updatePeerCount(); @@ -76,15 +75,11 @@ async function initialize() { username: userName, avatar: iconBuffer.toString('base64'), }); - console.log('Sending icon:', iconMessage); connection.write(iconMessage); - } else { - console.log('Icon not found for user:', userName); } connection.on('data', async (data) => { const messageObj = JSON.parse(data.toString()); - console.log('Received message:', messageObj); if (messageObj.type === 'icon') { const username = messageObj.username; const avatarBuffer = Buffer.from(messageObj.avatar, 'base64'); @@ -96,7 +91,6 @@ async function initialize() { }); connection.on('close', () => { - console.log('Connection closed'); peerCount--; updatePeerCount(); }); @@ -282,13 +276,6 @@ async function updateIcon(username, avatarBuffer) { const userIcon = document.querySelector(`img[src*="${username}.png"]`); if (userIcon) { userIcon.src = URL.createObjectURL(new Blob([avatarBuffer])); - } else { - const imgElements = document.querySelectorAll('img'); // Find all img elements - imgElements.forEach(img => { - if (img.src.endsWith(`${username}.png`)) { // Update if it matches the username - img.src = URL.createObjectURL(new Blob([avatarBuffer])); - } - }); } } @@ -304,4 +291,4 @@ function toggleSetupView() { setupDiv.classList.toggle('hidden'); } -initialize(); +initialize(); \ No newline at end of file