Remove remaining referenced to menu config

This commit is contained in:
andig 2020-10-06 08:40:24 +02:00
parent f8e8fd884b
commit 6c28501650
3 changed files with 4 additions and 15 deletions

View file

@ -20,7 +20,6 @@ type config struct {
Mqtt provider.MqttConfig
Influx server.InfluxConfig
HEMS string
Menu []server.MenuConfig
Messaging messagingConfig
Meters []qualifiedConfig
Chargers []qualifiedConfig

View file

@ -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 != "" {

View file

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