Sync update: 2026-05-18 16:06:07
This commit is contained in:
@@ -59,9 +59,18 @@ function sendTo(ws, payload) {
|
||||
async function formatChat(chat) {
|
||||
let avatar = null;
|
||||
try {
|
||||
const contact = await chat.getContact();
|
||||
const pic = await contact.getProfilePicUrl();
|
||||
if (pic) avatar = pic;
|
||||
// Ultra-fast memory-based avatar fetch with strict 300ms fallback to prevent hangs
|
||||
avatar = await Promise.race([
|
||||
chat.client.pupPage.evaluate((chatId) => {
|
||||
try {
|
||||
const contact = window.Store.Contact.get(chatId);
|
||||
return contact && contact.profilePicThumb ? (contact.profilePicThumb.imgFull || contact.profilePicThumb.img) : null;
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}, chat.id._serialized),
|
||||
new Promise(resolve => setTimeout(() => resolve(null), 300))
|
||||
]);
|
||||
} catch (_) {}
|
||||
|
||||
// Last Message formatting
|
||||
|
||||
Reference in New Issue
Block a user