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 = []
|
alerts = []
|
||||||
warnings = []
|
warnings = []
|
||||||
for node in node_status:
|
for node in node_status:
|
||||||
|
node["class"] = "normal"
|
||||||
if not node["plain_dns"]:
|
if not node["plain_dns"]:
|
||||||
|
node["class"] = "error"
|
||||||
alerts.append(f"{node['name']} does not support plain DNS")
|
alerts.append(f"{node['name']} does not support plain DNS")
|
||||||
|
|
||||||
if not node["doh"]:
|
if not node["doh"]:
|
||||||
|
node["class"] = "error"
|
||||||
alerts.append(f"{node['name']} does not support DoH")
|
alerts.append(f"{node['name']} does not support DoH")
|
||||||
|
|
||||||
if not node["dot"]:
|
if not node["dot"]:
|
||||||
|
node["class"] = "error"
|
||||||
alerts.append(f"{node['name']} does not support DoT")
|
alerts.append(f"{node['name']} does not support DoT")
|
||||||
|
|
||||||
if not node["cert"]["valid"]:
|
if not node["cert"]["valid"]:
|
||||||
|
node["class"] = "error"
|
||||||
alerts.append(f"{node['name']} has an invalid certificate")
|
alerts.append(f"{node['name']} has an invalid certificate")
|
||||||
|
|
||||||
if not node["cert_853"]["valid"]:
|
if not node["cert_853"]["valid"]:
|
||||||
|
node["class"] = "error"
|
||||||
alerts.append(f"{node['name']} has an invalid certificate on port 853")
|
alerts.append(f"{node['name']} has an invalid certificate on port 853")
|
||||||
|
|
||||||
cert_expiry = datetime.strptime(
|
cert_expiry = datetime.strptime(
|
||||||
node["cert"]["expiry_date"], "%b %d %H:%M:%S %Y GMT"
|
node["cert"]["expiry_date"], "%b %d %H:%M:%S %Y GMT"
|
||||||
)
|
)
|
||||||
if cert_expiry < datetime.now():
|
if cert_expiry < datetime.now():
|
||||||
|
node["class"] = "error"
|
||||||
alerts.append(f"The {node['name']} node's certificate has expired")
|
alerts.append(f"The {node['name']} node's certificate has expired")
|
||||||
continue
|
continue
|
||||||
elif cert_expiry < datetime.now() + relativedelta.relativedelta(days=7):
|
elif cert_expiry < datetime.now() + relativedelta.relativedelta(days=7):
|
||||||
|
node["class"] = "warning"
|
||||||
warnings.append(
|
warnings.append(
|
||||||
f"The {node['name']} node's certificate is expiring {format_relative_time(cert_expiry)}"
|
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"
|
node["cert_853"]["expiry_date"], "%b %d %H:%M:%S %Y GMT"
|
||||||
)
|
)
|
||||||
if cert_853_expiry < datetime.now():
|
if cert_853_expiry < datetime.now():
|
||||||
|
node["class"] = "error"
|
||||||
alerts.append(
|
alerts.append(
|
||||||
f"The {node['name']} node's certificate has expired for DNS over TLS (port 853)"
|
f"The {node['name']} node's certificate has expired for DNS over TLS (port 853)"
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
elif cert_853_expiry < datetime.now() + relativedelta.relativedelta(days=7):
|
elif cert_853_expiry < datetime.now() + relativedelta.relativedelta(days=7):
|
||||||
|
node["class"] = "warning"
|
||||||
warnings.append(
|
warnings.append(
|
||||||
f"The {node['name']} node's certificate is expiring {format_relative_time(cert_853_expiry)} for DNS over TLS (port 853)"
|
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{
|
.node-info > p{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
.node.warning {
|
||||||
|
border-color: #FFA500;
|
||||||
|
}
|
||||||
|
.node.error {
|
||||||
|
border-color: #FF0000;
|
||||||
|
}
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
{% for node in nodes %}
|
{% for node in nodes %}
|
||||||
<div class="node">
|
<div class="node {{node.class}}">
|
||||||
<div>
|
<div>
|
||||||
<h2>{{node.location}}</h2>
|
<h2>{{node.location}}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user