diff --git a/plinth/modules/dynamicdns/__init__.py b/plinth/modules/dynamicdns/__init__.py index 033ac3d4f..4e3630b4c 100644 --- a/plinth/modules/dynamicdns/__init__.py +++ b/plinth/modules/dynamicdns/__init__.py @@ -240,6 +240,20 @@ def get_status(): status = kvstore.get_default('dynamicdns_status', '{}') status = json.loads(status) status.setdefault('domains', {}) + + domains = get_config()['domains'] + for domain in domains: + if domain not in status['domains']: + # No status available for newly configured domain + status['domains'][domain] = { + 'domain': domain, + 'result': False, + 'ip_address': None, + 'error_code': None, + 'error_message': None, + 'timestamp': 0, + } + return status diff --git a/plinth/modules/dynamicdns/templates/dynamicdns.html b/plinth/modules/dynamicdns/templates/dynamicdns.html index 55a498fba..79f494ece 100644 --- a/plinth/modules/dynamicdns/templates/dynamicdns.html +++ b/plinth/modules/dynamicdns/templates/dynamicdns.html @@ -40,12 +40,20 @@ {{ domain.domain }} - {{ domain.timestamp|timesince }} + + {% if domain.timestamp %} + {{ domain.timestamp|timesince }} + {% else %} + {% trans "Not yet" %} + {% endif %} + {% if domain.result %} {% trans "Success" %} + {% elif not domain.timestamp %} + - {% else %} {% trans "Failed" %} diff --git a/plinth/modules/dynamicdns/views.py b/plinth/modules/dynamicdns/views.py index 0e4e48d38..5d688a333 100644 --- a/plinth/modules/dynamicdns/views.py +++ b/plinth/modules/dynamicdns/views.py @@ -44,7 +44,7 @@ class DynamicDNSAppView(views.AppView): # Create naive datetime object in local timezone domain['timestamp'] = datetime.datetime.fromtimestamp( - domain['timestamp']) + domain['timestamp']) if domain['timestamp'] else None domains_status[domain_name] = domain if domain['error_code'] in self._error_messages: domain['error_message'] = self._error_messages[