@@ -13,6 +13,9 @@ public partial class SettingsViewModel : ObservableObject
1313 [ ObservableProperty ]
1414 public partial bool ConnectOnLaunch { get ; set ; }
1515
16+ [ ObservableProperty ]
17+ public partial bool DisableTailscaleLoopProtection { get ; set ; }
18+
1619 [ ObservableProperty ]
1720 public partial bool StartOnLoginDisabled { get ; set ; }
1821
@@ -31,6 +34,7 @@ public SettingsViewModel(ILogger<SettingsViewModel> logger, ISettingsManager<Cod
3134 _connectSettings = settingsManager . Read ( ) . GetAwaiter ( ) . GetResult ( ) ;
3235 StartOnLogin = startupManager . IsEnabled ( ) ;
3336 ConnectOnLaunch = _connectSettings . ConnectOnLaunch ;
37+ DisableTailscaleLoopProtection = _connectSettings . DisableTailscaleLoopProtection ;
3438
3539 // Various policies can disable the "Start on login" option.
3640 // We disable the option in the UI if the policy is set.
@@ -43,6 +47,21 @@ public SettingsViewModel(ILogger<SettingsViewModel> logger, ISettingsManager<Cod
4347 }
4448 }
4549
50+ partial void OnDisableTailscaleLoopProtectionChanged ( bool oldValue , bool newValue )
51+ {
52+ if ( oldValue == newValue )
53+ return ;
54+ try
55+ {
56+ _connectSettings . DisableTailscaleLoopProtection = DisableTailscaleLoopProtection ;
57+ _connectSettingsManager . Write ( _connectSettings ) ;
58+ }
59+ catch ( Exception ex )
60+ {
61+ _logger . LogError ( $ "Error saving Coder Connect { nameof ( DisableTailscaleLoopProtection ) } settings: { ex . Message } ") ;
62+ }
63+ }
64+
4665 partial void OnConnectOnLaunchChanged ( bool oldValue , bool newValue )
4766 {
4867 if ( oldValue == newValue )
@@ -54,7 +73,7 @@ partial void OnConnectOnLaunchChanged(bool oldValue, bool newValue)
5473 }
5574 catch ( Exception ex )
5675 {
57- _logger . LogError ( $ "Error saving Coder Connect settings: { ex . Message } ") ;
76+ _logger . LogError ( $ "Error saving Coder Connect { nameof ( ConnectOnLaunch ) } settings: { ex . Message } ") ;
5877 }
5978 }
6079
0 commit comments