tor: Hide relay options when upstream bridges are used

Move upstream bridge options above relay options.
This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2017-01-29 11:19:20 +05:30
1 parent 5483d30151
commit 4eaff44b49
2 files changed
+20 -16

No files matched your search

+16 -16
View File
@@ -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])
+4
View File
@@ -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);