diff --git a/cmd/WatchYourLAN/main.go b/cmd/WatchYourLAN/main.go index 9298114..df6d186 100644 --- a/cmd/WatchYourLAN/main.go +++ b/cmd/WatchYourLAN/main.go @@ -8,12 +8,15 @@ import ( ) const configPath = "/data/config" +const bootPath = "https://cdn.jsdelivr.net/npm/bootswatch@5.2.3/dist" +// const bootPath = "file://data/node_modules/bootswatch/dist" func main() { confPtr := flag.String("c", configPath, "Path to config file") + bootPtr := flag.String("b", bootPath, "Path to Bootswatch") flag.Parse() check.Path(*confPtr) - web.Gui(*confPtr) // Start web GUI + web.Gui(*confPtr, *bootPtr) // Start web GUI } diff --git a/internal/conf/get-config.go b/internal/conf/get-config.go index bd4ac44..89e1ae9 100644 --- a/internal/conf/get-config.go +++ b/internal/conf/get-config.go @@ -44,6 +44,7 @@ func Write(path string, config models.Conf) { viper.SetConfigType("env") viper.Set("IFACE", config.Iface) + viper.Set("DBPATH", config.DbPath) viper.Set("GUIIP", config.GuiIP) viper.Set("GUIPORT", config.GuiPort) viper.Set("TIMEOUT", config.Timeout) diff --git a/internal/models/models.go b/internal/models/models.go index 88048b5..4ff825f 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -22,13 +22,14 @@ type Conf struct { ShoutURL string Theme string IgnoreIP string + BootPath string + Icon string } // GuiData - all data sent to html page type GuiData struct { Config Conf Hosts []Host - Icon string Themes []string Version string } diff --git a/internal/web/config.go b/internal/web/config.go index 489a118..20a43a1 100644 --- a/internal/web/config.go +++ b/internal/web/config.go @@ -16,7 +16,6 @@ func configHandler(w http.ResponseWriter, r *http.Request) { var guiData models.GuiData guiData.Config = AppConfig - guiData.Icon = Icon file, err := TemplHTML.ReadFile(TemplPath + "version") check.IfError(err) diff --git a/internal/web/host.go b/internal/web/host.go index e0d656a..65c3474 100644 --- a/internal/web/host.go +++ b/internal/web/host.go @@ -29,7 +29,6 @@ func hostHandler(w http.ResponseWriter, r *http.Request) { var host models.Host guiData.Config = AppConfig - guiData.Icon = Icon idStr := r.URL.Query().Get("id") diff --git a/internal/web/index-home.go b/internal/web/index-home.go index 6b792a1..1a6d798 100644 --- a/internal/web/index-home.go +++ b/internal/web/index-home.go @@ -12,7 +12,6 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { guiData.Config = AppConfig guiData.Hosts = AllHosts - guiData.Icon = Icon execTemplate(w, "index", guiData) } diff --git a/internal/web/line.go b/internal/web/line.go index fe2c469..2cce657 100644 --- a/internal/web/line.go +++ b/internal/web/line.go @@ -11,7 +11,6 @@ func lineHandler(w http.ResponseWriter, r *http.Request) { guiData.Config = AppConfig guiData.Hosts = []models.Host{} - guiData.Icon = Icon state := r.URL.Query().Get("state") diff --git a/internal/web/port.go b/internal/web/port.go index edc3fc8..9ffbd97 100644 --- a/internal/web/port.go +++ b/internal/web/port.go @@ -13,7 +13,6 @@ func portHandler(w http.ResponseWriter, r *http.Request) { var guiData models.GuiData guiData.Config = AppConfig - guiData.Icon = Icon ip := r.FormValue("ip") beginStr := r.FormValue("begin") diff --git a/internal/web/templates/header.html b/internal/web/templates/header.html index 07fadb4..c4dbdce 100644 --- a/internal/web/templates/header.html +++ b/internal/web/templates/header.html @@ -4,9 +4,9 @@ Watch Your LAN - + - + @@ -34,8 +34,14 @@ - diff --git a/internal/web/webgui.go b/internal/web/webgui.go index 283efc1..0e382d8 100644 --- a/internal/web/webgui.go +++ b/internal/web/webgui.go @@ -11,10 +11,12 @@ import ( ) // Gui - start web GUI -func Gui(configPath string) { +func Gui(configPath, bootPath string) { ConfigPath = configPath AppConfig = conf.Get(ConfigPath) + AppConfig.BootPath = bootPath + AppConfig.Icon = Icon address := AppConfig.GuiIP + ":" + AppConfig.GuiPort