diff --git a/plinth/modules/tor/forms.py b/plinth/modules/tor/forms.py index c78e4a246..baca3df64 100644 --- a/plinth/modules/tor/forms.py +++ b/plinth/modules/tor/forms.py @@ -80,6 +80,22 @@ class TorForm(forms.Form): # pylint: disable=W0232 enabled = forms.BooleanField( label=_('Enable Tor'), required=False) + use_upstream_bridges = forms.BooleanField( + label=_('Use upstream bridges to connect to Tor network'), + required=False, + help_text=_('When enabled, the bridges configured below will be used ' + 'to connect to the Tor network. This will disable relay ' + 'modes. Only use this option if you cannot connect to ' + 'the Tor network directly.')) + upstream_bridges = TrimmedCharField( + widget=widgets.Textarea, + label=_('Upstream bridges'), + required=False, + help_text=_('If you need to use a bridge to connect to Tor network, ' + 'you can get some bridges from ' + 'https://bridges.torproject.org/ and paste the bridge ' + 'information here.'), + validators=[bridges_validator]) relay_enabled = forms.BooleanField( label=_('Enable Tor relay'), required=False, @@ -111,19 +127,3 @@ class TorForm(forms.Form): # pylint: disable=W0232 'network for installations and upgrades. This adds a ' 'degree of privacy and security during software ' 'downloads.')) - use_upstream_bridges = forms.BooleanField( - label=_('Use upstream bridges to connect to Tor network'), - required=False, - help_text=_('When enabled, the bridges configured below will be used ' - 'to connect to the Tor network. This will disable relay ' - 'modes. Use this option only if you cannot connect to ' - 'the Tor network directly.')) - upstream_bridges = TrimmedCharField( - widget=widgets.Textarea, - label=_('Upstream bridges'), - required=False, - help_text=_('If you need to use a bridge to connect to Tor network, ' - 'you can get some bridges from ' - 'https://bridges.torproject.org/ and paste the bridge ' - 'information here.'), - validators=[bridges_validator]) diff --git a/plinth/modules/tor/templates/tor.html b/plinth/modules/tor/templates/tor.html index b0d708f7d..ff881b086 100644 --- a/plinth/modules/tor/templates/tor.html +++ b/plinth/modules/tor/templates/tor.html @@ -159,10 +159,14 @@ $('label[for="id_tor-upstream_bridges"]').parent().show('slow'); $('#id_tor-relay_enabled').prop('checked', false); $('#id_tor-bridge_relay_enabled').prop('checked', false); + $('#id_tor-relay_enabled').parent().parent().parent().parent().hide('slow'); + $('#id_tor-bridge_relay_enabled').parent().parent().parent().parent().hide('slow'); } else { $('#id_tor-upstream_bridges').hide('slow'); $('label[for="id_tor-upstream_bridges"]').hide('slow'); $('label[for="id_tor-upstream_bridges"]').parent().hide('slow'); + $('#id_tor-relay_enabled').parent().parent().parent().parent().show('slow'); + $('#id_tor-bridge_relay_enabled').parent().parent().parent().parent().show('slow'); } }).change(); })(jQuery);