From 5ca8e0c35dd85c6e41d01c652355b86b90f0032c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:16:31 -0900 Subject: [PATCH 1/9] fix(deps): update module github.com/mattn/go-sqlite3 to v1.14.21 (#730) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- backend/go.mod | 2 +- backend/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/go.mod b/backend/go.mod index 229365d..0fd3e7f 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -13,7 +13,7 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/schema v1.2.1 github.com/hay-kot/httpkit v0.0.5 - github.com/mattn/go-sqlite3 v1.14.20 + github.com/mattn/go-sqlite3 v1.14.21 github.com/olahol/melody v1.1.4 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.31.0 diff --git a/backend/go.sum b/backend/go.sum index 267fa07..3f4788f 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -113,6 +113,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.20 h1:BAZ50Ns0OFBNxdAqFhbZqdPcht1Xlb16pDCqkq1spr0= github.com/mattn/go-sqlite3 v1.14.20/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.21 h1:IXocQLOykluc3xPE0Lvy8FtggMz1G+U3mEjg+0zGizc= +github.com/mattn/go-sqlite3 v1.14.21/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= From c55d42132606272150c22b02e46bd526d685e763 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:20:31 -0900 Subject: [PATCH 2/9] chore(deps): update dependency mkdocs-material to v9.5.6 (#728) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 8a97be7..72e92d5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1 @@ -mkdocs-material==9.5.5 \ No newline at end of file +mkdocs-material==9.5.6 \ No newline at end of file From aace77ec408d05451dc4dcdcabc7867fd7926df3 Mon Sep 17 00:00:00 2001 From: LINKIWI Date: Wed, 31 Jan 2024 11:20:56 -0800 Subject: [PATCH 3/9] backend: Periodically send client aliveness pings in event stream websocket connection (#729) * backend: Periodically send client aliveness pings following event websocket connection * backend: Single persistent global ping goroutine instead of per-session ticker --- backend/app/api/handlers/v1/controller.go | 36 +++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/backend/app/api/handlers/v1/controller.go b/backend/app/api/handlers/v1/controller.go index 25f6aab..eb60212 100644 --- a/backend/app/api/handlers/v1/controller.go +++ b/backend/app/api/handlers/v1/controller.go @@ -2,8 +2,9 @@ package v1 import ( - "fmt" + "encoding/json" "net/http" + "time" "github.com/google/uuid" "github.com/hay-kot/homebox/backend/internal/core/services" @@ -144,6 +145,10 @@ func (ctrl *V1Controller) HandleCurrency() errchain.HandlerFunc { } func (ctrl *V1Controller) HandleCacheWS() errchain.HandlerFunc { + type eventMsg struct { + Event string `json:"event"` + } + m := melody.New() m.HandleConnect(func(s *melody.Session) { @@ -159,9 +164,15 @@ func (ctrl *V1Controller) HandleCacheWS() errchain.HandlerFunc { return } - jsonStr := fmt.Sprintf(`{"event": "%s"}`, e) + msg := &eventMsg{Event: e} - _ = m.BroadcastFilter([]byte(jsonStr), func(s *melody.Session) bool { + jsonBytes, err := json.Marshal(msg) + if err != nil { + log.Log().Msgf("error marshling event data %v: %v", data, err) + return + } + + _ = m.BroadcastFilter(jsonBytes, func(s *melody.Session) bool { groupIDStr, ok := s.Get("gid") if !ok { return false @@ -177,6 +188,25 @@ func (ctrl *V1Controller) HandleCacheWS() errchain.HandlerFunc { ctrl.bus.Subscribe(eventbus.EventLocationMutation, factory("location.mutation")) ctrl.bus.Subscribe(eventbus.EventItemMutation, factory("item.mutation")) + // Persistent asynchronous ticker that keeps all websocket connections alive with periodic pings. + go func() { + const interval = 10 * time.Second + + ping := time.NewTicker(interval) + defer ping.Stop() + + for range ping.C { + msg := &eventMsg{Event: "ping"} + + pingBytes, err := json.Marshal(msg) + if err != nil { + log.Log().Msgf("error marshaling ping: %v", err) + } else { + _ = m.Broadcast(pingBytes) + } + } + }() + return func(w http.ResponseWriter, r *http.Request) error { return m.HandleRequest(w, r) } From 5b52aa8abfc86d8d752786703df7725d53e69d50 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 4 Feb 2024 10:42:39 -0900 Subject: [PATCH 4/9] chore(deps): update dependency mkdocs-material to v9.5.7 (#736) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 72e92d5..66c522d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1 @@ -mkdocs-material==9.5.6 \ No newline at end of file +mkdocs-material==9.5.7 \ No newline at end of file From 2311eda44b5bd9afa1c41db2e123417a98dd5ca5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 4 Feb 2024 10:42:50 -0900 Subject: [PATCH 5/9] fix(deps): update module ariga.io/atlas to v0.19.0 (#734) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- backend/go.mod | 2 +- backend/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/go.mod b/backend/go.mod index 0fd3e7f..f7a74ce 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -3,7 +3,7 @@ module github.com/hay-kot/homebox/backend go 1.21 require ( - ariga.io/atlas v0.18.0 + ariga.io/atlas v0.19.0 entgo.io/ent v0.12.5 github.com/ardanlabs/conf/v3 v3.1.7 github.com/containrrr/shoutrrr v0.8.0 diff --git a/backend/go.sum b/backend/go.sum index 3f4788f..da025c9 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -1,5 +1,7 @@ ariga.io/atlas v0.18.0 h1:LiSG7WYBQKUejvk5iAFE87lagQgOHn6kN+Us9xJ/Dsc= ariga.io/atlas v0.18.0/go.mod h1:uj3pm+hUTVN/X5yfdBexHlZv+1Xu5u5ZbZx7+CDavNU= +ariga.io/atlas v0.19.0 h1:gilVpXabeiGhGI9lj/rQURkXBemnloc41RGOtwVLNc4= +ariga.io/atlas v0.19.0/go.mod h1:uj3pm+hUTVN/X5yfdBexHlZv+1Xu5u5ZbZx7+CDavNU= entgo.io/ent v0.12.5 h1:KREM5E4CSoej4zeGa88Ou/gfturAnpUv0mzAjch1sj4= entgo.io/ent v0.12.5/go.mod h1:Y3JVAjtlIk8xVZYSn3t3mf8xlZIn5SAOXZQxD6kKI+Q= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= From 6a32762c98821b5ef18927652968631268124d47 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 4 Feb 2024 10:42:59 -0900 Subject: [PATCH 6/9] fix(deps): update module github.com/swaggo/swag to v1.16.3 (#731) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- backend/go.mod | 2 +- backend/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/go.mod b/backend/go.mod index f7a74ce..05e7af6 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -19,7 +19,7 @@ require ( github.com/rs/zerolog v1.31.0 github.com/stretchr/testify v1.8.4 github.com/swaggo/http-swagger v1.3.4 - github.com/swaggo/swag v1.16.2 + github.com/swaggo/swag v1.16.3 github.com/yeqown/go-qrcode/v2 v2.2.2 github.com/yeqown/go-qrcode/writer/standard v1.2.2 golang.org/x/crypto v0.18.0 diff --git a/backend/go.sum b/backend/go.sum index da025c9..2942a31 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -156,6 +156,8 @@ github.com/swaggo/http-swagger v1.3.4 h1:q7t/XLx0n15H1Q9/tk3Y9L4n210XzJF5WtnDX64 github.com/swaggo/http-swagger v1.3.4/go.mod h1:9dAh0unqMBAlbp1uE2Uc2mQTxNMU/ha4UbucIg1MFkQ= github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04= github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E= +github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= +github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= github.com/yeqown/go-qrcode/v2 v2.2.2 h1:0comk6jEwi0oWNhKEmzx4JI+Q7XIneAApmFSMKWmSVc= github.com/yeqown/go-qrcode/v2 v2.2.2/go.mod h1:2Qsk2APUCPne0TsRo40DIkI5MYnbzYKCnKGEFWrxd24= github.com/yeqown/go-qrcode/writer/standard v1.2.2 h1:gyzunKXgC0ZUpKqQFUImbAEwewAiwNCkxFEKZV80Kt4= From 8d18b060120d7ef5fc3732f4dc6e25dddf23f165 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 4 Feb 2024 10:43:08 -0900 Subject: [PATCH 7/9] fix(deps): update module github.com/mattn/go-sqlite3 to v1.14.22 (#735) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- backend/go.mod | 2 +- backend/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/go.mod b/backend/go.mod index 05e7af6..dcbfecc 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -13,7 +13,7 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/schema v1.2.1 github.com/hay-kot/httpkit v0.0.5 - github.com/mattn/go-sqlite3 v1.14.21 + github.com/mattn/go-sqlite3 v1.14.22 github.com/olahol/melody v1.1.4 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.31.0 diff --git a/backend/go.sum b/backend/go.sum index 2942a31..206a587 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -117,6 +117,8 @@ github.com/mattn/go-sqlite3 v1.14.20 h1:BAZ50Ns0OFBNxdAqFhbZqdPcht1Xlb16pDCqkq1s github.com/mattn/go-sqlite3 v1.14.20/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.21 h1:IXocQLOykluc3xPE0Lvy8FtggMz1G+U3mEjg+0zGizc= github.com/mattn/go-sqlite3 v1.14.21/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= From 0f8e1fee3589af4f239de371aeb224a46a1ae567 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:45:44 -0900 Subject: [PATCH 8/9] fix(deps): update module github.com/rs/zerolog to v1.32.0 (#740) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- backend/go.mod | 2 +- backend/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/go.mod b/backend/go.mod index dcbfecc..9db2818 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -16,7 +16,7 @@ require ( github.com/mattn/go-sqlite3 v1.14.22 github.com/olahol/melody v1.1.4 github.com/pkg/errors v0.9.1 - github.com/rs/zerolog v1.31.0 + github.com/rs/zerolog v1.32.0 github.com/stretchr/testify v1.8.4 github.com/swaggo/http-swagger v1.3.4 github.com/swaggo/swag v1.16.3 diff --git a/backend/go.sum b/backend/go.sum index 206a587..14a903a 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -139,6 +139,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 3d748021dc084ad15041f97494e44c6edfb04a0a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:45:51 -0900 Subject: [PATCH 9/9] chore(deps): update dependency mkdocs-material to v9.5.8 (#742) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 66c522d..4498336 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1 @@ -mkdocs-material==9.5.7 \ No newline at end of file +mkdocs-material==9.5.8 \ No newline at end of file