feat: Change node border colours for warnings and errors
All checks were successful
Build Docker / BuildImage (push) Successful in 50s
All checks were successful
Build Docker / BuildImage (push) Successful in 50s
This commit is contained in:
parent
8a43526aab
commit
809a4f9d04
10
server.py
10
server.py
@ -749,28 +749,36 @@ def index():
|
||||
alerts = []
|
||||
warnings = []
|
||||
for node in node_status:
|
||||
node["class"] = "normal"
|
||||
if not node["plain_dns"]:
|
||||
node["class"] = "error"
|
||||
alerts.append(f"{node['name']} does not support plain DNS")
|
||||
|
||||
if not node["doh"]:
|
||||
node["class"] = "error"
|
||||
alerts.append(f"{node['name']} does not support DoH")
|
||||
|
||||
if not node["dot"]:
|
||||
node["class"] = "error"
|
||||
alerts.append(f"{node['name']} does not support DoT")
|
||||
|
||||
if not node["cert"]["valid"]:
|
||||
node["class"] = "error"
|
||||
alerts.append(f"{node['name']} has an invalid certificate")
|
||||
|
||||
if not node["cert_853"]["valid"]:
|
||||
node["class"] = "error"
|
||||
alerts.append(f"{node['name']} has an invalid certificate on port 853")
|
||||
|
||||
cert_expiry = datetime.strptime(
|
||||
node["cert"]["expiry_date"], "%b %d %H:%M:%S %Y GMT"
|
||||
)
|
||||
if cert_expiry < datetime.now():
|
||||
node["class"] = "error"
|
||||
alerts.append(f"The {node['name']} node's certificate has expired")
|
||||
continue
|
||||
elif cert_expiry < datetime.now() + relativedelta.relativedelta(days=7):
|
||||
node["class"] = "warning"
|
||||
warnings.append(
|
||||
f"The {node['name']} node's certificate is expiring {format_relative_time(cert_expiry)}"
|
||||
)
|
||||
@ -779,11 +787,13 @@ def index():
|
||||
node["cert_853"]["expiry_date"], "%b %d %H:%M:%S %Y GMT"
|
||||
)
|
||||
if cert_853_expiry < datetime.now():
|
||||
node["class"] = "error"
|
||||
alerts.append(
|
||||
f"The {node['name']} node's certificate has expired for DNS over TLS (port 853)"
|
||||
)
|
||||
continue
|
||||
elif cert_853_expiry < datetime.now() + relativedelta.relativedelta(days=7):
|
||||
node["class"] = "warning"
|
||||
warnings.append(
|
||||
f"The {node['name']} node's certificate is expiring {format_relative_time(cert_853_expiry)} for DNS over TLS (port 853)"
|
||||
)
|
||||
|
@ -21,4 +21,10 @@
|
||||
}
|
||||
.node-info > p{
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.node.warning {
|
||||
border-color: #FFA500;
|
||||
}
|
||||
.node.error {
|
||||
border-color: #FF0000;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
{% for node in nodes %}
|
||||
<div class="node">
|
||||
<div class="node {{node.class}}">
|
||||
<div>
|
||||
<h2>{{node.location}}</h2>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user