Commit graph

19 commits

Author SHA1 Message Date
2bffa2c418 style: Apply code formatting with go fmt
- Run 'make format' to ensure all Go code follows standard formatting
- Maintains consistent code style across the entire codebase
- No functional changes, only whitespace and formatting improvements
2025-09-01 10:05:29 +02:00
96f90b1543 feat: Enhance database status API with comprehensive information
- Add database file size, path, and modification timestamp to /api/database/status
- Include storage efficiency metrics and page statistics
- Add optimization statistics using database manager
- Import "os" package for file system operations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 19:39:56 +02:00
1fe15c06a3 Fix aircraft track propagation issues in web frontend
This commit addresses issue #23 where aircraft track changes were not
propagating properly to the web frontend. The fixes include:

**Server-side improvements:**
- Enhanced WebSocket broadcast reliability with timeout-based queueing
- Increased broadcast channel buffer size (1000 -> 2000)
- Improved error handling and connection management
- Added write timeouts to prevent slow clients from blocking updates
- Enhanced connection cleanup and ping/pong handling
- Added debug endpoint /api/debug/websocket for troubleshooting
- Relaxed position validation thresholds for better track acceptance

**Frontend improvements:**
- Enhanced WebSocket manager with exponential backoff reconnection
- Improved aircraft position update detection and logging
- Fixed position update logic to always propagate changes to map
- Better coordinate validation and error reporting
- Enhanced debugging with detailed console logging
- Fixed track rotation update thresholds and logic
- Improved marker lifecycle management and cleanup
- Better handling of edge cases in aircraft state transitions

**Key bug fixes:**
- Removed overly aggressive position change detection that blocked updates
- Fixed track rotation sensitivity (5° -> 10° threshold)
- Enhanced coordinate validation to handle null/undefined values
- Improved WebSocket message ordering and processing
- Fixed marker position updates to always propagate to Leaflet

These changes ensure reliable real-time aircraft tracking with proper
position, heading, and altitude updates across multiple data sources.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 10:14:03 +02:00
6414ea72f1 Add active WebSocket client tracking and display
Track and display the number of active WebSocket connections viewing the
aircraft tracker. Features:

Backend:
- Add getActiveClientCount() method for thread-safe client counting
- Include active_clients count in all statistics responses
- Integrate with existing stats API endpoints

Frontend:
- Display "X viewer(s)" in header stats with proper plural/singular grammar
- Add "Active Viewers" card to Statistics view
- Real-time updates as clients connect/disconnect
- Fallback to 1 when stats not yet available

This adds a social element showing "Now being watched by X users" style
information prominently in the interface.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 21:56:16 +02:00
d8b53167a2 Add health check endpoint for monitoring and load balancers
- Added /health endpoint for Caddy and other monitoring systems
- Returns JSON with service status, source connectivity, and metrics
- HTTP 200 when healthy, 503 when degraded (no active sources)
- Includes aircraft count, message count, and source status

Useful for:
- Load balancer health checks
- Service monitoring dashboards
- Automated alerting systems

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 20:20:46 +02:00
ba052312f2 Format and lint codebase for consistency and quality
- Run go fmt on all Go code (server.go formatting cleanup)
- Fix shellcheck issues in build-deb.sh script:
  - Replace indirect exit code checks ($?) with direct command checks
  - Use 'if ! command' instead of 'if [ $? -ne 0 ]'
  - Use 'if command' instead of 'if [ $? -eq 0 ]'
- All quality checks now pass:
  - go fmt:  Code properly formatted
  - go vet:  No issues found
  - shellcheck:  All shell scripts validated
  - go test:  No test failures (no tests yet)

Follows project guidelines for shell script validation and code quality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 18:52:39 +02:00
0d60592b9f Clean up codebase and fix server host binding for IPv6 support
Cleanup:
- Remove unused aircraft-icon.svg (replaced by type-specific icons)
- Remove test files: beast-dump-with-heli.bin, beast.test, main, old.json, ux.png
- Remove duplicate config.json.example (kept config.example.json)
- Remove empty internal/coverage/ directory
- Move CLAUDE.md to project root
- Update assets.go documentation to reflect current icon structure
- Format all Go code with gofmt

