mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
fa74a26042
commit
eb83e00011
134 files changed
+598
-720
No files matched your search
+27
-37
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Forms for configuring Tor.
|
||||
"""
|
||||
@@ -86,55 +85,44 @@ def bridges_validator(bridges):
|
||||
|
||||
class TorForm(forms.Form): # pylint: disable=W0232
|
||||
"""Tor configuration form."""
|
||||
enabled = forms.BooleanField(
|
||||
label=_('Enable Tor'),
|
||||
required=False)
|
||||
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=_(
|
||||
required=False, help_text=_(
|
||||
'When enabled, the bridges configured below will be used to '
|
||||
'connect to the Tor network. Use this option if your Internet '
|
||||
'Service Provider (ISP) blocks or censors connections to the '
|
||||
'Tor Network. This will disable relay modes.'))
|
||||
upstream_bridges = TrimmedCharField(
|
||||
widget=widgets.Textarea,
|
||||
label=_('Upstream bridges'),
|
||||
required=False,
|
||||
widget=widgets.Textarea, label=_('Upstream bridges'), required=False,
|
||||
help_text=_(
|
||||
'You can get some bridges from <a '
|
||||
'href="https://bridges.torproject.org/">'
|
||||
'https://bridges.torproject.org/</a> and copy/paste the bridge '
|
||||
'information here. Currently supported transports are none, '
|
||||
'obfs3, obfs4 and scamblesuit.'),
|
||||
validators=[bridges_validator])
|
||||
'obfs3, obfs4 and scamblesuit.'), validators=[bridges_validator])
|
||||
relay_enabled = forms.BooleanField(
|
||||
label=_('Enable Tor relay'),
|
||||
required=False,
|
||||
help_text=format_lazy(_(
|
||||
'When enabled, your {box_name} will run a Tor relay and donate '
|
||||
'bandwidth to the Tor network. Do this if you have more than '
|
||||
'2 megabits/s of upload and download bandwidth.'),
|
||||
box_name=_(cfg.box_name)))
|
||||
label=_('Enable Tor relay'), required=False, help_text=format_lazy(
|
||||
_('When enabled, your {box_name} will run a Tor relay and donate '
|
||||
'bandwidth to the Tor network. Do this if you have more than '
|
||||
'2 megabits/s of upload and download bandwidth.'),
|
||||
box_name=_(cfg.box_name)))
|
||||
bridge_relay_enabled = forms.BooleanField(
|
||||
label=_('Enable Tor bridge relay'),
|
||||
required=False,
|
||||
help_text=format_lazy(_(
|
||||
'When enabled, relay information is published in the Tor bridge '
|
||||
'database instead of public Tor relay database making it harder '
|
||||
'to censor this node. This helps others circumvent censorship.'),
|
||||
box_name=_(cfg.box_name)))
|
||||
label=_('Enable Tor bridge relay'), required=False,
|
||||
help_text=format_lazy(
|
||||
_('When enabled, relay information is published in the Tor bridge '
|
||||
'database instead of public Tor relay database making it harder '
|
||||
'to censor this node. This helps others circumvent censorship.'),
|
||||
box_name=_(cfg.box_name)))
|
||||
hs_enabled = forms.BooleanField(
|
||||
label=_('Enable Tor Onion Service'),
|
||||
required=False,
|
||||
help_text=format_lazy(_(
|
||||
'An onion service will allow {box_name} to provide selected '
|
||||
'services (such as wiki or chat) without revealing its '
|
||||
'location. Do not use this for strong anonymity yet.'),
|
||||
box_name=_(cfg.box_name)))
|
||||
label=_('Enable Tor Hidden Service'), required=False,
|
||||
help_text=format_lazy(
|
||||
_('A hidden service will allow {box_name} to provide selected '
|
||||
'services (such as wiki or chat) without revealing its '
|
||||
'location. Do not use this for strong anonymity yet.'),
|
||||
box_name=_(cfg.box_name)))
|
||||
apt_transport_tor_enabled = forms.BooleanField(
|
||||
label=_('Download software packages over Tor'),
|
||||
required=False,
|
||||
label=_('Download software packages over Tor'), required=False,
|
||||
help_text=_('When enabled, software will be downloaded over the Tor '
|
||||
'network for installations and upgrades. This adds a '
|
||||
'degree of privacy and security during software '
|
||||
@@ -147,8 +135,10 @@ class TorForm(forms.Form): # pylint: disable=W0232
|
||||
upstream_bridges = cleaned_data.get('upstream_bridges')
|
||||
|
||||
if use_upstream_bridges and not upstream_bridges:
|
||||
self.add_error('upstream_bridges', ValidationError(_(
|
||||
'Specify at least one upstream bridge to use upstream '
|
||||
'bridges.'), code='invalid'))
|
||||
self.add_error(
|
||||
'upstream_bridges',
|
||||
ValidationError(
|
||||
_('Specify at least one upstream bridge to use upstream '
|
||||
'bridges.'), code='invalid'))
|
||||
|
||||
return cleaned_data
|
||||
@@ -28,7 +28,6 @@ from plinth.modules.tor import forms, utils
|
||||
|
||||
class TestTor:
|
||||
"""Test cases for testing the Tor module."""
|
||||
|
||||
@staticmethod
|
||||
@pytest.mark.usefixtures('needs_root')
|
||||
def test_is_apt_transport_tor_enabled():
|
||||
@@ -51,7 +50,6 @@ class TestTor:
|
||||
|
||||
class TestTorForm:
|
||||
"""Test whether Tor configration form works."""
|
||||
|
||||
@staticmethod
|
||||
def test_bridge_validator():
|
||||
"""Test upstream bridges' form field validator."""
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
URLs for the Tor module.
|
||||
"""
|
||||
@@ -23,7 +22,6 @@ from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^apps/tor/$', views.index, name='index'),
|
||||
]
|
||||
@@ -104,8 +104,8 @@ def get_real_apt_uri_path(aug, path):
|
||||
|
||||
def get_augeas():
|
||||
"""Return an instance of Augeaus for processing APT configuration."""
|
||||
aug = augeas.Augeas(
|
||||
flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
||||
augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
aug.set('/augeas/load/Aptsources/lens', 'Aptsources.lns')
|
||||
aug.set('/augeas/load/Aptsources/incl[last() + 1]',
|
||||
'/etc/apt/sources.list')
|
||||
|
||||
Reference in new issue
Block a user