Background color: light or dark

This commit is contained in:
aceberg 2023-06-04 23:01:49 +07:00
parent b3a891772e
commit 21f71fa567
8 changed files with 22 additions and 5 deletions

View file

@ -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

View file

@ -22,7 +22,7 @@ fmt:
go fmt ./...
lint:
# golangci-lint run
golangci-lint run
golint ./...
check: fmt lint

View file

@ -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)

View file

@ -21,6 +21,7 @@ type Conf struct {
Timeout int
ShoutURL string
Theme string
Color string
IgnoreIP string
LogLevel string
BootPath string

View file

@ -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")

View file

@ -41,6 +41,14 @@
{{ end }}
</select></td>
</tr>
<tr>
<td>Color mode</td>
<td><select name="color" class="form-select">
<option selected>{{ .Config.Color }}</option>
<option value="light">light</option>
<option value="dark">dark</option>
</select></td>
</tr>
<tr>
<td>Ignore IP</td>
<td>

View file

@ -1,5 +1,5 @@
{{ define "header"}}
<html>
<html lang="en" data-bs-theme="{{ .Config.Color }}">
<head>
<title>Watch Your LAN</title>
<meta charset="utf-8">
@ -7,9 +7,9 @@
<link href="data:image/x-icon;base64,{{ .Config.Icon }}" rel="icon" type="image/x-icon" />
{{ if eq .Config.BootPath "" }}
<!-- Bootstrap and theme -->
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.3/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.3.0/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
<!-- Font for icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
{{ else }}
<!-- Bootstrap and theme -->
<link href="/css/bootswatch/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">

View file

@ -1 +1 @@
VERSION=0.9.2
VERSION=0.9.3