Fix PreUp, PostUp, PreDown, and PostDown

* Escaping HTML in several places.
* Adds PreUp config when one didn't exist.
* Adds environment variable support for PreUp and PreDown.

closes #549
closes #655
closes #656

See also
--------

- https://github.com/samrocketman/addons-homeassistant/issues/9

Co-authored-by: Robert Willert <rwillert@users.noreply.github.com>
This commit is contained in:
Sam Gleske 2025-05-20 18:33:08 -04:00
parent 2fdafd34ca
commit 2084a81297
10 changed files with 55 additions and 22 deletions

View file

@ -112,8 +112,10 @@ func New(tmplDir fs.FS, extraData map[string]interface{}, secret [64]byte) *echo
}
// create template list
//"htmlescaper": template.htmlEscaper,
funcs := template.FuncMap{
"StringsJoin": strings.Join,
"attrescaper": util.EscapeHtmlCode,
}
templates := make(map[string]*template.Template)
templates["login.html"] = template.Must(template.New("login").Funcs(funcs).Parse(tmplLoginString))