Server Host Binding Fix:
- Fix critical bug where server host configuration was ignored
- Add host parameter to Server struct and NewWebServer constructor
- Rename NewServer to NewWebServer for better clarity
- Fix IPv6 address formatting in server binding (wrap in brackets)
- Update startup message to show correct bind address format
- Support localhost-only, IPv4, IPv6, and interface-specific binding

This resolves the "too many colons in address" error for IPv6 hosts like ::1
and enables proper localhost-only deployment as configured.

Closes #15

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 18:36:14 +02:00
064ba2de71 Clean up and optimize codebase for production readiness
Performance & Reliability Improvements:
- Increase WebSocket buffer sizes from 1KB to 8KB for better throughput
- Increase broadcast channel buffer from 100 to 1000 messages
- Increase Beast message channel buffer from 1000 to 5000 messages
- Increase connection timeout from 10s to 30s for remote receivers

Code Quality Improvements:
- Remove debug output from production code (CPR Debug, Merger Update spam)
- Add MaxDistance constant to replace magic number (999999)
- Clean up comments for better maintainability
- Implement auto-enable for selected aircraft trails

Benefits:
- Much cleaner server logs without debug spam
- Better performance under high aircraft density
- More reliable WebSocket connections with larger buffers
- Improved fault tolerance with increased timeouts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 17:54:17 +02:00
1de3e092ae Fix aircraft markers not updating positions in real-time
Root cause: The merger was blocking position updates from the same source
after the first position was established, designed for multi-source scenarios
but preventing single-source position updates.

Changes:
- Refactor JavaScript into modular architecture (WebSocketManager, AircraftManager, MapManager, UIManager)
- Add CPR coordinate validation to prevent invalid latitude/longitude values
- Fix merger to allow position updates from same source for moving aircraft
- Add comprehensive coordinate bounds checking in CPR decoder
- Update HTML to use new modular JavaScript with cache busting
- Add WebSocket debug logging to track data flow

Technical details:
- CPR decoder now validates coordinates within ±90° latitude, ±180° longitude
- Merger allows updates when currentBest == sourceID (same source continuous updates)
- JavaScript modules provide better separation of concerns and debugging
- WebSocket properly transmits updated aircraft coordinates to frontend

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 14:04:17 +02:00
9ebc7e143e Clean up, format, lint and document entire codebase
Major cleanup and documentation effort:

Code Cleanup:
- Remove 668+ lines of dead code from legacy SBS-1 implementation
- Delete unused packages: internal/config, internal/parser, internal/client/dump1090
- Remove broken test file internal/server/server_test.go
- Remove unused struct fields and imports

Code Quality:
- Format all Go code with gofmt
- Fix all go vet issues
- Fix staticcheck linting issues (error capitalization, unused fields)
- Clean up module dependencies with go mod tidy

Documentation:
- Add comprehensive godoc documentation to all packages
- Document CPR position decoding algorithm with mathematical details
- Document multi-source data fusion strategies
- Add function/method documentation with parameters and return values
- Document error handling and recovery strategies
- Add performance considerations and architectural decisions

README Updates:
- Update project structure to reflect assets/ organization
- Add new features: smart origin, Reset Map button, map controls
- Document origin configuration in config examples
- Add /api/origin endpoint to API documentation
- Update REST endpoints with /api/aircraft/{icao}

Analysis:
- Analyzed adsb-tools and go-adsb for potential improvements
- Confirmed current Beast implementation is production-ready
- Identified optional enhancements for future consideration

