mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
Use own favicon fetcher
This commit is contained in:
parent
4688986901
commit
88b52d23cd
4 changed files with 120 additions and 57 deletions
|
|
@ -2,22 +2,7 @@ import { ok, unauthorized, methodNotAllowed, getRandomChars } from 'next-basics'
|
|||
import { updateWebsite, createWebsite, getWebsiteById } from 'queries';
|
||||
import { useAuth } from 'lib/middleware';
|
||||
import { uuid } from 'lib/crypto';
|
||||
import favecon from 'favecon';
|
||||
|
||||
const getFavicon = async domain => {
|
||||
try {
|
||||
const icons = await favecon.getIcons(`https://${domain}`);
|
||||
|
||||
if (icons.length && icons.length > 0) {
|
||||
return icons[0]?.href;
|
||||
}
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Could not fetch favicon for domain ${domain}`, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
import getFavicon from 'lib/favicon';
|
||||
|
||||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue