Add support for selfhst icons

This commit is contained in:
Svilen Markov 2024-12-04 08:11:18 +00:00
parent 24f9f20eb7
commit f7062115bc

View File

@ -193,8 +193,9 @@ func newCustomIconField(value string) customIconField {
case "si":
field.URL = "https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/" + icon + ".svg"
field.IsFlatIcon = true
case "di":
case "di", "sh":
// syntax: di:<icon_name>[.svg|.png]
// syntax: sh:<icon_name>[.svg|.png]
// if the icon name is specified without extension, it is assumed to be wanting the SVG icon
// otherwise, specify the extension of either .svg or .png to use either of the CDN offerings
// any other extension will be interpreted as .svg
@ -208,7 +209,11 @@ func newCustomIconField(value string) customIconField {
ext = "svg"
}
field.URL = "https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/" + ext + "/" + basename + "." + ext
if prefix == "di" {
field.URL = "https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/" + ext + "/" + basename + "." + ext
} else {
field.URL = "https://cdn.jsdelivr.net/gh/selfhst/icons@main/" + ext + "/" + basename + "." + ext
}
default:
field.URL = value
}