Fix jwt-token
This commit is contained in:
@@ -10,6 +10,7 @@ import json
|
||||
import time
|
||||
import random
|
||||
import math
|
||||
import argparse
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# Configuration
|
||||
@@ -260,6 +261,7 @@ class DroneSimulator:
|
||||
|
||||
def send_detection(detection_data):
|
||||
"""Send detection data to the API"""
|
||||
global DEBUG_MODE
|
||||
url = f"{API_BASE_URL}/detections"
|
||||
headers = {
|
||||
"Content-Type": "application/json"
|
||||
@@ -566,9 +568,14 @@ def test_api_health():
|
||||
return False
|
||||
|
||||
def main():
|
||||
global DEBUG_MODE
|
||||
|
||||
print("🚁 Realistic Drone Detection Simulator")
|
||||
print("=" * 50)
|
||||
|
||||
# Show current debug status
|
||||
print(f"🐛 Debug mode status: {'ENABLED' if DEBUG_MODE else 'DISABLED'}")
|
||||
|
||||
# Fetch devices from API first
|
||||
print("📡 Fetching active devices from API...")
|
||||
if not fetch_devices():
|
||||
@@ -584,6 +591,18 @@ def main():
|
||||
print("Cannot connect to API. Please check if the system is running.")
|
||||
return
|
||||
|
||||
# Debug mode configuration
|
||||
if not DEBUG_MODE: # Only ask if not already set via command line
|
||||
debug_choice = input("\n🐛 Enable debug mode? (y/N): ").strip().lower()
|
||||
if debug_choice in ['y', 'yes']:
|
||||
DEBUG_MODE = True
|
||||
print("✅ Debug mode ENABLED - Will show complete payloads being sent to backend")
|
||||
else:
|
||||
DEBUG_MODE = False
|
||||
print("ℹ️ Debug mode disabled")
|
||||
else:
|
||||
print("✅ Debug mode ALREADY ENABLED - Will show complete payloads being sent to backend")
|
||||
|
||||
print("\nChoose simulation type:")
|
||||
print("1. Realistic scenario (persistent drones, RSSI changes, movement)")
|
||||
print("2. Single approaching drone (watch RSSI strengthen)")
|
||||
@@ -618,4 +637,15 @@ def main():
|
||||
print("Invalid input")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Parse command line arguments
|
||||
parser = argparse.ArgumentParser(description='Realistic Drone Detection Simulator')
|
||||
parser.add_argument('--debug', '-d', action='store_true',
|
||||
help='Enable debug mode to show complete payloads sent to backend')
|
||||
args = parser.parse_args()
|
||||
|
||||
# Set debug mode from command line argument
|
||||
if args.debug:
|
||||
DEBUG_MODE = True
|
||||
print("🐛 Debug mode enabled via command line argument")
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user