mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +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 %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of FreedomBox.
|
# This file is part of FreedomBox.
|
||||||
@ -32,33 +32,16 @@
|
|||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block status %}
|
||||||
{% block configuration %}
|
|
||||||
|
|
||||||
{% include "clients.html" with clients=clients %}
|
|
||||||
|
|
||||||
<h3>{% trans "Status" %}</h3>
|
|
||||||
|
|
||||||
{% if config_running %}
|
{% if config_running %}
|
||||||
|
<h3>{% trans "Status" %}</h3>
|
||||||
|
|
||||||
<p class="running-status-parent">
|
<p class="running-status-parent">
|
||||||
<span class="running-status loading"></span>
|
<span class="running-status loading"></span>
|
||||||
{% trans "Tor configuration is being updated" %}
|
{% trans "Tor configuration is being updated" %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{{ block.super }}
|
||||||
<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 %}
|
|
||||||
|
|
||||||
{% if status.hs_enabled %}
|
{% if status.hs_enabled %}
|
||||||
<table class="table table-bordered table-condensed table-striped tor-hs">
|
<table class="table table-bordered table-condensed table-striped tor-hs">
|
||||||
@ -80,19 +63,20 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% 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">
|
{% if not config_running %}
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
{{ form|bootstrap }}
|
{{ block.super }}
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary btn-md"
|
|
||||||
value="{% trans "Update setup" %}"/>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% if status.relay_enabled %}
|
{% if status.relay_enabled %}
|
||||||
<h3>{% trans "Relay" %}</h3>
|
<h3>{% trans "Relay" %}</h3>
|
||||||
|
|||||||
@ -53,13 +53,18 @@ def index(request):
|
|||||||
return TemplateResponse(
|
return TemplateResponse(
|
||||||
request, 'tor.html', {
|
request, 'tor.html', {
|
||||||
'title': tor.name,
|
'title': tor.name,
|
||||||
|
'name': tor.name,
|
||||||
'description': tor.description,
|
'description': tor.description,
|
||||||
'clients': tor.clients,
|
'clients': tor.clients,
|
||||||
'manual_page': tor.manual_page,
|
'manual_page': tor.manual_page,
|
||||||
'status': status,
|
'status': status,
|
||||||
'config_running': bool(config_process),
|
'config_running': bool(config_process),
|
||||||
'form': form,
|
'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:
|
except ActionError as exception:
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
_('Action error: {0} [{1}] [{2}]').format(
|
_('Action error: {0} [{1}] [{2}]').format(exception.args[0],
|
||||||
exception.args[0], exception.args[1], exception.args[2]))
|
exception.args[1],
|
||||||
|
exception.args[2]))
|
||||||
|
|
||||||
|
|
||||||
def __apply_changes(request, old_status, new_status):
|
def __apply_changes(request, old_status, new_status):
|
||||||
@ -131,8 +137,9 @@ def __apply_changes(request, old_status, new_status):
|
|||||||
else:
|
else:
|
||||||
tor.app.disable()
|
tor.app.disable()
|
||||||
|
|
||||||
config_process = actions.superuser_run(
|
config_process = actions.superuser_run('tor',
|
||||||
'tor', ['configure'] + arguments, run_in_background=True)
|
['configure'] + arguments,
|
||||||
|
run_in_background=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if arguments:
|
if arguments:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user