forked from snxraven/LinkUp-P2P-Chat
readd updateIcon
This commit is contained in:
parent
ed4625275d
commit
43e9890235
13
app.js
13
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user