Add selfh.st/icons support

This commit is contained in:
LinuxSBC 2025-01-08 21:44:53 -06:00
parent 459b483a8e
commit 12372f826e
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -72,6 +72,7 @@ export default {
else if (img.includes('mdi-')) imgType = 'mdi';
else if (img.includes('si-')) imgType = 'si';
else if (img.includes('hl-')) imgType = 'home-lab-icons';
else if (img.includes('sh-')) imgType = 'selfhst-icons';
else if (img.includes('favicon-')) imgType = 'custom-favicon';
else if (img === 'favicon') imgType = 'favicon';
else if (img === 'generative') imgType = 'generative';
@ -90,6 +91,7 @@ export default {
case 'mdi': return img; // Material design icons
case 'simple-icons': return this.getSimpleIcon(img);
case 'home-lab-icons': return this.getHomeLabIcon(img);
case 'selfhst-icons': return this.getSelfhstIcon(img); // selfh.st/icons
case 'svg': return img; // Local SVG icon
case 'emoji': return img; // Emoji/ unicode
default: return '';
@ -195,6 +197,10 @@ export default {
}
return icon.path;
},
getSelfhstIcon(img, cdn) {
const imageName = img.slice(3).toLocaleLowerCase();
return (cdn || iconCdns.sh).replace('{icon}', imageName);
},
/* Gets home-lab icon from GitHub */
getHomeLabIcon(img, cdn) {
const imageName = img.replace('hl-', '').toLocaleLowerCase();

View File

@ -210,6 +210,7 @@ module.exports = {
fa: 'https://kit.fontawesome.com',
mdi: 'https://cdn.jsdelivr.net/npm/@mdi/font@7.0.96/css/materialdesignicons.min.css',
si: 'https://unpkg.com/simple-icons@v7/icons',
sh: 'https://cdn.jsdelivr.net/gh/selfhst/icons@latest/webp/{icon}.webp',
generative: 'https://api.dicebear.com/7.x/identicon/svg?seed={icon}',
generativeFallback: 'https://evatar.io/{icon}',
localPath: './item-icons',