diff --git a/plinth/modules/dynamicdns/templates/dynamicdns.html b/plinth/modules/dynamicdns/templates/dynamicdns.html index 2edab8afc..b66eba8c5 100644 --- a/plinth/modules/dynamicdns/templates/dynamicdns.html +++ b/plinth/modules/dynamicdns/templates/dynamicdns.html @@ -26,6 +26,38 @@ {% endblock %} +{% block extra_content %} +
+ {% 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 %} +
+ +{{ status.last_update }}
+{% endblock %} + {% block page_js %} {% endblock %} diff --git a/plinth/modules/dynamicdns/templates/dynamicdns_status.html b/plinth/modules/dynamicdns/templates/dynamicdns_status.html deleted file mode 100644 index f2560ed1f..000000000 --- a/plinth/modules/dynamicdns/templates/dynamicdns_status.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "app.html" %} -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load i18n %} - -{% block configuration %} -- {% 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 %} -
- -{{ last_update }}
- -{% endblock %} diff --git a/plinth/modules/dynamicdns/urls.py b/plinth/modules/dynamicdns/urls.py index f11cf911b..9ab63d297 100644 --- a/plinth/modules/dynamicdns/urls.py +++ b/plinth/modules/dynamicdns/urls.py @@ -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'), ] diff --git a/plinth/modules/dynamicdns/views.py b/plinth/modules/dynamicdns/views.py index ce07b173d..2a7b9ad2d 100644 --- a/plinth/modules/dynamicdns/views.py +++ b/plinth/modules/dynamicdns/views.py @@ -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):