fix(avatar): sidebar não usa mais URL crua do WhatsApp (403)
O avatar da instância na ThinSidebar caía no fallback activeInstance.avatar/profilePictureUrl — URL do CDN pps.whatsapp.net que expira e responde 403 (hotlink) no navegador. Agora usa só o proxy do backend (/proxy-avatar → /api/inbox/avatar, que baixa server-side); sem proxy resolvível, mostra o ícone em vez da URL crua. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -60,21 +60,29 @@ export default function ThinSidebar({ activeTab, setActiveTab, activeInstance }:
|
||||
|
||||
<div className="relative mt-2 p-1 cursor-pointer">
|
||||
<div className="w-8 h-8 rounded-full overflow-hidden bg-gray-200 border border-gray-300">
|
||||
{activeInstance?.instance ? (
|
||||
<img
|
||||
src={getAvatarProxyUrl({
|
||||
{(() => {
|
||||
// Avatar da instância SEMPRE via proxy do backend. Nunca usar a URL
|
||||
// crua do CDN do WhatsApp (pps.whatsapp.net) como fallback: ela expira
|
||||
// e o navegador recebe 403 (hotlink). Sem proxy resolvível → ícone.
|
||||
const avatarSrc = activeInstance?.instance
|
||||
? getAvatarProxyUrl({
|
||||
instance_name: activeInstance.instance,
|
||||
remote_jid: activeInstance.phone ? `${activeInstance.phone}@s.whatsapp.net` : null,
|
||||
}) || activeInstance.avatar || activeInstance.profilePictureUrl || ''}
|
||||
alt="Status"
|
||||
className="w-full h-full object-cover"
|
||||
onError={(e) => { e.currentTarget.style.display = 'none'; }}
|
||||
/>
|
||||
) : (
|
||||
<div className="w-full h-full flex items-center justify-center bg-[#dfe5e7] text-[#54656f]">
|
||||
<Users className="w-5 h-5" />
|
||||
</div>
|
||||
)}
|
||||
})
|
||||
: null;
|
||||
return avatarSrc ? (
|
||||
<img
|
||||
src={avatarSrc}
|
||||
alt="Status"
|
||||
className="w-full h-full object-cover"
|
||||
onError={(e) => { e.currentTarget.style.display = 'none'; }}
|
||||
/>
|
||||
) : (
|
||||
<div className="w-full h-full flex items-center justify-center bg-[#dfe5e7] text-[#54656f]">
|
||||
<Users className="w-5 h-5" />
|
||||
</div>
|
||||
);
|
||||
})()}
|
||||
</div>
|
||||
{/* Status indicator badge */}
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user