Remote Access: not experimental any more (#33148)
This commit is contained in:
parent
10c646e668
commit
442113e9ea
8 changed files with 65 additions and 11 deletions
|
|
@ -15,6 +15,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/evcc-io/evcc/core/keys"
|
||||
"github.com/evcc-io/evcc/core/loadpoint"
|
||||
"github.com/evcc-io/evcc/core/site"
|
||||
"github.com/evcc-io/evcc/server/assets"
|
||||
|
|
@ -528,6 +529,7 @@ func resetDatabase(shutdown func()) http.HandlerFunc {
|
|||
var req struct {
|
||||
Sessions bool `json:"sessions"`
|
||||
Settings bool `json:"settings"`
|
||||
Remote bool `json:"remote"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
jsonError(w, http.StatusBadRequest, err)
|
||||
|
|
@ -560,6 +562,15 @@ func resetDatabase(shutdown func()) http.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
if req.Remote {
|
||||
for _, key := range []string{keys.Remote, keys.RemoteClients, keys.RemoteLastSeen} {
|
||||
if err := settings.Delete(key); err != nil {
|
||||
jsonError(w, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// close db connection to avoid on-shutdown writes
|
||||
if err := db.Close(); err != nil {
|
||||
jsonError(w, http.StatusInternalServerError, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue