From d6ee3a059f202ec69b661cbf41e6e9e0ad2fae03 Mon Sep 17 00:00:00 2001 From: aceberg <1502200+aceberg@users.noreply.github.com> Date: Wed, 28 Aug 2024 23:30:25 +0700 Subject: [PATCH] Trim history --- internal/web/config.go | 12 ++++- internal/web/routines-upd.go | 2 +- internal/web/templates/config.html | 83 ++++++++++++++++++------------ internal/web/trim-history.go | 42 +++++++++++++++ internal/web/webgui.go | 8 +-- 5 files changed, 109 insertions(+), 38 deletions(-) create mode 100644 internal/web/trim-history.go diff --git a/internal/web/config.go b/internal/web/config.go index d24a85e..a539f0f 100644 --- a/internal/web/config.go +++ b/internal/web/config.go @@ -35,10 +35,20 @@ func saveConfigHandler(c *gin.Context) { appConfig.Theme = c.PostForm("theme") appConfig.Color = c.PostForm("color") appConfig.NodePath = c.PostForm("node") + appConfig.ShoutURL = c.PostForm("shout") + + conf.Write(appConfig) + + slog.Info("Writing new config to " + appConfig.ConfPath) + + c.Redirect(http.StatusFound, "/config") +} + +func saveSettingsHandler(c *gin.Context) { + appConfig.LogLevel = c.PostForm("log") appConfig.ArpArgs = c.PostForm("arpargs") appConfig.Ifaces = c.PostForm("ifaces") - appConfig.ShoutURL = c.PostForm("shout") appConfig.UseDB = c.PostForm("usedb") appConfig.PGConnect = c.PostForm("pgconnect") diff --git a/internal/web/routines-upd.go b/internal/web/routines-upd.go index 7a1c7d5..06eaed7 100644 --- a/internal/web/routines-upd.go +++ b/internal/web/routines-upd.go @@ -7,7 +7,7 @@ import ( ) func updateRoutines() { - slog.Debug("Restarting go routines") + slog.Debug("Restarting scan routine") close(quitScan) diff --git a/internal/web/templates/config.html b/internal/web/templates/config.html index 003468d..1355e6f 100644 --- a/internal/web/templates/config.html +++ b/internal/web/templates/config.html @@ -5,7 +5,7 @@