lockserver/frontend/frontend.go

40 lines
596 B
Go
Raw Normal View History

package frontend
import (
"embed"
2024-11-24 01:01:50 +00:00
"fmt"
"html/template"
"io/fs"
2024-11-24 01:01:50 +00:00
"git.janky.solutions/finn/lockserver/config"
)
var (
//go:embed static
static embed.FS
Static fs.FS
//go:embed *.html
templatesFS embed.FS
Templates *template.Template
funcs = template.FuncMap{
2024-11-24 01:01:50 +00:00
"version": func() string { return fmt.Sprintf("better-zwave-locks %s", config.Version) },
}
)
func init() {
t := template.New("").Funcs(funcs)
var err error
Templates, err = t.ParseFS(templatesFS, "*")
if err != nil {
panic(err)
}
Static, err = fs.Sub(static, "static")
if err != nil {
panic(err)
}
}