From ccd4ae6315853249002de2cb6d31dea6a3d330f4 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Thu, 17 Oct 2024 19:21:35 +0200 Subject: [PATCH 1/2] Fix domain information is up to date check (#2754) --- management/server/account.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/management/server/account.go b/management/server/account.go index 7c84ad1ca..4c4806bb5 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -45,15 +45,15 @@ import ( ) const ( - PublicCategory = "public" - PrivateCategory = "private" - UnknownCategory = "unknown" - CacheExpirationMax = 7 * 24 * 3600 * time.Second // 7 days - CacheExpirationMin = 3 * 24 * 3600 * time.Second // 3 days - DefaultPeerLoginExpiration = 24 * time.Hour + PublicCategory = "public" + PrivateCategory = "private" + UnknownCategory = "unknown" + CacheExpirationMax = 7 * 24 * 3600 * time.Second // 7 days + CacheExpirationMin = 3 * 24 * 3600 * time.Second // 3 days + DefaultPeerLoginExpiration = 24 * time.Hour DefaultPeerInactivityExpiration = 10 * time.Minute - emptyUserID = "empty user ID in claims" - errorGettingDomainAccIDFmt = "error getting account ID by private domain: %v" + emptyUserID = "empty user ID in claims" + errorGettingDomainAccIDFmt = "error getting account ID by private domain: %v" ) type userLoggedInOnce bool @@ -1440,7 +1440,7 @@ func (am *DefaultAccountManager) addAccountIDToIDPAppMeta(ctx context.Context, u return err } cachedAccount := &Account{ - Id: accountID, + Id: accountID, Users: make(map[string]*User), } for _, user := range accountUsers { @@ -2276,7 +2276,7 @@ func handleNotFound(err error) error { } func domainIsUpToDate(domain string, domainCategory string, claims jwtclaims.AuthorizationClaims) bool { - return claims.Domain != "" && claims.Domain != domain && claims.DomainCategory == PrivateCategory && domainCategory != PrivateCategory + return domainCategory == PrivateCategory || claims.DomainCategory != PrivateCategory || domain != claims.Domain } func (am *DefaultAccountManager) SyncAndMarkPeer(ctx context.Context, accountID string, peerPubKey string, meta nbpeer.PeerSystemMeta, realIP net.IP) (*nbpeer.Peer, *NetworkMap, []*posture.Checks, error) { From 507a40bd7f7a9119fd9ddbfe72ef84160b864dae Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Thu, 17 Oct 2024 20:39:59 +0200 Subject: [PATCH 2/2] Fix decompress zip path (#2755) Since 0.30.2 the decompressed binary path from the signed package has changed now it doesn't contain the arch suffix this change handles that --- client/ui/netbird-ui.rb.tmpl | 6 +++--- release_files/install.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/ui/netbird-ui.rb.tmpl b/client/ui/netbird-ui.rb.tmpl index 9efddd750..06971909d 100644 --- a/client/ui/netbird-ui.rb.tmpl +++ b/client/ui/netbird-ui.rb.tmpl @@ -8,11 +8,11 @@ cask "{{ $projectName }}" do if Hardware::CPU.intel? url "{{ $amdURL }}" sha256 "{{ crypto.SHA256 $amdFileBytes }}" - app "netbird_ui_darwin_amd64", target: "Netbird UI.app" + app "netbird_ui_darwin", target: "Netbird UI.app" else url "{{ $armURL }}" sha256 "{{ crypto.SHA256 $armFileBytes }}" - app "netbird_ui_darwin_arm64", target: "Netbird UI.app" + app "netbird_ui_darwin", target: "Netbird UI.app" end depends_on formula: "netbird" @@ -36,4 +36,4 @@ cask "{{ $projectName }}" do name "Netbird UI" desc "Netbird UI Client" homepage "https://www.netbird.io/" -end \ No newline at end of file +end diff --git a/release_files/install.sh b/release_files/install.sh index b7a6c08f9..b0fec2733 100755 --- a/release_files/install.sh +++ b/release_files/install.sh @@ -86,7 +86,7 @@ download_release_binary() { # Unzip the app and move to INSTALL_DIR unzip -q -o "$BINARY_NAME" - mv "netbird_ui_${OS_TYPE}_${ARCH}/" "$INSTALL_DIR/" + mv -v "netbird_ui_${OS_TYPE}/" "$INSTALL_DIR/" || mv -v "netbird_ui_${OS_TYPE}_${ARCH}/" "$INSTALL_DIR/" else ${SUDO} mkdir -p "$INSTALL_DIR" tar -xzvf "$BINARY_NAME"