diff --git a/cmd/config.go b/cmd/config.go index f4300482c..0b0e3891c 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -20,7 +20,6 @@ type config struct { Mqtt provider.MqttConfig Influx server.InfluxConfig HEMS string - Menu []server.MenuConfig Messaging messagingConfig Meters []qualifiedConfig Chargers []qualifiedConfig diff --git a/cmd/root.go b/cmd/root.go index 07b2c2b7c..78041cddf 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -154,7 +154,7 @@ func run(cmd *cobra.Command, args []string) { // create webserver socketHub := server.NewSocketHub() - httpd := server.NewHTTPd(uri, conf.Menu, site, socketHub, cache) + httpd := server.NewHTTPd(uri, site, socketHub, cache) // start HEMS server if conf.HEMS != "" { diff --git a/server/http.go b/server/http.go index 045475cc3..69dd7edae 100644 --- a/server/http.go +++ b/server/http.go @@ -16,15 +16,6 @@ import ( "github.com/gorilla/mux" ) -// MenuConfig is used to inject the menu configuration into the UI -type MenuConfig struct { - Title string - Subtitle string - Img string - Iframe string - Link string -} - type chargeModeJSON struct { Mode api.ChargeMode `json:"mode"` } @@ -68,7 +59,7 @@ func routeLogger(inner http.Handler) http.HandlerFunc { } } -func indexHandler(links []MenuConfig, site site, useLocal bool) http.HandlerFunc { +func indexHandler(site site, useLocal bool) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=UTF-8") @@ -85,7 +76,6 @@ func indexHandler(links []MenuConfig, site site, useLocal bool) http.HandlerFunc if err := t.Execute(w, map[string]interface{}{ "Version": Version, "Commit": Commit, - "Links": links, "Configured": len(site.LoadPoints()), "Tag": time.Now().Unix(), }); err != nil { @@ -239,7 +229,7 @@ type HTTPd struct { } // NewHTTPd creates HTTP server with configured routes for loadpoint -func NewHTTPd(url string, links []MenuConfig, site site, hub *SocketHub, cache *util.Cache) *HTTPd { +func NewHTTPd(url string, site site, hub *SocketHub, cache *util.Cache) *HTTPd { var routes = map[string]route{ "health": {[]string{"GET"}, "/health", HealthHandler()}, "config": {[]string{"GET"}, "/config", ConfigHandler(site)}, @@ -260,7 +250,7 @@ func NewHTTPd(url string, links []MenuConfig, site site, hub *SocketHub, cache * static := router.PathPrefix("/").Subrouter() static.Use(handlers.CompressHandler) - static.HandleFunc("/", indexHandler(links, site, useLocalAssets)) + static.HandleFunc("/", indexHandler(site, useLocalAssets)) for _, folder := range []string{"js", "css", "webfonts", "ico"} { prefix := fmt.Sprintf("/%s/", folder) static.PathPrefix(prefix).Handler(http.StripPrefix(prefix, http.FileServer(Dir(useLocalAssets, prefix))))