feature: Easier loading of custom-webui icons with simplified paths (#567)

This commit is contained in:
James Read 2025-04-20 00:06:17 +01:00 committed by GitHub
parent c19428f6b6
commit 765c698a9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,10 @@
package config
import (
"fmt"
"strings"
)
var emojis = map[string]string{
"poop": "💩",
"smile": "😀",
@ -27,5 +32,15 @@ func lookupHTMLIcon(keyToLookup string, defaultIcon string) string {
return emoji
}
keyToLookup = expandShortPathToFullPath(keyToLookup)
return keyToLookup
}
func expandShortPathToFullPath(keyToLookup string) string {
if strings.Contains(keyToLookup, "/") && !strings.HasPrefix(keyToLookup, "<") {
return fmt.Sprintf("<img src = \"/custom-webui/%s\" />", keyToLookup)
}
return keyToLookup
}

View File

@ -219,6 +219,10 @@ span.icon {
font-size: 3em;
}
span.icon img {
width: 1em;
}
.action-header {
display: flex;
align-items: center;