mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-25 22:34:24 +00:00
feat: get url favicon from google s2
This commit is contained in:
@@ -71,7 +71,3 @@ export function patchShortcut(shortcutPatch: ShortcutPatch) {
|
||||
export function deleteShortcutById(shortcutId: ShortcutId) {
|
||||
return axios.delete(`/api/v1/shortcut/${shortcutId}`);
|
||||
}
|
||||
|
||||
export function getUrlFavicon(url: string) {
|
||||
return axios.get<string>(`/api/v1/url/favicon?url=${url}`);
|
||||
}
|
||||
|
@@ -13,3 +13,12 @@ export const absolutifyLink = (rel: string): string => {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user