Try to fix update icons

This commit is contained in:
Raven Scott 2024-06-08 15:48:56 -04:00
parent 748f4664b3
commit 8c54e4ca77

5
app.js
View File

@ -121,7 +121,7 @@ function registerUser(e) {
reader.onload = (event) => {
const buffer = new Uint8Array(event.target.result);
drive.put(`/icons/${regUsername}.png`, buffer);
userAvatar = URL.createObjectURL(new Blob([buffer]));
userAvatar = `http://localhost:1337/icons/${regUsername}.png`; // Set the correct URL
registeredUsers[regUsername] = userAvatar;
localStorage.setItem('registeredUsers', JSON.stringify(registeredUsers));
continueRegistration(regUsername);
@ -285,11 +285,10 @@ async function updateIcon(username, avatarBuffer) {
// This can be adjusted as per your needs
const userIcon = document.querySelector(`img[src*="${username}.png"]`);
if (userIcon) {
userIcon.src = URL.createObjectURL(new Blob([avatarBuffer]));
userIcon.src = `http://localhost:1337/icons/${username}.png`; // Ensure the URL is correct
}
}
function clearMessages() {
const messagesContainer = document.querySelector('#messages');
while (messagesContainer.firstChild) {