update: reasonable cert expiry limits

This commit is contained in:
nate 2026-04-08 13:34:01 +04:00
parent 2336f86aa3
commit 587442d034
1 changed files with 10 additions and 3 deletions

View File

@ -114,13 +114,20 @@
</div>
</div>
<%
const certDaysRaw = Number(monitor.cert_alert_days);
const certDaysSel = certDaysRaw === 0 ? '0'
: (certDaysRaw >= 1 && certDaysRaw <= 9) ? String(certDaysRaw)
: '7';
%>
<div>
<label class="block text-sm text-gray-400 mb-1.5">TLS cert expiry alert</label>
<select id="<%= prefix %>cert-alert-days" name="cert_alert_days"
class="w-full <%= bg %> border <%= border %> rounded-lg px-4 py-2.5 text-gray-100 focus:outline-none focus:border-blue-500">
<% [['0','Disabled'],['7','7 days before expiry'],['14','14 days before expiry'],['30','30 days before expiry'],['60','60 days before expiry']].forEach(function([val, label]) { %>
<option value="<%= val %>" <%= String(monitor.cert_alert_days ?? '14') === val ? 'selected' : '' %>><%= label %></option>
<% }) %>
<option value="0" <%= certDaysSel === '0' ? 'selected' : '' %>>Disabled</option>
<% for (let d = 1; d <= 9; d++) { const v = String(d); %>
<option value="<%= v %>" <%= certDaysSel === v ? 'selected' : '' %>><%= d %> day<%= d === 1 ? '' : 's' %> before expiry</option>
<% } %>
</select>
</div>