Skip to content

Commit 89d4c57

Browse files
committed
Update dependencies to fix persistence issue on *nix, add default no handles for capability add/remove events.
1 parent 72a586a commit 89d4c57

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/peterbourgon/ff/v3 v3.4.0
1515
github.com/shimmeringbee/da v0.0.0-20240714070346-b84fc2e73097
1616
github.com/shimmeringbee/logwrap v0.1.3
17-
github.com/shimmeringbee/persistence v0.0.0-20240615183316-1a60e6781413
17+
github.com/shimmeringbee/persistence v0.0.0-20240720200254-3a2a94e3614d
1818
github.com/shimmeringbee/zda v0.0.0-20240714070445-404da6703600
1919
github.com/shimmeringbee/zigbee v0.0.0-20240614104723-f4c0c0231568
2020
github.com/shimmeringbee/zstack v0.0.0-20240714070814-75c3dd0a3d27

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ github.com/shimmeringbee/logwrap v0.1.3 h1:1PqPGdgbeQxACQqc6RUWERn7EnpA1jbiHzXVY
4242
github.com/shimmeringbee/logwrap v0.1.3/go.mod h1:NBAcZCUl6aFOGnWTs8m67EUAmWFZXRhoRQf5nknY8W0=
4343
github.com/shimmeringbee/persistence v0.0.0-20240615183316-1a60e6781413 h1:0t4xEtg+kXXATiryn0m9p5OmsvDUvh2BPG+r7Vcpvy4=
4444
github.com/shimmeringbee/persistence v0.0.0-20240615183316-1a60e6781413/go.mod h1:Ob1eKGYM7+9P3LkB9vB9nr15d3trtS4D9KOnGoxOkp8=
45+
github.com/shimmeringbee/persistence v0.0.0-20240720200254-3a2a94e3614d h1:KAb0GR2agtm/Fb1lHmdb9pVdFoTnBMEdnfOqrB5lb1g=
46+
github.com/shimmeringbee/persistence v0.0.0-20240720200254-3a2a94e3614d/go.mod h1:Ob1eKGYM7+9P3LkB9vB9nr15d3trtS4D9KOnGoxOkp8=
4547
github.com/shimmeringbee/retry v0.0.0-20240614104711-064c2726a8b4 h1:YU77guV/6/9nJymm4K1JH6MIx6yE/NfUnFX//yo3GfM=
4648
github.com/shimmeringbee/retry v0.0.0-20240614104711-064c2726a8b4/go.mod h1:KYvVq5b7/BSSlWng+AKB5jwNGpc0D7eg8ySWrdPAlms=
4749
github.com/shimmeringbee/unpi v0.0.0-20210111165207-f0210c6942fc/go.mod h1:iAt5R5HT+VC7B9U77uBmN5Z6+DJo4U0z6ag68NH2mMw=

interface/converters/exporter/event_exporter.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ func (w eventExporter) MapEvent(ctx context.Context, v any) ([]any, error) {
117117
case state.ZoneRemove:
118118
return w.generateZoneRemove(e)
119119

120+
case da.CapabilityAdded:
121+
case da.CapabilityRemoved:
122+
120123
default:
121124
if d, c, found := eventToCapability(e); found {
122125
return w.generateDeviceUpdateCapabilityMessage(ctx, d, c)

interface/http/v1/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@
673673
},
674674
"responses": {
675675
"200": {
676-
"description": "successfully deleted zone",
676+
"description": "successfully updated zone",
677677
"content": {
678678
"application/json": {}
679679
}

interface/http/v1/router.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,8 @@ func ConstructRouter(mapper state.GatewayMapper, deviceOrganiser *state.DeviceOr
7676
apiRoot.PathPrefix("/auth").Handler(ap.AuthenticationRouter())
7777
apiRoot.PathPrefix("/").Handler(ap.AuthenticationMiddleware(protected))
7878

79-
return handlers.CORS(handlers.AllowedMethods([]string{http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, http.MethodDelete}))(apiRoot)
79+
return handlers.CORS(
80+
handlers.AllowedMethods([]string{http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, http.MethodDelete, http.MethodPatch}),
81+
handlers.AllowedHeaders([]string{"content-type"}),
82+
)(apiRoot)
8083
}

interface_mgmt.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"encoding/json"
1010
"fmt"
1111
pahomqtt "github.com/eclipse/paho.mqtt.golang"
12+
"github.com/gorilla/handlers"
1213
gorillamux "github.com/gorilla/mux"
1314
"github.com/shimmeringbee/controller/config"
1415
"github.com/shimmeringbee/controller/interface/converters/invoker"
@@ -152,8 +153,10 @@ func startHTTPInterface(cfg config.HTTPInterfaceConfig, g *state.GatewayMux, e s
152153
r.PathPrefix("/api/pprof").Handler(http.StripPrefix("/api/pprof", pprof.ConstructRouter(authenticator)))
153154
}
154155

156+
handler := handlers.LoggingHandler(os.Stdout, r)
157+
155158
bindAddress := fmt.Sprintf(":%d", cfg.Port)
156-
srv := &http.Server{Addr: bindAddress, Handler: r}
159+
srv := &http.Server{Addr: bindAddress, Handler: handler}
157160

158161
go func() {
159162
if err := srv.ListenAndServe(); err != nil {

0 commit comments

Comments
 (0)