Commit graph

9 commits

Author SHA1 Message Date
4a0a993e81 fix: Sanitize all innerHTML dynamic values to prevent XSS
Add centralized escapeHtml() utility and apply it to every dynamic value
inserted via innerHTML/template literals across the frontend. Data from
VRS JSON sources and external CSV files (airline names, countries) flows
through the backend as arbitrary strings that could contain HTML. While
Go's json.Marshal escapes < > &, JavaScript's JSON.parse reverses those
escapes before the values reach innerHTML — enabling script injection.

Affected modules: aircraft-manager, ui-manager, callsign-manager,
map-manager, and the 3D radar labels in app.js.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 15:21:56 +01:00
57e63975db fix: Sort sources alphabetically in UI for consistent display
Changed Sources list and dropdown to sort alphabetically by name instead of
dynamically by last data arrival time. This provides a stable, predictable
order that is less distracting during use.

- Modified updateSourcesLegend() in map-manager.js to sort sources by name
- Modified updateSourceFilter() in ui-manager.js to maintain consistent sorting
- Sources now use localeCompare() for proper alphabetical ordering

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 17:32:03 +02:00
978d1c0859 fix: Correct UTC and Last Update clock display issues
Fixes incorrect time calculations in the interface clocks:

UTC Clock Issues Fixed:
- Remove incorrect timezone offset addition that was causing wrong UTC display
- Use proper getUTCHours() and getUTCMinutes() methods directly on current time
- Ensure UTC clock shows actual UTC time for aviation coordination

Last Update Clock Issues Fixed:
- Stop using UTC methods for local "last update" time display
- Use getHours() and getMinutes() for proper local time representation
- Last update clock now shows meaningful local time when data was received

Technical Changes:
- Add useUTC parameter to updateClock() method for proper time zone handling
- Simplify time calculations by using appropriate Date methods
- Add clear comments explaining clock behavior and timezone usage

Expected Behavior:
- UTC clock displays current UTC time (aviation standard)
- Last update clock displays local time of most recent data update

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 11:19:02 +02:00
10508c2dc6 fix: Implement dynamic age calculation for aircraft tracking
Resolves issue #3 where aircraft age field was always showing 0 seconds.

Backend Changes:
- Fix MarshalJSON in merger.go to calculate age dynamically using time.Since(a.LastUpdate)
- Add comprehensive tests for age calculation in merger_test.go

Frontend Changes:
- Add calculateAge() utility method to both aircraft-manager.js and ui-manager.js
- Update popup content and aircraft table to use client-side age calculation
- Implement real-time age updates every second in app.js
- Add updateOpenPopupAges() function to refresh popup displays

Key Benefits:
- Aircraft age now shows actual seconds since last transmission
- Real-time updates in UI without requiring new WebSocket data
- Proper data staleness indicators for aviation tracking
- No additional server load - client-side calculation using last_update timestamp

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 10:29:35 +02:00
62ace55fe1 Implement transponder code (squawk) lookup and textual descriptions
Resolves #30

- Add comprehensive squawk code lookup database with emergency, standard, military, and special codes
- Implement squawk.Database with 20+ common transponder codes including:
  * Emergency codes: 7700 (General Emergency), 7600 (Radio Failure), 7500 (Hijacking)
  * Standard codes: 1200/7000 (VFR), operational codes by region
  * Special codes: 1277 (SAR), 1255 (Fire Fighting), military codes
- Add SquawkDescription field to Aircraft struct and JSON marshaling
- Integrate squawk database into merger for automatic description population
- Update frontend with color-coded squawk display and tooltips:
  * Red for emergency codes with warning symbols
  * Orange for special operations
  * Gray for military codes
  * Green for standard operational codes
- Add comprehensive test coverage for squawk lookup functionality

Features:
- Visual emergency code identification for safety
- Educational descriptions for aviation enthusiasts
- Configurable lookup system for regional variations
- Hover tooltips with full code explanations
- Graceful fallback for unknown codes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 12:02:02 +02:00
66a995b4d0 Fix issue #21 and add aircraft position tracking indicators
- Fix Debian package upgrade issue by separating upgrade vs remove behavior in prerm script
- Add aircraft position tracking statistics in merger GetStatistics() method
- Update frontend to display position tracking indicators in both header and stats view
- Format Go code to maintain consistency

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 11:25:42 +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
67d0e0612a Mark incomplete features as under construction and implement v0.0.2 release
- Mark incomplete statistics charts with construction notices
- Disable non-functional 3D radar controls
- Implement collapsible Display Options menu (defaults to collapsed)
- Add toast notifications for better error feedback
- Update version to 0.0.2 across all files and packages
- Improve Debian packaging with root-owner-group flag
- Update repository URLs to Forgejo instance
- Create comprehensive feature status documentation
- Created 10 detailed issues for all incomplete features (#5-#14)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 18:24:08 +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