1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-15 19:15:24 +00:00

🐛 Expiry date is stored when cert IDs match - fixes #39

This commit is contained in:
makeworld 2020-07-03 20:32:37 -04:00
parent 92eb544b0a
commit 4382eaf421
2 changed files with 11 additions and 5 deletions

View File

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Link and heading lines are wrapped just like regular text lines
- Wrapped list items are indented to stay behind the bullet (#35)
- Certificate expiry date is stored when the cert IDs match (#39)
### Changed
- Pages are rewrapped dynamically, whenever the terminal size changes (#33)

View File

@ -85,13 +85,13 @@ func handleTofu(domain, port string, cert *x509.Certificate) bool {
saveTofuEntry(domain, port, cert)
return true
}
if time.Now().After(expiry) {
// Old cert expired, so anything is valid
saveTofuEntry(domain, port, cert)
return true
}
if certID(cert) == id {
// Same cert as the one stored
// Store expiry again in case it changed
tofuStore.Set(expiryKey(domain, port), cert.NotAfter.UTC())
tofuStore.WriteConfig()
return true
}
if origCertID(cert) == id {
@ -99,6 +99,11 @@ func handleTofu(domain, port string, cert *x509.Certificate) bool {
saveTofuEntry(domain, port, cert)
return true
}
if time.Now().After(expiry) {
// Old cert expired, so anything is valid
saveTofuEntry(domain, port, cert)
return true
}
return false
}