Notification (Telegram) for SSL notification thresholds

Ensure Telegram notifications respect warning/expiry thresholds, including manual checks.
This commit is contained in:
Tola Leng
2025-05-16 22:18:35 +08:00
parent 687619ce0d
commit 8ee933563e
4 changed files with 346 additions and 0 deletions
@@ -0,0 +1,27 @@
/**
* Check if SSL certificate daily check should run
* This helps implement the once-per-day check logic
*/
export function shouldRunDailyCheck(): boolean {
const lastRunKey = 'ssl_daily_check_last_run';
const lastRun = localStorage.getItem(lastRunKey);
if (!lastRun) {
// First time running, save timestamp and run
localStorage.setItem(lastRunKey, new Date().toISOString());
return true;
}
const lastRunDate = new Date(lastRun).setHours(0, 0, 0, 0);
const today = new Date().setHours(0, 0, 0, 0);
// If last run was not today, run again
if (lastRunDate < today) {
localStorage.setItem(lastRunKey, new Date().toISOString());
return true;
}
// Already ran today
return false;
}