fix: wrong certificate error
Massimo Melina committed
Jul 16, 2026 at 23:44 UTC
f2a3f6e2be426fcd5d7b6325f64ea8a1c945a617
1 file changed
+1
-1
src/listen.ts
+1
-1
@@ -133,7 +133,6 @@ const considerHttps = debounceAsync(async () => {
133
const cn = certObj.subject?.CN
134
if (cn)
135
console.log("Certificate loaded for", certObj.altNames?.join(' + ') || cn)
136
- const now = new Date()
136
const from = new Date(certObj.validFrom)
137
const to = new Date(certObj.validTo)
138
updateError() // error will change at from and to dates of the certificate
@@ -145,6 +144,7 @@ const considerHttps = debounceAsync(async () => {
144
})
145
function updateError() {
146
if (!httpsSrv) return
147
+ const now = new Date()
148
httpsSrv.error = from > now ? "certificate not valid yet" : to < now ? "certificate expired" : undefined
149
}
150
}