The codebase is now clean, well-documented, and follows Go best practices
with zero linting issues and comprehensive documentation throughout.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 10:29:25 +02:00
1425f0a018 Restructure assets to top-level package and add Reset Map button
- Move assets from internal/assets to top-level assets/ package for clean embed directive
- Consolidate all static files in single location (assets/static/)
- Remove duplicate static file locations to maintain single source of truth
- Add Reset Map button to map controls with full functionality
- Implement resetMap() method to return map to calculated origin position
- Store origin in this.mapOrigin for reset functionality
- Fix go:embed pattern to work without parent directory references

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:57:49 +02:00
af9bf8ecac Fix map centering to use calculated origin
Backend Changes:
- Added OriginConfig struct to server package
- Modified NewServer to accept origin configuration
- Added /api/origin endpoint to serve origin data to frontend
- Updated main.go to pass origin configuration to server

Frontend Changes:
- Modified initializeMap() to fetch origin from API before map creation
- Updated initializeCoverageMap() to also use origin data
- Added fallback coordinates in case API request fails
- Maps now center on the calculated origin position instead of hardcoded coordinates

The map now properly centers on the calculated average position of enabled
sources (or manually configured origin), providing a much better user experience
with appropriate regional view.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:24:45 +02:00
559e1d23b9 Fix MIME type handling for static files
- Fixed static file path construction in staticFileHandler
- Removed duplicate 'static' prefix that was causing incorrect file paths
- Now properly serves CSS and JS files with correct MIME types
- Resolves browser security errors from MIME type mismatches

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 23:57:32 +02:00
7340a9d6eb Complete multi-source Beast format implementation
Major features implemented:
- Beast binary format parser with full Mode S/ADS-B decoding
- Multi-source data merger with intelligent signal-based fusion
- Advanced web frontend with 5 view modes (Map, Table, Stats, Coverage, 3D)
- Real-time WebSocket updates with sub-second latency
- Signal strength analysis and coverage heatmaps
- Debian packaging with systemd integration
- Production-ready deployment with security hardening

Technical highlights:
- Concurrent TCP clients with auto-reconnection
- CPR position decoding and aircraft identification
- Historical flight tracking with position trails
- Range circles and receiver location visualization
- Mobile-responsive design with professional UI
- REST API and WebSocket real-time updates
- Comprehensive build system and documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 23:51:37 +02:00
55710614da Add historical flight track functionality
- Store track history with position, altitude, speed, and timestamp
- Automatic track point collection every 30 seconds when position changes
- API endpoint /api/aircraft/{hex}/history for individual aircraft tracks
- Frontend "Show History" button to display historical flight paths
- Click aircraft markers to show their historical track (dashed red line)
- Track cleanup: keep last 200 points per aircraft, 24-hour retention
- Add aircraft type badges in table view with color coding
- Start/end markers for historical tracks with timestamps

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:52:16 +02:00
5c33bdacd2 Fix Chart.js loading and add favicon support
- Switch from chart.min.js to chart.umd.js for proper module loading
- Add favicon.ico file and proper serving
- Add favicon link in HTML head to prevent 404 errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:43:25 +02:00
704d0d2305 Fix static file serving with correct MIME types
- Correct embed file path construction in staticFileHandler
- Static files now served with proper Content-Type headers
- CSS files: text/css, JS files: text/javascript, SVG files: image/svg+xml
- Resolves browser MIME type mismatch errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:36:54 +02:00
df0ead2657 Fix MIME type handling for static files
- Add custom static file handler with proper Content-Type headers
- Fix CSS and JavaScript files being served as text/plain
- Add favicon handler to prevent 404 errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:14:19 +02:00
8ce4f4c397 Initial implementation of SkyView - ADS-B aircraft tracker
- Go application with embedded static files for dump1090 frontend
- TCP client for SBS-1/BaseStation format (port 30003)
- Real-time WebSocket updates with aircraft tracking
- Modern web frontend with Leaflet maps and mobile-responsive design
- Aircraft table with filtering/sorting and statistics dashboard
- Origin configuration for receiver location and distance calculations
- Automatic config.json loading from current directory
- Foreground execution by default with optional -daemon flag

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:09:37 +02:00