Show real tor status on homepage

This commit is contained in:
Taylor Helsper 2019-12-28 22:24:42 -06:00
parent 6964e3d828
commit efb87f3a4d
2 changed files with 22 additions and 13 deletions

View File

@ -207,6 +207,7 @@ def index():
elif status == STATE_STABLE: elif status == STATE_STABLE:
bitcoind_status_code = os.system("systemctl status bitcoind --no-pager") bitcoind_status_code = os.system("systemctl status bitcoind --no-pager")
lnd_status_code = os.system("systemctl status lnd --no-pager") lnd_status_code = os.system("systemctl status lnd --no-pager")
tor_status_color = "gray"
bitcoind_status_color = "red" bitcoind_status_color = "red"
lnd_status_color = "red" lnd_status_color = "red"
lnd_ready = is_lnd_ready() lnd_ready = is_lnd_ready()
@ -264,6 +265,13 @@ def index():
} }
return render_template('state.html', **templateData) return render_template('state.html', **templateData)
# Find tor status
status = os.system("systemctl status tor@default --no-pager")
if status != 0:
tor_status_color = "red"
else:
tor_status_color = "green"
# Find bitcoind status # Find bitcoind status
if bitcoind_status_code != 0: if bitcoind_status_code != 0:
bitcoind_status_color = "red" bitcoind_status_color = "red"
@ -393,6 +401,7 @@ def index():
"lnd_status_color": lnd_status_color, "lnd_status_color": lnd_status_color,
"lnd_status": Markup(lnd_status), "lnd_status": Markup(lnd_status),
"lnd_ready": lnd_ready, "lnd_ready": lnd_ready,
"tor_status_color": tor_status_color,
"electrs_status_color": electrs_status_color, "electrs_status_color": electrs_status_color,
"electrs_status": Markup(electrs_status), "electrs_status": Markup(electrs_status),
"electrs_enabled": is_electrs_enabled(), "electrs_enabled": is_electrs_enabled(),

View File

@ -37,6 +37,19 @@
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-electrs">{% if electrs_enabled %}Disable{% else %}Enable{% endif %}</a> <a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-electrs">{% if electrs_enabled %}Disable{% else %}Enable{% endif %}</a>
</div> </div>
</div> </div>
<div class="app_tile">
<div class="app_status_icon {{ tor_status_color }}"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/tor.png")}}"/></div>
<div class="app_title">Tor</div>
<div class="app_status">Private Connections</div>
<div class="app_contents">
{% if product_key_skipped %}
Remote Access Premium Feature
{% else %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="/tor">Tor Services</a>
{% endif %}
</div>
</div>
<div class="app_tile"> <div class="app_tile">
<div class="app_status_icon {{ vpn_status_color }}"></div> <div class="app_status_icon {{ vpn_status_color }}"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/vpn.png")}}"/></div> <div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/vpn.png")}}"/></div>
@ -53,19 +66,6 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="app_tile">
<div class="app_status_icon {% if product_key_skipped %}gray{% else %}green{% endif %}"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/tor.png")}}"/></div>
<div class="app_title">Tor Services</div>
<div class="app_status">Remote Access</div>
<div class="app_contents">
{% if product_key_skipped %}
Premium Feature
{% else %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="/tor">Tor Services</a>
{% endif %}
</div>
</div>
</div> </div>
</div> </div>
</div> </div>