Minor updates to Tor service

This commit is contained in:
Sunil Mohan Adapa 2014-10-19 17:51:18 +05:30
parent 84640560b5
commit 71b27be720
3 changed files with 17 additions and 15 deletions

View File

@ -26,9 +26,9 @@
<br style='clear:both'> <br style='clear:both'>
{% if is_running %} {% if is_running %}
<div class='circle active'></div> Tor is running <div class='running-status active'></div> Tor is running
{% else %} {% else %}
<div class='circle inactive'></div> Tor is not running <div class='running-status inactive'></div> Tor is not running
{% endif %} {% endif %}
<br style='clear:both'> <br style='clear:both'>
@ -84,7 +84,7 @@ A Tor SOCKS port is available on your FreedomBox on TCP port
website. For best protection when web surfing, the Tor Project website. For best protection when web surfing, the Tor Project
recommends that you use recommends that you use
the <a href="https://www.torproject.org/download/download-easy.html.en">Tor the <a href="https://www.torproject.org/download/download-easy.html.en">Tor
Browser Bundle</a>.</p> Browser Bundle</a>.</p>
</div> </div>

View File

@ -39,7 +39,7 @@ class TorForm(forms.Form): # pylint: disable=W0232
def init(): def init():
"""Initialize the Tor module""" """Initialize the Tor module"""
menu = cfg.main_menu.get('apps:index') menu = cfg.main_menu.get('apps:index')
menu.add_urlname("Tor", "icon-eye-close", "tor:index", 30) menu.add_urlname('Tor', 'icon-eye-close', 'tor:index', 30)
@login_required @login_required
@ -71,10 +71,10 @@ def index(request):
def get_status(): def get_status():
"""Return the current status""" """Return the current status"""
is_running = actions.superuser_run("tor", ["is-running"]).strip() == "yes" is_running = actions.superuser_run('tor', ['is-running']).strip() == 'yes'
output = actions.superuser_run("tor-get-ports") output = actions.superuser_run('tor-get-ports')
port_info = output.split("\n") port_info = output.split('\n')
ports = {} ports = {}
for line in port_info: for line in port_info:
try: try:
@ -83,12 +83,12 @@ def get_status():
except ValueError: except ValueError:
continue continue
output = actions.superuser_run("tor", ["get-hs"]) output = actions.superuser_run('tor', ['get-hs'])
output = output.strip() output = output.strip()
if output == "": if output == '':
hs_enabled = False hs_enabled = False
hs_hostname = "Not Configured" hs_hostname = 'Not Configured'
hs_ports = "" hs_ports = ''
else: else:
hs_enabled = True hs_enabled = True
hs_info = output.split() hs_info = output.split()

View File

@ -56,16 +56,18 @@ body {
padding-left: 3em; padding-left: 3em;
} }
.circle { .running-status {
border-radius: 50%/50%; border-radius: 50%;
border: 1px solid black; border: 1px solid black;
width: 8px; width: 8px;
height: 8px; height: 8px;
display: inline-block; display: inline-block;
} }
.circle.active {
.running-status.active {
background-color: rgb(0, 167, 0); background-color: rgb(0, 167, 0);
} }
.circle.inactive {
.running-status.inactive {
background-color: rgb(228, 66, 66); background-color: rgb(228, 66, 66);
} }