mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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>
|
</form>
|
||||||
{% endblock %}
|
{% 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 %}
|
{% block page_js %}
|
||||||
<script type="text/javascript" src="{% static 'dynamicdns/dynamicdns.js' %}"></script>
|
<script type="text/javascript" src="{% static 'dynamicdns/dynamicdns.js' %}"></script>
|
||||||
{% endblock %}
|
{% 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 = [
|
urlpatterns = [
|
||||||
re_path(r'^sys/dynamicdns/$', views.index, name='index'),
|
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.contrib import messages
|
||||||
from django.template.response import TemplateResponse
|
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 as _
|
||||||
from django.utils.translation import gettext_lazy
|
|
||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth.modules import dynamicdns
|
from plinth.modules import dynamicdns
|
||||||
@ -21,14 +19,6 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
EMPTYSTRING = 'none'
|
EMPTYSTRING = 'none'
|
||||||
|
|
||||||
subsubmenu = [{
|
|
||||||
'url': reverse_lazy('dynamicdns:index'),
|
|
||||||
'text': gettext_lazy('Configure')
|
|
||||||
}, {
|
|
||||||
'url': reverse_lazy('dynamicdns:statuspage'),
|
|
||||||
'text': gettext_lazy('Status')
|
|
||||||
}]
|
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Serve the configuration form."""
|
"""Serve the configuration form."""
|
||||||
@ -49,12 +39,12 @@ def index(request):
|
|||||||
'title': _('Configure Dynamic DNS'),
|
'title': _('Configure Dynamic DNS'),
|
||||||
'app_info': dynamicdns.app.info,
|
'app_info': dynamicdns.app.info,
|
||||||
'form': form,
|
'form': form,
|
||||||
'subsubmenu': subsubmenu
|
'status': get_status()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def statuspage(request):
|
def get_status():
|
||||||
"""Serve the status page."""
|
"""Return the current status."""
|
||||||
check_nat = _run(['get-nat'])
|
check_nat = _run(['get-nat'])
|
||||||
last_update = _run(['get-last-success'])
|
last_update = _run(['get-last-success'])
|
||||||
|
|
||||||
@ -62,22 +52,12 @@ def statuspage(request):
|
|||||||
nat_unchecked = check_nat.strip() == 'unknown'
|
nat_unchecked = check_nat.strip() == 'unknown'
|
||||||
timer = _run(['get-timer'])
|
timer = _run(['get-timer'])
|
||||||
|
|
||||||
if no_nat:
|
return {
|
||||||
logger.info('Not behind a NAT')
|
'no_nat': no_nat,
|
||||||
|
'nat_unchecked': nat_unchecked,
|
||||||
if nat_unchecked:
|
'timer': timer,
|
||||||
logger.info('Did not check if behind a NAT')
|
'last_update': last_update,
|
||||||
|
}
|
||||||
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
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def _apply_changes(request, old_status, new_status):
|
def _apply_changes(request, old_status, new_status):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user