Fix jwt-token

This commit is contained in:
2025-09-15 12:30:00 +02:00
parent 64a5229025
commit e609cc4541
3 changed files with 74 additions and 38 deletions

View File

@@ -9,7 +9,7 @@ const DRONE_TYPES = {
0: {
name: "None",
category: "Unknown",
threat_level: "monitoring",
threat_level: "low",
description: "No drone detected or signal below threshold"
},
1: {
@@ -49,45 +49,45 @@ const DRONE_TYPES = {
description: "Russian kamikaze loitering munition"
},
7: {
name: "FPV CrossFire",
name: "FPV_CrossFire",
category: "FPV/Racing",
threat_level: "high",
threat_level: "low",
description: "FPV drone using CrossFire protocol"
},
8: {
name: "FPV ELRS",
name: "FPV_ELRS",
category: "FPV/Racing",
threat_level: "high",
threat_level: "low",
description: "FPV drone using ExpressLRS protocol"
},
9: {
name: "Maybe Orlan",
category: "Military/Reconnaissance",
category: "Military/Reconnaissance/Probable",
threat_level: "high",
description: "Possible Orlan drone (uncertain identification)"
},
10: {
name: "Maybe Zala",
category: "Military/Surveillance",
category: "Military/Surveillance/Probable",
threat_level: "high",
description: "Possible Zala drone (uncertain identification)"
},
11: {
name: "Maybe Lancet",
category: "Military/Kamikaze",
category: "Military/Kamikaze/Probable",
threat_level: "high",
description: "Possible Lancet drone (uncertain identification)"
},
12: {
name: "Maybe Eleron",
category: "Military/Tactical",
category: "Military/Tactical/Probable",
threat_level: "high",
description: "Possible Eleron drone (uncertain identification)"
},
13: {
name: "DJI",
category: "Commercial/Professional",
threat_level: "medium",
threat_level: "low",
description: "DJI consumer/commercial drone"
},
14: {
@@ -98,18 +98,18 @@ const DRONE_TYPES = {
},
15: {
name: "Maybe Supercam",
category: "Military/Surveillance",
category: "Military/Surveillance/Probable",
threat_level: "high",
description: "Possible Supercam drone (uncertain identification)"
},
16: {
name: "REB",
category: "Military/Electronic Warfare",
threat_level: "critical",
threat_level: "high",
description: "Russian Electronic Warfare (REB) drone"
},
17: {
name: "Crypto Orlan",
name: "CryptoOrlan",
category: "Military/Reconnaissance",
threat_level: "critical",
description: "Encrypted Orlan drone with enhanced security"
@@ -140,7 +140,7 @@ function getDroneTypeInfo(droneTypeId) {
// Return default for unknown types
return {
id: droneTypeId,
name: `Unknown Type ${droneTypeId}`,
name: "Unknown",
category: "Unknown/Unclassified",
threat_level: "medium",
description: `Unrecognized drone type ID: ${droneTypeId}`
@@ -186,11 +186,27 @@ function getDroneTypesByThreatLevel(threatLevel) {
.map(([id, info]) => ({ id: parseInt(id), ...info }));
}
/**
* Check if a drone type ID is valid
* @param {number} droneTypeId - The integer drone type ID
* @returns {boolean} True if valid, false otherwise
*/
function isValidDroneType(droneTypeId) {
// Handle string inputs
if (typeof droneTypeId === 'string') {
droneTypeId = parseInt(droneTypeId);
}
// Check if it's a valid number and exists in our mapping
return Number.isInteger(droneTypeId) && DRONE_TYPES.hasOwnProperty(droneTypeId);
}
module.exports = {
DRONE_TYPES,
getDroneTypeInfo,
getDroneTypeName,
getAllDroneTypes,
getDroneTypesByCategory,
getDroneTypesByThreatLevel
getDroneTypesByThreatLevel,
isValidDroneType
};