feat: show favicons for external chat links
Adds DuckDuckGo favicon lookup for external URLs Shows favicons in markdown and fetch tool link rows Hides missing icons automatically
This commit is contained in:
@@ -28,6 +28,15 @@ export const isExternalHttpUrl = (url: string): boolean => {
|
||||
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
||||
};
|
||||
|
||||
export const getExternalFaviconUrl = (url: string): string | null => {
|
||||
const parsed = parseUrlSafely(url.trim());
|
||||
if (!parsed || (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return `https://icons.duckduckgo.com/ip3/${parsed.hostname.toLowerCase()}.ico`;
|
||||
};
|
||||
|
||||
const LOOPBACK_HOSTNAMES = new Set(['localhost', '127.0.0.1', '0.0.0.0', '::1']);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user