dynamicdns: List domains that have not had status update yet

- This can happen if a domain is added while the app is disabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-01-17 14:37:55 -08:00 committed by James Valleroy
parent a660194308
commit 7e3bdfa49a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 24 additions and 2 deletions

View File

@ -240,6 +240,20 @@ def get_status():
status = kvstore.get_default('dynamicdns_status', '{}') status = kvstore.get_default('dynamicdns_status', '{}')
status = json.loads(status) status = json.loads(status)
status.setdefault('domains', {}) 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 return status

View File

@ -40,12 +40,20 @@
{{ domain.domain }} {{ domain.domain }}
</a> </a>
</td> </td>
<td>{{ domain.timestamp|timesince }}</td> <td>
{% if domain.timestamp %}
{{ domain.timestamp|timesince }}
{% else %}
{% trans "Not yet" %}
{% endif %}
</td>
<td> <td>
{% if domain.result %} {% if domain.result %}
<span class="badge text-bg-success"> <span class="badge text-bg-success">
{% trans "Success" %} {% trans "Success" %}
</span> </span>
{% elif not domain.timestamp %}
-
{% else %} {% else %}
<span class="badge text-bg-warning"> <span class="badge text-bg-warning">
{% trans "Failed" %} {% trans "Failed" %}

View File

@ -44,7 +44,7 @@ class DynamicDNSAppView(views.AppView):
# Create naive datetime object in local timezone # Create naive datetime object in local timezone
domain['timestamp'] = datetime.datetime.fromtimestamp( domain['timestamp'] = datetime.datetime.fromtimestamp(
domain['timestamp']) domain['timestamp']) if domain['timestamp'] else None
domains_status[domain_name] = domain domains_status[domain_name] = domain
if domain['error_code'] in self._error_messages: if domain['error_code'] in self._error_messages:
domain['error_message'] = self._error_messages[ domain['error_message'] = self._error_messages[