Fix notification email in case only expiry-TTL changes
This commit is contained in:
@@ -452,6 +452,7 @@ Templates use Jinja2 syntax. Available variables:
|
||||
| ipv6_changed | Boolean, IPv6 changed |
|
||||
| ipv6 | Current IPv6 address |
|
||||
| last_ipv6_update | Last IPv6 update time |
|
||||
| expiry_ttl_changed | Boolean, Expiry-TTL changed |
|
||||
| expiry_ttl | Expiry TTL in seconds |
|
||||
|
||||
**Expiry notification:**
|
||||
|
||||
@@ -7,3 +7,6 @@ IPv4 address: {{ipv4}} (changed at: {{last_ipv4_update}})
|
||||
{% if ipv6_changed %}
|
||||
IPv6 address: {{ipv6}} (changed at: {{last_ipv6_update}})
|
||||
{% endif %}
|
||||
{% if expiry_ttl_changed %}
|
||||
Expiry-TTL: {{expiry_ttl}}
|
||||
{% endif %}
|
||||
|
||||
@@ -98,7 +98,8 @@ class EmailService:
|
||||
email,
|
||||
hostname,
|
||||
ipv4_changed,
|
||||
ipv6_changed
|
||||
ipv6_changed,
|
||||
expiry_ttl_changed
|
||||
):
|
||||
"""
|
||||
Send hostname changed notification email.
|
||||
@@ -131,6 +132,7 @@ class EmailService:
|
||||
"ipv6_changed": ipv6_changed,
|
||||
"ipv6": hostname.last_ipv6,
|
||||
"last_ipv6_update": datetime_str(hostname.last_ipv6_update),
|
||||
"expiry_ttl_changed": expiry_ttl_changed,
|
||||
"expiry_ttl": hostname.expiry_ttl,
|
||||
}
|
||||
|
||||
|
||||
@@ -659,7 +659,8 @@ class DDNSRequestHandler(BaseHTTPRequestHandler):
|
||||
hostname.user.email,
|
||||
hostname,
|
||||
ipv4_changed,
|
||||
ipv6_changed
|
||||
ipv6_changed,
|
||||
expiry_ttl_changed
|
||||
)
|
||||
except Exception as e:
|
||||
logging.error(f"Sending change notification error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user