fix: responsive

This commit is contained in:
Sonny
2024-05-29 18:10:17 +02:00
committed by Sonny
parent f2478bcf56
commit e9ccefd938
16 changed files with 183 additions and 52 deletions

View File

@@ -54,13 +54,21 @@ export default class FaviconsController {
throw new FaviconNotFoundException(`No favicon path found in ${url}`);
}
if (faviconPath.startsWith('http')) {
try {
return await this.fetchFavicon(faviconPath);
} catch {
logger.debug(`Unable to retrieve favicon from ${faviconPath}`);
}
}
return this.fetchFaviconFromPath(url, faviconPath);
}
private async fetchFavicon(url: string): Promise<Favicon> {
const response = await this.fetchWithUserAgent(url);
if (!response.ok) {
throw new FaviconNotFoundException(`Request to ${url} failed`);
throw new FaviconNotFoundException(`Request to favicon ${url} failed`);
}
const blob = await response.blob();