settings: allow transparent backends that don't set all values

This commit is contained in:
WeebDataHoarder
2025-04-30 20:54:50 +02:00
parent 4ce6d9efa3
commit a9f03267b6
12 changed files with 95 additions and 53 deletions

26
utils/strings.go Normal file
View File

@@ -0,0 +1,26 @@
package utils
import (
"html/template"
"maps"
)
type Strings map[string]string
func (s Strings) set(v map[string]string) Strings {
maps.Copy(s, v)
return s
}
func (s Strings) Get(value string) template.HTML {
v, ok := (s)[value]
if !ok {
// fallback
return template.HTML("string:" + value)
}
return template.HTML(v)
}
func NewStrings[T ~map[string]string](v T) Strings {
return make(Strings).set(v)
}