Fix jwt-token

This commit is contained in:
2025-09-17 22:43:44 +02:00
parent 43b548c05a
commit 6d66d8d772
8 changed files with 289 additions and 49 deletions

View File

@@ -65,16 +65,20 @@ class AlertService {
// Adjust threat level based on drone type and category
if (droneTypeInfo.category.includes('Military') && droneTypeInfo.name !== 'Unknown') {
// Special handling for known military drones at very far distances
// If it's a recognized military drone at long range, escalate to critical
if (rssi < -80 && (droneTypeInfo.name === 'Orlan' || droneTypeInfo.name === 'Zala' || droneTypeInfo.name === 'Eleron')) {
threatLevel = 'critical';
description = `CRITICAL THREAT: ${droneTypeInfo.name.toUpperCase()} DETECTED - IMMEDIATE RESPONSE REQUIRED`;
actionRequired = true;
console.log(`🚨 MILITARY DRONE DETECTED: ${droneTypeInfo.name} - Force escalating to CRITICAL at long range (RSSI: ${rssi})`);
// Special handling for known military drones - only escalate if not at extreme distance
if (rssi >= -85 && (droneTypeInfo.name === 'Orlan' || droneTypeInfo.name === 'Zala' || droneTypeInfo.name === 'Eleron')) {
// Military drones within reasonable detection range get escalated
if (distanceBasedThreat === 'monitoring') threatLevel = 'low';
else if (distanceBasedThreat === 'low') threatLevel = 'medium';
else if (distanceBasedThreat === 'medium') threatLevel = 'high';
else if (distanceBasedThreat === 'high') threatLevel = 'critical';
description = `MILITARY THREAT: ${droneTypeInfo.name.toUpperCase()} DETECTED - ENHANCED RESPONSE REQUIRED`;
actionRequired = (threatLevel !== 'low' && threatLevel !== 'monitoring');
console.log(`🚨 MILITARY DRONE DETECTED: ${droneTypeInfo.name} - Escalated to ${threatLevel} (RSSI: ${rssi})`);
} else {
// For closer military drones, preserve distance-based assessment but add annotation
description += ` - ${droneTypeInfo.name.toUpperCase()} MILITARY DRONE DETECTED`;
// For very distant military drones (RSSI < -85), preserve distance-based assessment
description += ` - ${droneTypeInfo.name.toUpperCase()} MILITARY DRONE DETECTED (DISTANT)`;
console.log(`🚨 MILITARY DRONE DETECTED: ${droneTypeInfo.name} - Using distance-based threat level: ${threatLevel} (RSSI: ${rssi})`);
}
} else if (droneTypeInfo.threat_level === 'high' || droneTypeInfo.category.includes('Professional')) {
@@ -752,7 +756,13 @@ class AlertService {
}
if (shouldTrigger) {
triggeredAlerts.push(rule);
triggeredAlerts.push({
rule_id: rule.id,
rule_name: rule.name,
rule: rule,
detection: detection,
triggered_at: new Date()
});
}
}