mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
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:
parent
a660194308
commit
7e3bdfa49a
@ -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
|
||||
|
||||
|
||||
|
||||
@ -40,12 +40,20 @@
|
||||
{{ domain.domain }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ domain.timestamp|timesince }}</td>
|
||||
<td>
|
||||
{% if domain.timestamp %}
|
||||
{{ domain.timestamp|timesince }}
|
||||
{% else %}
|
||||
{% trans "Not yet" %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if domain.result %}
|
||||
<span class="badge text-bg-success">
|
||||
{% trans "Success" %}
|
||||
</span>
|
||||
{% elif not domain.timestamp %}
|
||||
-
|
||||
{% else %}
|
||||
<span class="badge text-bg-warning">
|
||||
{% trans "Failed" %}
|
||||
|
||||
@ -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[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user