chore: update favicon getter

This commit is contained in:
Steven
2023-09-29 21:34:23 +08:00
parent 8ef7d5f0d0
commit 6126701025
5 changed files with 13 additions and 68 deletions

View File

@ -3,3 +3,12 @@ import { isNull, isUndefined } from "lodash-es";
export const isNullorUndefined = (value: any) => {
return isNull(value) || isUndefined(value);
};
export const getFaviconWithGoogleS2 = (url: string) => {
try {
const urlObject = new URL(url);
return `https://www.google.com/s2/favicons?sz=128&domain=${urlObject.hostname}`;
} catch (error) {
return undefined;
}
};