feature: Easier loading of custom-webui icons with simplified paths (#567)
This commit is contained in:
parent
c19428f6b6
commit
765c698a9b
|
|
@ -1,5 +1,10 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
var emojis = map[string]string{
|
var emojis = map[string]string{
|
||||||
"poop": "💩",
|
"poop": "💩",
|
||||||
"smile": "😀",
|
"smile": "😀",
|
||||||
|
|
@ -27,5 +32,15 @@ func lookupHTMLIcon(keyToLookup string, defaultIcon string) string {
|
||||||
return emoji
|
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
|
return keyToLookup
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,10 @@ span.icon {
|
||||||
font-size: 3em;
|
font-size: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.icon img {
|
||||||
|
width: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.action-header {
|
.action-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue