Skip to content

Commit

Permalink
Set avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
n9lsjr committed Dec 20, 2024
1 parent 4e271fc commit 9f950a3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,23 @@
$rooms.roomArray = await window.api.getRooms()
$rooms.banned = banned
$files = fileList
$rooms.avatars = avatars
setAvatars(avatars)
if (avatar.length) setCustomAvatar(avatar)
loginSuccess()
})
const setAvatars = (avatars) => {
const update = []
for (const a of avatars) {
console.log("avarat", a)
const blob = new Blob( [ a.avatar ]);
const imageUrl = URL.createObjectURL( blob );
const set = {avatar: imageUrl, address: a.address}
update.push(set)
}
$rooms.avatars = update
}
const setCustomAvatar = async (buf) => {
console.log("Set avatar", buf)
const blob = new Blob( [ buf ]);
Expand Down

0 comments on commit 9f950a3

Please sign in to comment.