diff --git a/frontend/index.html b/frontend/index.html index 054157d..b043d66 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -41,9 +41,7 @@ document.addEventListener('DOMContentLoaded', () => window.refreshTheme()) // Template variable from Golang process - {{- range $key, $value := .Vars }} - const {{ $key }} = "{{ $value }}" - {{- end }} + const version = "{{ .Version }}"
diff --git a/main.go b/main.go index f192765..c4454f1 100644 --- a/main.go +++ b/main.go @@ -120,12 +120,10 @@ func handleIndex(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Security-Policy", cspHeader) w.Header().Set("X-Content-Type-Options", "nosniff") - if err = tpl.Execute(w, struct { - Vars map[string]string + if err := indexTpl.Execute(w, struct { + Version string }{ - Vars: map[string]string{ - "version": version, - }, + Version: version, }); err != nil { http.Error(w, errors.Wrap(err, "executing template").Error(), http.StatusInternalServerError) return