mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
tor: Use app.html instead of simple_app.html
- Reuse status section. - Reuse configuration form. - Reuse internal zone section. - Cleanly split the page into status, internal zone and configuration blocks. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
167a4f5f8a
commit
05daf33ff8
@ -1,4 +1,4 @@
|
||||
{% extends "simple_app.html" %}
|
||||
{% extends "app.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of FreedomBox.
|
||||
@ -32,33 +32,16 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block configuration %}
|
||||
|
||||
{% include "clients.html" with clients=clients %}
|
||||
|
||||
<h3>{% trans "Status" %}</h3>
|
||||
|
||||
{% block status %}
|
||||
{% if config_running %}
|
||||
<h3>{% trans "Status" %}</h3>
|
||||
|
||||
<p class="running-status-parent">
|
||||
<span class="running-status loading"></span>
|
||||
{% trans "Tor configuration is being updated" %}
|
||||
</p>
|
||||
|
||||
{% else %}
|
||||
|
||||
<p class="running-status-parent">
|
||||
{% if status.is_running %}
|
||||
<span class="running-status active"></span>
|
||||
{% trans "Tor is running" %}
|
||||
{% else %}
|
||||
<span class="running-status inactive"></span>
|
||||
{% trans "Tor is not running" %}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
{% include "diagnostics_button.html" with module="tor" enabled=status.enabled %}
|
||||
{{ block.super }}
|
||||
|
||||
{% if status.hs_enabled %}
|
||||
<table class="table table-bordered table-condensed table-striped tor-hs">
|
||||
@ -80,19 +63,20 @@
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% include "internal-zone.html" %}
|
||||
{% block internal_zone %}
|
||||
{% if not config_running %}
|
||||
{{ block.super }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
<h3>{% trans "Configuration" %}</h3>
|
||||
{% block configuration %}
|
||||
|
||||
<form class="form form-configuration" method="post">
|
||||
{% csrf_token %}
|
||||
{% if not config_running %}
|
||||
|
||||
{{ form|bootstrap }}
|
||||
|
||||
<input type="submit" class="btn btn-primary btn-md"
|
||||
value="{% trans "Update setup" %}"/>
|
||||
</form>
|
||||
{{ block.super }}
|
||||
|
||||
{% if status.relay_enabled %}
|
||||
<h3>{% trans "Relay" %}</h3>
|
||||
|
||||
@ -53,13 +53,18 @@ def index(request):
|
||||
return TemplateResponse(
|
||||
request, 'tor.html', {
|
||||
'title': tor.name,
|
||||
'name': tor.name,
|
||||
'description': tor.description,
|
||||
'clients': tor.clients,
|
||||
'manual_page': tor.manual_page,
|
||||
'status': status,
|
||||
'config_running': bool(config_process),
|
||||
'form': form,
|
||||
'firewall': tor.app.get_components_of_type(Firewall)
|
||||
'firewall': tor.app.get_components_of_type(Firewall),
|
||||
'diagnostics_module_name': 'tor',
|
||||
'is_enabled': status['enabled'],
|
||||
'show_status_block': True,
|
||||
'is_running': status['is_running'],
|
||||
})
|
||||
|
||||
|
||||
@ -70,8 +75,9 @@ def _apply_changes(request, old_status, new_status):
|
||||
except ActionError as exception:
|
||||
messages.error(
|
||||
request,
|
||||
_('Action error: {0} [{1}] [{2}]').format(
|
||||
exception.args[0], exception.args[1], exception.args[2]))
|
||||
_('Action error: {0} [{1}] [{2}]').format(exception.args[0],
|
||||
exception.args[1],
|
||||
exception.args[2]))
|
||||
|
||||
|
||||
def __apply_changes(request, old_status, new_status):
|
||||
@ -131,8 +137,9 @@ def __apply_changes(request, old_status, new_status):
|
||||
else:
|
||||
tor.app.disable()
|
||||
|
||||
config_process = actions.superuser_run(
|
||||
'tor', ['configure'] + arguments, run_in_background=True)
|
||||
config_process = actions.superuser_run('tor',
|
||||
['configure'] + arguments,
|
||||
run_in_background=True)
|
||||
return
|
||||
|
||||
if arguments:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user