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'>
{% if is_running %}
<div class='circle active'></div> Tor is running
<div class='running-status active'></div> Tor is running
{% else %}
<div class='circle inactive'></div> Tor is not running
<div class='running-status inactive'></div> Tor is not running
{% endif %}
<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
recommends that you use
the <a href="https://www.torproject.org/download/download-easy.html.en">Tor
Browser Bundle</a>.</p>
Browser Bundle</a>.</p>
</div>

View File

@ -39,7 +39,7 @@ class TorForm(forms.Form): # pylint: disable=W0232
def init():
"""Initialize the Tor module"""
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
@ -71,10 +71,10 @@ def index(request):
def get_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")
port_info = output.split("\n")
output = actions.superuser_run('tor-get-ports')
port_info = output.split('\n')
ports = {}
for line in port_info:
try:
@ -83,12 +83,12 @@ def get_status():
except ValueError:
continue
output = actions.superuser_run("tor", ["get-hs"])
output = actions.superuser_run('tor', ['get-hs'])
output = output.strip()
if output == "":
if output == '':
hs_enabled = False
hs_hostname = "Not Configured"
hs_ports = ""
hs_hostname = 'Not Configured'
hs_ports = ''
else:
hs_enabled = True
hs_info = output.split()

View File

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