File tree Expand file tree Collapse file tree
SimpleDnsCrypt/ViewModels Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -518,6 +518,32 @@ public async void SaveDnsCryptConfiguration()
518518 {
519519 if ( DnscryptProxyConfiguration == null ) return ;
520520 DnscryptProxyConfigurationManager . DnscryptProxyConfiguration = _dnscryptProxyConfiguration ;
521+
522+ if ( DnscryptProxyConfiguration ? . server_names ? . Count > 0 )
523+ {
524+ LoadResolvers ( ) ;
525+ IsDnsCryptAutomaticModeEnabled = false ;
526+ //check if all selected servers still match the selected filters
527+ var selectedServerNames = DnscryptProxyConfiguration . server_names ;
528+ foreach ( var serverName in selectedServerNames . ToList ( ) )
529+ {
530+ var s = _resolvers . FirstOrDefault ( r => r . Name . Equals ( serverName ) ) ;
531+ if ( s == null )
532+ {
533+ selectedServerNames . Remove ( serverName ) ;
534+ }
535+ else
536+ {
537+ s . IsInServerList = true ;
538+ }
539+ }
540+ DnscryptProxyConfiguration . server_names = selectedServerNames ;
541+ if ( DnscryptProxyConfiguration ? . server_names ? . Count == 0 )
542+ {
543+ IsDnsCryptAutomaticModeEnabled = true ;
544+ }
545+ }
546+
521547 if ( DnscryptProxyConfigurationManager . SaveConfiguration ( ) )
522548 {
523549 _dnscryptProxyConfiguration = DnscryptProxyConfigurationManager . DnscryptProxyConfiguration ;
You can’t perform that action at this time.
0 commit comments