mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Use package framework for installing tor
This commit is contained in:
1 parent
7b45ad1813
commit
c7f27e493e
3 files changed
+5
-42
No files matched your search
@@ -24,8 +24,6 @@
|
||||
|
||||
<h2>Tor</h2>
|
||||
|
||||
{% if is_installed %}
|
||||
|
||||
<h3>Status</h3>
|
||||
|
||||
<p>
|
||||
@@ -80,15 +78,6 @@ port-forwarded, if necessary:</p>
|
||||
<p>A Tor SOCKS port is available on your {{ cfg.box_name }} on TCP port
|
||||
9050.</p>
|
||||
|
||||
{% else %}
|
||||
|
||||
<p>Tor is not installed, please install it. Tor comes pre-installed
|
||||
with {{ cfg.box_name }}. On any Debian-based system (such as
|
||||
{{ cfg.box_name }}) you may install it using the command
|
||||
<code>aptitude install tor</code>.</p>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
|
||||
@@ -27,6 +27,7 @@ from gettext import gettext as _
|
||||
|
||||
from plinth import actions
|
||||
from plinth import cfg
|
||||
from plinth import package
|
||||
|
||||
|
||||
class TorForm(forms.Form): # pylint: disable=W0232
|
||||
@@ -43,6 +44,7 @@ def init():
|
||||
|
||||
|
||||
@login_required
|
||||
@package.required('tor')
|
||||
def index(request):
|
||||
"""Service the index page"""
|
||||
status = get_status()
|
||||
@@ -61,7 +63,6 @@ def index(request):
|
||||
|
||||
return TemplateResponse(request, 'tor.html',
|
||||
{'title': _('Tor Control Panel'),
|
||||
'is_installed': status['is_installed'],
|
||||
'is_running': status['is_running'],
|
||||
'tor_ports': status['ports'],
|
||||
'tor_hs_enabled': status['hs_enabled'],
|
||||
@@ -72,9 +73,6 @@ def index(request):
|
||||
|
||||
def get_status():
|
||||
"""Return the current status"""
|
||||
is_installed = actions.superuser_run(
|
||||
'tor',
|
||||
['get-installed']).strip() == 'installed'
|
||||
is_running = actions.superuser_run('tor', ['is-running']).strip() == 'yes'
|
||||
|
||||
output = actions.superuser_run('tor-get-ports')
|
||||
@@ -103,8 +101,7 @@ def get_status():
|
||||
hs_hostname = hs_info[0]
|
||||
hs_ports = hs_info[1]
|
||||
|
||||
return {'is_installed': is_installed,
|
||||
'is_running': is_running,
|
||||
return {'is_running': is_running,
|
||||
'ports': ports,
|
||||
'hs_enabled': hs_enabled,
|
||||
'hs_hostname': hs_hostname,
|
||||
|
||||
Reference in new issue
Block a user