modified: server/openai.ts

modified:   server/websocket.ts
This commit is contained in:
MrPiglr 2025-12-23 21:41:48 +00:00
parent fc6308676e
commit 106253255a
2 changed files with 10 additions and 2 deletions

View file

@ -91,7 +91,15 @@ async function fetchRecentAlerts(): Promise<string> {
if (recentAlerts.length === 0) return "No recent security alerts."; if (recentAlerts.length === 0) return "No recent security alerts.";
return `RECENT ALERTS: return `RECENT ALERTS:
${recentAlerts.map(alert => `- ${alert.type}: ${alert.message} (${new Date(alert.created_at).toLocaleString()})`).join('\n')}`; ${recentAlerts.map(alert => {
let dateStr = 'unknown';
if (alert.created_at) {
try {
dateStr = new Date(alert.created_at).toLocaleString();
} catch {}
}
return `- ${alert.type}: ${alert.message} (${dateStr})`;
}).join('\n')}`;
} catch (error) { } catch (error) {
return "Alert system offline - potential network intrusion."; return "Alert system offline - potential network intrusion.";
} }

View file

@ -159,7 +159,7 @@ function startPeriodicUpdates(io: SocketIOServer) {
const alerts = await storage.getAlerts(); const alerts = await storage.getAlerts();
const newAlerts = alerts.filter(a => const newAlerts = alerts.filter(a =>
!a.is_resolved && !a.is_resolved &&
new Date(a.created_at) > lastAlertCheck a.created_at && !isNaN(new Date(a.created_at).getTime()) && new Date(a.created_at) > lastAlertCheck
); );
if (newAlerts.length > 0) { if (newAlerts.length > 0) {