From 43e9890235383679d29f86b76139476f35a3d25f Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Sun, 7 Jul 2024 21:49:13 -0400 Subject: [PATCH] readd updateIcon --- app.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app.js b/app.js index a5974f5..954bc6b 100644 --- a/app.js +++ b/app.js @@ -1129,6 +1129,19 @@ function addMessage(name, message, avatar, topic) { } } +async function updateIcon(username, avatarBuffer) { + const userIcon = document.querySelector(`img[src*="${username}.png"]`); + if (userIcon) { + const avatarBlob = new Blob([avatarBuffer], { type: 'image/png' }); + const avatarUrl = URL.createObjectURL(avatarBlob); + userIcon.src = updatePortInUrl(avatarUrl); + + config.userAvatar = avatarUrl; + writeConfigToFile("./config.json"); + } +} + + function clearMessages() { const messagesContainer = document.querySelector('#messages'); while (messagesContainer.firstChild) {