UI: persist experimental flag (BC) (#27074)
This commit is contained in:
parent
3f1df220b5
commit
4c5935b60d
52 changed files with 137 additions and 112 deletions
|
|
@ -120,7 +120,7 @@ func (s *HTTPd) Router() *mux.Router {
|
|||
}
|
||||
|
||||
// RegisterSiteHandlers connects the http handlers to the site
|
||||
func (s *HTTPd) RegisterSiteHandlers(site site.API, valueChan chan<- util.Param) {
|
||||
func (s *HTTPd) RegisterSiteHandlers(site site.API) {
|
||||
router := s.Server.Handler.(*mux.Router)
|
||||
|
||||
// api
|
||||
|
|
@ -293,6 +293,7 @@ func (s *HTTPd) RegisterSystemHandler(site *core.Site, pub publisher, cache *uti
|
|||
"interval": {"POST", "/interval/{value:[0-9.]+}", settingsSetDurationHandler(keys.Interval, pub)},
|
||||
"updatesponsortoken": {"POST", "/sponsortoken", updateSponsortokenHandler(pub)},
|
||||
"deletesponsortoken": {"DELETE", "/sponsortoken", deleteSponsorTokenHandler(pub)},
|
||||
"experimental": {"POST", "/experimental/{value:[01truefalse]+}", boolHandler(setExperimental(pub), getExperimental)},
|
||||
}
|
||||
|
||||
// yaml handlers
|
||||
|
|
|
|||
|
|
@ -10,6 +10,19 @@ import (
|
|||
"github.com/evcc-io/evcc/util/sponsor"
|
||||
)
|
||||
|
||||
func setExperimental(pub publisher) func(bool) error {
|
||||
return func(b bool) error {
|
||||
settings.SetBool(keys.Experimental, b)
|
||||
pub(keys.Experimental, b)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func getExperimental() bool {
|
||||
b, _ := settings.Bool(keys.Experimental)
|
||||
return b
|
||||
}
|
||||
|
||||
func updateSponsortokenHandler(pub publisher) func(w http.ResponseWriter, r *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue