refactor: Use CORS Proxy for favicons calls

This commit is contained in:
Aleksander Grygier 2026-01-29 16:30:10 +01:00
parent 46c5bca942
commit e41f70bb47
2 changed files with 5 additions and 2 deletions

View File

@ -1013,7 +1013,7 @@ server_http_proxy::server_http_proxy(
// setup Client
cli->set_follow_location(true);
cli->set_connection_timeout(0, 200000); // 200 milliseconds
cli->set_connection_timeout(5, 0); // 5 seconds
cli->set_write_timeout(timeout_read, 0); // reversed for cli (client) vs srv (server)
cli->set_read_timeout(timeout_write, 0);
this->status = 500; // to be overwritten upon response

View File

@ -2,6 +2,8 @@
* Favicon utility functions for extracting favicons from URLs.
*/
import { getProxiedUrlString } from './cors-proxy';
/**
* Gets a favicon URL for a given URL using Google's favicon service.
* Returns null if the URL is invalid.
@ -15,7 +17,8 @@ export function getFaviconUrl(urlString: string): string | null {
const hostnameParts = url.hostname.split('.');
const rootDomain = hostnameParts.length >= 2 ? hostnameParts.slice(-2).join('.') : url.hostname;
return `https://www.google.com/s2/favicons?domain=${rootDomain}&sz=32`;
const googleFaviconUrl = `https://www.google.com/s2/favicons?domain=${rootDomain}&sz=32`;
return getProxiedUrlString(googleFaviconUrl);
} catch {
return null;
}