refactor: Use CORS Proxy for favicons calls
This commit is contained in:
parent
46c5bca942
commit
e41f70bb47
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue