This commit is contained in:
Louis Lam 2023-09-17 02:40:08 +08:00
parent 33804d8823
commit ff51704cdf
2 changed files with 15 additions and 2 deletions

View file

@ -53,7 +53,7 @@ class Monitor extends BeanModel {
obj.tags = await this.getTags();
}
if (certExpiry && this.type === "http") {
if (certExpiry && this.type === "http" && this.getURLProtocol() === "https:") {
const { certExpiryDaysRemaining, validCert } = await this.getCertExpiry(this.id);
obj.certExpiryDaysRemaining = certExpiryDaysRemaining;
obj.validCert = validCert;
@ -1075,6 +1075,19 @@ class Monitor extends BeanModel {
}
}
/**
* Example: http: or https:
* @returns {(null|string)}
*/
getURLProtocol() {
const url = this.getUrl();
if (url) {
return this.getUrl().protocol;
} else {
return null;
}
}
/**
* Store TLS info to database
* @param checkCertificateResult