You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
579 B

3 years ago
3 years ago
  1. package master_ui
  2. import (
  3. _ "embed"
  4. "html/template"
  5. "strings"
  6. )
  7. //go:embed master.html
  8. var masterHtml string
  9. //go:embed masterNewRaft.html
  10. var masterNewRaftHtml string
  11. var templateFunctions = template.FuncMap{
  12. "url": func(input string) string {
  13. if !strings.HasPrefix(input, "http://") && !strings.HasPrefix(input, "https://") {
  14. return "http://" + input
  15. }
  16. return input
  17. },
  18. }
  19. var StatusTpl = template.Must(template.New("status").Funcs(templateFunctions).Parse(masterHtml))
  20. var StatusNewRaftTpl = template.Must(template.New("status").Parse(masterNewRaftHtml))