From 748f4664b391d68b56cd0a770e0f5e0fd3b33a57 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Sat, 8 Jun 2024 15:40:58 -0400 Subject: [PATCH] Try to fix update icons --- app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index b51965b..3c8ed9c 100644 --- a/app.js +++ b/app.js @@ -68,6 +68,7 @@ async function initialize() { peerCount++; updatePeerCount(); + // Send the current user's icon to the new peer const iconBuffer = await drive.get(`/icons/${userName}.png`); if (iconBuffer) { const iconMessage = JSON.stringify({ @@ -280,14 +281,15 @@ function truncateHash(hash) { } async function updateIcon(username, avatarBuffer) { + // Update the icon in the local HTML if necessary + // This can be adjusted as per your needs const userIcon = document.querySelector(`img[src*="${username}.png"]`); if (userIcon) { - const servePort = 1337; - const avatarUrl = `http://localhost:${servePort}/icons/${username}.png`; - userIcon.src = avatarUrl; + userIcon.src = URL.createObjectURL(new Blob([avatarBuffer])); } } + function clearMessages() { const messagesContainer = document.querySelector('#messages'); while (messagesContainer.firstChild) {