From 17f7f1fb043c6bde48d12c1a52b36254512ffd81 Mon Sep 17 00:00:00 2001 From: aceberg <1502200+aceberg@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:07:27 +0700 Subject: [PATCH] Version on config page --- .version | 2 +- internal/models/models.go | 9 +++++---- internal/web/config.go | 5 +++++ internal/web/templates/config.html | 1 + internal/web/templates/footer.html | 5 ----- internal/web/templates/version | 1 + 6 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 internal/web/templates/version diff --git a/.version b/.version index 48eaba0..bb7777a 120000 --- a/.version +++ b/.version @@ -1 +1 @@ -internal/web/templates/footer.html \ No newline at end of file +internal/web/templates/version \ No newline at end of file diff --git a/internal/models/models.go b/internal/models/models.go index 64f6e19..88048b5 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -26,8 +26,9 @@ type Conf struct { // GuiData - all data sent to html page type GuiData struct { - Config Conf - Hosts []Host - Icon string - Themes []string + Config Conf + Hosts []Host + Icon string + Themes []string + Version string } diff --git a/internal/web/config.go b/internal/web/config.go index 9eb487b..489a118 100644 --- a/internal/web/config.go +++ b/internal/web/config.go @@ -18,6 +18,11 @@ func configHandler(w http.ResponseWriter, r *http.Request) { guiData.Config = AppConfig guiData.Icon = Icon + file, err := TemplHTML.ReadFile(TemplPath + "version") + check.IfError(err) + + guiData.Version = string(file) + guiData.Themes = []string{"cerulean", "cosmo", "cyborg", "darkly", "flatly", "journal", "litera", "lumen", "lux", "materia", "minty", "morph", "pulse", "quartz", "sandstone", "simplex", "sketchy", "slate", "solar", "spacelab", "superhero", "united", "vapor", "yeti", "zephyr"} execTemplate(w, "config", guiData) diff --git a/internal/web/templates/config.html b/internal/web/templates/config.html index e032c01..8da14e4 100644 --- a/internal/web/templates/config.html +++ b/internal/web/templates/config.html @@ -57,6 +57,7 @@
+

{{ .Version }}