forked from snxraven/LinkUp-P2P-Chat
Compare commits
No commits in common. "9f514c31f96cc3b4a855ad5c905edab560e32f7e" and "83f75a4fc8e70a416b7af1232b5542fda5ff697a" have entirely different histories.
9f514c31f9
...
83f75a4fc8
8
app.js
8
app.js
@ -68,7 +68,6 @@ async function initialize() {
|
|||||||
peerCount++;
|
peerCount++;
|
||||||
updatePeerCount();
|
updatePeerCount();
|
||||||
|
|
||||||
// Send the current user's icon to the new peer
|
|
||||||
const iconBuffer = await drive.get(`/icons/${userName}.png`);
|
const iconBuffer = await drive.get(`/icons/${userName}.png`);
|
||||||
if (iconBuffer) {
|
if (iconBuffer) {
|
||||||
const iconMessage = JSON.stringify({
|
const iconMessage = JSON.stringify({
|
||||||
@ -281,15 +280,14 @@ function truncateHash(hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateIcon(username, avatarBuffer) {
|
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"]`);
|
const userIcon = document.querySelector(`img[src*="${username}.png"]`);
|
||||||
if (userIcon) {
|
if (userIcon) {
|
||||||
userIcon.src = URL.createObjectURL(new Blob([avatarBuffer]));
|
const servePort = 1337;
|
||||||
|
const avatarUrl = `http://localhost:${servePort}/icons/${username}.png`;
|
||||||
|
userIcon.src = avatarUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function clearMessages() {
|
function clearMessages() {
|
||||||
const messagesContainer = document.querySelector('#messages');
|
const messagesContainer = document.querySelector('#messages');
|
||||||
while (messagesContainer.firstChild) {
|
while (messagesContainer.firstChild) {
|
||||||
|
Loading…
Reference in New Issue
Block a user