Strip API subdomains in ExternalFavicon to reduce reliance on Shakespeare's favicon service

This commit is contained in:
Alex Gleason committed 2026-01-03 19:09:52 -06:00
1 parent 1915e6044f
commit d2a84fa00d
1 file changed
+6 -1
+6 -1
View File
@@ -30,8 +30,13 @@ export function ExternalFavicon({
const faviconSrc = useMemo(() => {
if (!url) return;
try {
const parsedUrl = new URL(url);
// Strip `ai.` and `api.` subdomains for a better chance at finding a favicon
parsedUrl.hostname = parsedUrl.hostname.replace(/^(ai\.|api\.)/, '');
// Normalize the URL to ensure it has a protocol
return faviconUrl(config.faviconUrl, url);
return faviconUrl(config.faviconUrl, parsedUrl);
} catch {
return;
}