diff --git a/release-notes.md b/release-notes.md index ebbc2544..6dc848b9 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,3 +1,18 @@ +# Release 1.10.2 + +## What's New +* none + +## Other changes: +* [#430](https://github.com/openziti/desktop-edge-win/issues/430) Snooze service timeout Notification. + - Send notification if WDE receives the service updates with timeout that is less than 5 minutes + +## Bugs fixed: +* none + +## Dependency Updates +* none + # Release 1.10.1 ## What's New diff --git a/service/ziti-tunnel/dto/dtos.go b/service/ziti-tunnel/dto/dtos.go index 657a5a47..b6052bc3 100644 --- a/service/ziti-tunnel/dto/dtos.go +++ b/service/ziti-tunnel/dto/dtos.go @@ -90,6 +90,7 @@ type Identity struct { MfaMaxTimeoutRem int32 MfaLastUpdatedTime time.Time ServiceUpdatedTime time.Time + Notified bool } type Metrics struct { diff --git a/service/ziti-tunnel/service/ipc.go b/service/ziti-tunnel/service/ipc.go index 951ac149..32338069 100644 --- a/service/ziti-tunnel/service/ipc.go +++ b/service/ziti-tunnel/service/ipc.go @@ -127,6 +127,7 @@ func SubMain(ops chan string, changes chan<- svc.Status, winEvents <-chan Window } } } + broadcastNotification(true) case <-shutdownDelay: log.Tracef("Exiting windows power events loop") return @@ -1137,6 +1138,11 @@ func handleBulkServiceChange(sc cziti.BulkServiceChange) { } rts.BroadcastEvent(m) + id := rts.Find(sc.Fingerprint) + if id != nil && !id.Notified { + broadcastNotification(true) + } + } func addUnit(count int, unit string) (result string) { @@ -1190,17 +1196,27 @@ func handleEvents(isInitialized chan struct{}) { // notification message case <-notificationFrequency.C: - broadcastNotification() + broadcastNotification(false) } } } -func broadcastNotification() { +func broadcastNotification(adhoc bool) { + changedNotifiedStatus := false cleanNotifications := make([]cziti.NotificationMessage, 0) for _, id := range rts.ids { + if id.CId == nil || !id.CId.MfaRefreshNeeded() { continue } + + if !id.Notified { + rts.SetNotified(id.FingerPrint, true) + changedNotifiedStatus = true + } else if id.Notified && adhoc { + continue + } + notificationMessage := "" var notificationMinTimeout int32 = 0 @@ -1235,6 +1251,10 @@ func broadcastNotification() { } } + if changedNotifiedStatus && adhoc { + ResetFrequency(rts.state.NotificationFrequency) + } + if len(cleanNotifications) > 0 { log.Debugf("Sending notification message to UI %v", cleanNotifications) @@ -1349,8 +1369,9 @@ func authMfa(out *json.Encoder, fingerprint string, code string) { if result == nil { // respond with auth success message immediately respond(out, dto.Response{Message: "AuthMFA complete", Code: SUCCESS, Error: "", Payload: fingerprint}) - + rts.SetNotified(fingerprint, false) id.CId.UpdateMFATime() + broadcastNotification(true) } else { respondWithError(out, fmt.Sprintf("AuthMFA failed. the supplied code [%s] was not valid: %s", code, result), 1, result) } diff --git a/service/ziti-tunnel/service/state.go b/service/ziti-tunnel/service/state.go index a808cb77..409d7770 100644 --- a/service/ziti-tunnel/service/state.go +++ b/service/ziti-tunnel/service/state.go @@ -555,6 +555,14 @@ func (t *RuntimeState) UpdateMfa(fingerprint string, mfaEnabled bool, mfaNeeded } } +func (t *RuntimeState) SetNotified(fingerprint string, notified bool) { + id := t.Find(fingerprint) + + if id != nil { + id.Notified = notified + } +} + func (t *RuntimeState) UpdateNotificationFrequency(notificationFreq int) error { log.Infof("setting notification frequency : %d", notificationFreq)