mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
dynamicdns: Drop tabs and use single page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
4705f1883f
commit
eac8f1f905
@ -26,6 +26,38 @@
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_content %}
|
||||
<h3>{% trans "Status" %}</h3>
|
||||
|
||||
<h4>{% trans "NAT type" %}</h4>
|
||||
|
||||
<p>
|
||||
{% if status.nat_unchecked %}
|
||||
{% blocktrans trimmed %}
|
||||
NAT type was not detected yet. If you do not provide an "IP Check
|
||||
URL", we will not detect a NAT type.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% if status.no_nat %}
|
||||
{% trans "Direct connection to the Internet." %}
|
||||
{% else %}
|
||||
{% blocktrans trimmed with timer=status.timer %}
|
||||
Behind NAT. This means that Dynamic DNS service will poll
|
||||
the "URL to look up public IP" for changes (the "URL to look
|
||||
up public IP" entry is needed for this, otherwise IP changes
|
||||
will not be detected). In case the WAN IP changes, it may
|
||||
take up to {{ timer }} minutes until your DNS entry is
|
||||
updated.
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<h4>{% trans "Last update" %}</h4>
|
||||
|
||||
<p>{{ status.last_update }}</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_js %}
|
||||
<script type="text/javascript" src="{% static 'dynamicdns/dynamicdns.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
{% extends "app.html" %}
|
||||
{% comment %}
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block configuration %}
|
||||
<h3>{% trans "NAT type" %}</h3>
|
||||
|
||||
<p>
|
||||
{% if nat_unchecked %}
|
||||
{% blocktrans trimmed %}
|
||||
NAT type was not detected yet. If you do not provide an "IP Check
|
||||
URL", we will not detect a NAT type.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% if no_nat %}
|
||||
{% trans "Direct connection to the Internet." %}
|
||||
{% else %}
|
||||
{% blocktrans trimmed %}
|
||||
Behind NAT. This means that Dynamic DNS service will poll
|
||||
the "URL to look up public IP" for changes (the "URL to look
|
||||
up public IP" entry is needed for this, otherwise IP changes
|
||||
will not be detected). In case the WAN IP changes, it may
|
||||
take up to {{ timer }} minutes until your DNS entry is
|
||||
updated.
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<h3>{% trans "Last update" %}</h3>
|
||||
|
||||
<p>{{ last_update }}</p>
|
||||
|
||||
{% endblock %}
|
||||
@ -9,6 +9,4 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
re_path(r'^sys/dynamicdns/$', views.index, name='index'),
|
||||
re_path(r'^sys/dynamicdns/statuspage/$', views.statuspage,
|
||||
name='statuspage'),
|
||||
]
|
||||
|
||||
@ -7,9 +7,7 @@ import logging
|
||||
|
||||
from django.contrib import messages
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import gettext_lazy
|
||||
|
||||
from plinth import actions
|
||||
from plinth.modules import dynamicdns
|
||||
@ -21,14 +19,6 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
EMPTYSTRING = 'none'
|
||||
|
||||
subsubmenu = [{
|
||||
'url': reverse_lazy('dynamicdns:index'),
|
||||
'text': gettext_lazy('Configure')
|
||||
}, {
|
||||
'url': reverse_lazy('dynamicdns:statuspage'),
|
||||
'text': gettext_lazy('Status')
|
||||
}]
|
||||
|
||||
|
||||
def index(request):
|
||||
"""Serve the configuration form."""
|
||||
@ -49,12 +39,12 @@ def index(request):
|
||||
'title': _('Configure Dynamic DNS'),
|
||||
'app_info': dynamicdns.app.info,
|
||||
'form': form,
|
||||
'subsubmenu': subsubmenu
|
||||
'status': get_status()
|
||||
})
|
||||
|
||||
|
||||
def statuspage(request):
|
||||
"""Serve the status page."""
|
||||
def get_status():
|
||||
"""Return the current status."""
|
||||
check_nat = _run(['get-nat'])
|
||||
last_update = _run(['get-last-success'])
|
||||
|
||||
@ -62,22 +52,12 @@ def statuspage(request):
|
||||
nat_unchecked = check_nat.strip() == 'unknown'
|
||||
timer = _run(['get-timer'])
|
||||
|
||||
if no_nat:
|
||||
logger.info('Not behind a NAT')
|
||||
|
||||
if nat_unchecked:
|
||||
logger.info('Did not check if behind a NAT')
|
||||
|
||||
return TemplateResponse(
|
||||
request, 'dynamicdns_status.html', {
|
||||
'title': _('Dynamic DNS Status'),
|
||||
'app_info': dynamicdns.app.info,
|
||||
'no_nat': no_nat,
|
||||
'nat_unchecked': nat_unchecked,
|
||||
'timer': timer,
|
||||
'last_update': last_update,
|
||||
'subsubmenu': subsubmenu
|
||||
})
|
||||
return {
|
||||
'no_nat': no_nat,
|
||||
'nat_unchecked': nat_unchecked,
|
||||
'timer': timer,
|
||||
'last_update': last_update,
|
||||
}
|
||||
|
||||
|
||||
def _apply_changes(request, old_status, new_status):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user