diff --git a/js/index.js b/js/index.js index e1d1287..d5bf942 100644 --- a/js/index.js +++ b/js/index.js @@ -28,7 +28,7 @@ const defaultConfig = `{ "bookmarkOptions": { "alwaysOpenInNewTab": true, - "useFavicoKit": false + "useFaviconKit": false }, "steamGames": [ @@ -74,7 +74,7 @@ const baseConfig = `{ "bookmarkOptions": { "alwaysOpenInNewTab": true, - "useFavicoKit": false + "useFaviconKit": false }, "steamGames": [ diff --git a/js/render.js b/js/render.js index 0650fe4..479076b 100644 --- a/js/render.js +++ b/js/render.js @@ -49,11 +49,25 @@ function Bookmark({ label, url, baseUrl, logoUrl }) { let displayUrl = (baseUrl ?? url).replace('https://', '') + // Prep the URL for FaviconKit + let safeUrl = (logoUrl ?? baseUrl ?? url).replace('https://', ''); + safeUrl.replace('http://', ''); + + let logoSrc = + config.bookmarkOptions.useFaviconKit + ? + `https://api.faviconkit.com/${safeUrl}/16` + : + `http://www.google.com/s2/favicons?sz=192&domain_url=${logoUrl ?? baseUrl ?? url}` + + let target = config.bookmarkOptions.alwaysOpenInNewTab ? '_blank' : ''; + let rel = config.bookmarkOptions.alwaysOpenInNewTab ? 'noopener' : ''; + return html` - +
- +