1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { getCertificates } from "https://esm.town/v/agmm/sslCertificates";
import { blob } from "https://esm.town/v/std/blob";
import { email } from "https://esm.town/v/std/email";
export default async function(interval: Interval) {
const domain = "agmm.xyz";
const results = await getCertificates(domain);
const previousResults = await blob.getJSON("ssl_check");
await blob.setJSON("ssl_check", results);
console.log(results.domains, previousResults.domains);
if (!previousResults) {
return console.log("No previous results");
}
const message = `Certificate count change detected for ${domain}`;
if (results.certificates.length !== previousResults.certificates.length) {
console.log(message);
await email({ subject: message, text: message });
}
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 16, 2024