diff --git a/src/stores/certs.ts b/src/stores/certs.ts new file mode 100644 index 0000000..ea3f8ee --- /dev/null +++ b/src/stores/certs.ts @@ -0,0 +1,30 @@ +import {writable} from "svelte/store"; + +export interface Cert { + id: number; + auto_renew: boolean; + active: boolean; + renewing: boolean; + renew_failed: boolean; + not_after: string; + updated_at: string; + domains: string[]; +} + +export function siteEqual(a: Cert | null, b: Cert | null) { + if (a == null || b == null) return false; + a.domains.sort(); + b.domains.sort(); + return ( + a.id == b.id && + a.auto_renew == b.auto_renew && + a.active == b.active && + a.renewing == b.renewing && + a.renew_failed == b.renew_failed && + a.not_after == b.not_after && + a.updated_at == b.updated_at && + JSON.stringify(a.domains) == JSON.stringify(b.domains) + ); +} + +export const certsTable = writable<{[key: string]: Cert}>({}); diff --git a/src/views/CertificatesView.svelte b/src/views/CertificatesView.svelte index 6c5f777..594107a 100644 --- a/src/views/CertificatesView.svelte +++ b/src/views/CertificatesView.svelte @@ -1 +1,122 @@ -
ID | +Auto Renew | +Active | +Renewing | +Renew Failed | +Not After | +Domains | +
---|---|---|---|---|---|---|
{cert.id} | +{cert.auto_renew} | +{cert.active} | +{cert.renewing} | +{cert.renew_failed} | +
+ {cert.not_after}
+ {Math.round((new Date(cert.not_after).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24))} days until expiry
+ |
+
+ {#each cert.domains as domain}
+ {domain}
+ {/each}
+ |
+