fix(ui): robust avatars — no-referrer + graceful fallback

Channel/account avatars come from Google's image CDNs (yt3.ggpht.com,
lh3.googleusercontent.com). On a feed page dozens load at once; the CDN
rate-limits the referrer-bearing burst (429), so a random subset rendered the
browser's broken-image icon (the URLs themselves are valid — verified 200).

Add a shared <Avatar> that sets referrerPolicy="no-referrer" (which the CDNs
serve without throttling) and falls back to a neutral initial placeholder on
error instead of the broken-image icon. Use it for video-card, player, channel
manager, header and settings avatars.
This commit is contained in:
npeter83 2026-06-12 18:01:43 +02:00
parent c5124841b7
commit 93bd805089
6 changed files with 77 additions and 29 deletions

View file

@ -2,6 +2,7 @@ import { useEffect, useRef, useState, type ReactNode } from "react";
import { createPortal } from "react-dom";
import { useQuery } from "@tanstack/react-query";
import { ArrowLeft, Check, CheckCheck, X } from "lucide-react";
import Avatar from "./Avatar";
import { api, type Video } from "../lib/api";
import { formatDuration, formatViews, relativeTime } from "../lib/format";
@ -454,10 +455,10 @@ export default function PlayerModal({
When navigated to a linked video we only have its author (from the player),
so we show that as plain text and hide feed-video-specific bits. */}
<div className="flex items-center gap-3 mt-3">
{!navigated && video.channel_thumbnail && (
<img
{!navigated && (
<Avatar
src={video.channel_thumbnail}
alt=""
fallback={video.channel_title ?? ""}
className="w-9 h-9 rounded-full shrink-0"
/>
)}