Skip to content

Commit cc48594

Browse files
authored
[client][ui] Disable notifications by default (#3375)
1 parent 559e673 commit cc48594

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

client/internal/config.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type Config struct {
9999

100100
BlockLANAccess bool
101101

102-
DisableNotifications bool
102+
DisableNotifications *bool
103103

104104
DNSLabels domain.List
105105

@@ -479,13 +479,20 @@ func (config *Config) apply(input ConfigInput) (updated bool, err error) {
479479
updated = true
480480
}
481481

482-
if input.DisableNotifications != nil && *input.DisableNotifications != config.DisableNotifications {
482+
if input.DisableNotifications != nil && input.DisableNotifications != config.DisableNotifications {
483483
if *input.DisableNotifications {
484484
log.Infof("disabling notifications")
485485
} else {
486486
log.Infof("enabling notifications")
487487
}
488-
config.DisableNotifications = *input.DisableNotifications
488+
config.DisableNotifications = input.DisableNotifications
489+
updated = true
490+
}
491+
492+
if config.DisableNotifications == nil {
493+
disabled := true
494+
config.DisableNotifications = &disabled
495+
log.Infof("setting notifications to disabled by default")
489496
updated = true
490497
}
491498

client/server/server.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,11 @@ func (s *Server) GetConfig(_ context.Context, _ *proto.GetConfigRequest) (*proto
751751

752752
}
753753

754+
disableNotifications := true
755+
if s.config.DisableNotifications != nil {
756+
disableNotifications = *s.config.DisableNotifications
757+
}
758+
754759
return &proto.GetConfigResponse{
755760
ManagementUrl: managementURL,
756761
ConfigFile: s.latestConfigInput.ConfigPath,
@@ -763,14 +768,14 @@ func (s *Server) GetConfig(_ context.Context, _ *proto.GetConfigRequest) (*proto
763768
ServerSSHAllowed: *s.config.ServerSSHAllowed,
764769
RosenpassEnabled: s.config.RosenpassEnabled,
765770
RosenpassPermissive: s.config.RosenpassPermissive,
766-
DisableNotifications: s.config.DisableNotifications,
771+
DisableNotifications: disableNotifications,
767772
}, nil
768773
}
769774

770775
func (s *Server) onSessionExpire() {
771776
if runtime.GOOS != "windows" {
772777
isUIActive := internal.CheckUIApp()
773-
if !isUIActive && !s.config.DisableNotifications {
778+
if !isUIActive && s.config.DisableNotifications != nil && !*s.config.DisableNotifications {
774779
if err := sendTerminalNotification(); err != nil {
775780
log.Errorf("send session expire terminal notification: %v", err)
776781
}

client/ui/client_ui.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ func (s *serviceClient) onTrayReady() {
591591
s.mAllowSSH = s.mSettings.AddSubMenuItemCheckbox("Allow SSH", "Allow SSH connections", false)
592592
s.mAutoConnect = s.mSettings.AddSubMenuItemCheckbox("Connect on Startup", "Connect automatically when the service starts", false)
593593
s.mEnableRosenpass = s.mSettings.AddSubMenuItemCheckbox("Enable Quantum-Resistance", "Enable post-quantum security via Rosenpass", false)
594-
s.mNotifications = s.mSettings.AddSubMenuItemCheckbox("Notifications", "Enable notifications", true)
594+
s.mNotifications = s.mSettings.AddSubMenuItemCheckbox("Notifications", "Enable notifications", false)
595595
s.mAdvancedSettings = s.mSettings.AddSubMenuItem("Advanced Settings", "Advanced settings of the application")
596596
s.mCreateDebugBundle = s.mSettings.AddSubMenuItem("Create Debug Bundle", "Create and open debug information bundle")
597597
s.loadSettings()

0 commit comments

Comments
 (0)