feat(web): use favicon provider

This commit is contained in:
Steven
2024-04-07 20:28:21 +08:00
parent 8649e562dc
commit 5264dc9d8a
6 changed files with 53 additions and 55 deletions

View File

@@ -1,9 +1,3 @@
import { isNull, isUndefined } from "lodash-es";
export const isNullorUndefined = (value: any) => {
return isNull(value) || isUndefined(value);
};
export const absolutifyLink = (rel: string): string => {
const anchor = document.createElement("a");
anchor.setAttribute("href", rel);
@@ -15,19 +9,6 @@ export const isURL = (str: string): boolean => {
return urlRegex.test(str);
};
export const releaseGuard = () => {
return import.meta.env.MODE === "development";
};
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;
}
};
export const generateRandomString = () => {
const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
let randomString = "";