From 21f71fa567aeb64b9149d06dab877bf7edb71256 Mon Sep 17 00:00:00 2001 From: aceberg <1502200+aceberg@users.noreply.github.com> Date: Sun, 4 Jun 2023 23:01:49 +0700 Subject: [PATCH] Background color: light or dark --- CHANGELOG.md | 4 ++++ Makefile | 2 +- internal/conf/get-config.go | 3 +++ internal/models/models.go | 1 + internal/web/config.go | 1 + internal/web/templates/config.html | 8 ++++++++ internal/web/templates/header.html | 6 +++--- internal/web/templates/version | 2 +- 8 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 011b3cc..4f15d1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [v0.9.3] - 2023-06-04 +### Added +- Background color: light or dark + ## [v0.9.2] - 2023-05-05 ### Added - Choose log level in config diff --git a/Makefile b/Makefile index 06dd5ee..1c9efd1 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ fmt: go fmt ./... lint: - # golangci-lint run + golangci-lint run golint ./... check: fmt lint diff --git a/internal/conf/get-config.go b/internal/conf/get-config.go index ddfc049..78cf886 100644 --- a/internal/conf/get-config.go +++ b/internal/conf/get-config.go @@ -16,6 +16,7 @@ func Get(path string) (config models.Conf) { viper.SetDefault("TIMEOUT", "60") viper.SetDefault("SHOUTRRR_URL", "") viper.SetDefault("THEME", "solar") + viper.SetDefault("COLOR", "light") viper.SetDefault("IGNOREIP", "no") viper.SetDefault("LOGLEVEL", "verbose") @@ -33,6 +34,7 @@ func Get(path string) (config models.Conf) { config.Timeout = viper.GetInt("TIMEOUT") config.ShoutURL = viper.Get("SHOUTRRR_URL").(string) config.Theme = viper.Get("THEME").(string) + config.Color = viper.Get("COLOR").(string) config.IgnoreIP = viper.Get("IGNOREIP").(string) config.LogLevel = viper.Get("LOGLEVEL").(string) @@ -52,6 +54,7 @@ func Write(path string, config models.Conf) { viper.Set("TIMEOUT", config.Timeout) viper.Set("SHOUTRRR_URL", config.ShoutURL) viper.Set("THEME", config.Theme) + viper.Set("COLOR", config.Color) viper.Set("IGNOREIP", config.IgnoreIP) viper.Set("LOGLEVEL", config.LogLevel) diff --git a/internal/models/models.go b/internal/models/models.go index 0cea6dc..1a2c485 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -21,6 +21,7 @@ type Conf struct { Timeout int ShoutURL string Theme string + Color string IgnoreIP string LogLevel string BootPath string diff --git a/internal/web/config.go b/internal/web/config.go index 1f58a7d..9138d76 100644 --- a/internal/web/config.go +++ b/internal/web/config.go @@ -54,6 +54,7 @@ func saveConfigHandler(w http.ResponseWriter, r *http.Request) { AppConfig.GuiPort = r.FormValue("port") AppConfig.ShoutURL = r.FormValue("shout") AppConfig.Theme = r.FormValue("theme") + AppConfig.Color = r.FormValue("color") AppConfig.IgnoreIP = r.FormValue("ignoreip") AppConfig.LogLevel = r.FormValue("loglevel") diff --git a/internal/web/templates/config.html b/internal/web/templates/config.html index 6ad818a..ed52492 100644 --- a/internal/web/templates/config.html +++ b/internal/web/templates/config.html @@ -41,6 +41,14 @@ {{ end }} + + Color mode + + Ignore IP diff --git a/internal/web/templates/header.html b/internal/web/templates/header.html index fed72c6..faa58f3 100644 --- a/internal/web/templates/header.html +++ b/internal/web/templates/header.html @@ -1,5 +1,5 @@ {{ define "header"}} - + Watch Your LAN @@ -7,9 +7,9 @@ {{ if eq .Config.BootPath "" }} - + - + {{ else }} diff --git a/internal/web/templates/version b/internal/web/templates/version index 9bc5d8f..e7f698c 100644 --- a/internal/web/templates/version +++ b/internal/web/templates/version @@ -1 +1 @@ -VERSION=0.9.2 \ No newline at end of file +VERSION=0.9.3 \ No newline at end of file