Merge branch 'smittix:main' into main

This commit is contained in:
Mitch Ross
2026-02-22 21:35:05 -05:00
committed by GitHub
7 changed files with 71 additions and 57 deletions
+2
View File
@@ -944,10 +944,12 @@ def stream_adsb():
@adsb_bp.route('/dashboard') @adsb_bp.route('/dashboard')
def adsb_dashboard(): def adsb_dashboard():
"""Popout ADS-B dashboard.""" """Popout ADS-B dashboard."""
embedded = request.args.get('embedded', 'false') == 'true'
return render_template( return render_template(
'adsb_dashboard.html', 'adsb_dashboard.html',
shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED, shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED,
adsb_auto_start=ADSB_AUTO_START, adsb_auto_start=ADSB_AUTO_START,
embedded=embedded,
) )
+2
View File
@@ -540,7 +540,9 @@ def get_vessel_dsc(mmsi: str):
@ais_bp.route('/dashboard') @ais_bp.route('/dashboard')
def ais_dashboard(): def ais_dashboard():
"""Popout AIS dashboard.""" """Popout AIS dashboard."""
embedded = request.args.get('embedded', 'false') == 'true'
return render_template( return render_template(
'ais_dashboard.html', 'ais_dashboard.html',
shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED, shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED,
embedded=embedded,
) )
+59 -57
View File
@@ -166,9 +166,11 @@ def _fetch_iss_realtime(observer_lat: Optional[float] = None, observer_lon: Opti
@satellite_bp.route('/dashboard') @satellite_bp.route('/dashboard')
def satellite_dashboard(): def satellite_dashboard():
"""Popout satellite tracking dashboard.""" """Popout satellite tracking dashboard."""
embedded = request.args.get('embedded', 'false') == 'true'
return render_template( return render_template(
'satellite_dashboard.html', 'satellite_dashboard.html',
shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED, shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED,
embedded=embedded,
) )
@@ -584,67 +586,67 @@ def list_tracked_satellites():
return jsonify({'status': 'success', 'satellites': sats}) return jsonify({'status': 'success', 'satellites': sats})
@satellite_bp.route('/tracked', methods=['POST']) @satellite_bp.route('/tracked', methods=['POST'])
def add_tracked_satellites_endpoint(): def add_tracked_satellites_endpoint():
"""Add one or more tracked satellites.""" """Add one or more tracked satellites."""
global _tle_cache global _tle_cache
data = request.get_json(silent=True) data = request.get_json(silent=True)
if not data: if not data:
return jsonify({'status': 'error', 'message': 'No data provided'}), 400 return jsonify({'status': 'error', 'message': 'No data provided'}), 400
# Accept a single satellite dict or a list # Accept a single satellite dict or a list
sat_list = data if isinstance(data, list) else [data] sat_list = data if isinstance(data, list) else [data]
normalized: list[dict] = [] normalized: list[dict] = []
for sat in sat_list: for sat in sat_list:
norad_id = str(sat.get('norad_id', sat.get('norad', ''))) norad_id = str(sat.get('norad_id', sat.get('norad', '')))
name = sat.get('name', '') name = sat.get('name', '')
if not norad_id or not name: if not norad_id or not name:
continue continue
tle1 = sat.get('tle_line1', sat.get('tle1')) tle1 = sat.get('tle_line1', sat.get('tle1'))
tle2 = sat.get('tle_line2', sat.get('tle2')) tle2 = sat.get('tle_line2', sat.get('tle2'))
enabled = sat.get('enabled', True) enabled = sat.get('enabled', True)
normalized.append({ normalized.append({
'norad_id': norad_id, 'norad_id': norad_id,
'name': name, 'name': name,
'tle_line1': tle1, 'tle_line1': tle1,
'tle_line2': tle2, 'tle_line2': tle2,
'enabled': bool(enabled), 'enabled': bool(enabled),
'builtin': False, 'builtin': False,
}) })
# Also inject into TLE cache if we have TLE data # Also inject into TLE cache if we have TLE data
if tle1 and tle2: if tle1 and tle2:
cache_key = name.replace(' ', '-').upper() cache_key = name.replace(' ', '-').upper()
_tle_cache[cache_key] = (name, tle1, tle2) _tle_cache[cache_key] = (name, tle1, tle2)
# Single inserts preserve previous behavior; list inserts use DB-level bulk path. # Single inserts preserve previous behavior; list inserts use DB-level bulk path.
if len(normalized) == 1: if len(normalized) == 1:
sat = normalized[0] sat = normalized[0]
added = 1 if add_tracked_satellite( added = 1 if add_tracked_satellite(
sat['norad_id'], sat['norad_id'],
sat['name'], sat['name'],
sat.get('tle_line1'), sat.get('tle_line1'),
sat.get('tle_line2'), sat.get('tle_line2'),
sat.get('enabled', True), sat.get('enabled', True),
sat.get('builtin', False), sat.get('builtin', False),
) else 0 ) else 0
else: else:
added = bulk_add_tracked_satellites(normalized) added = bulk_add_tracked_satellites(normalized)
response_payload = { response_payload = {
'status': 'success', 'status': 'success',
'added': added, 'added': added,
'processed': len(normalized), 'processed': len(normalized),
} }
# Returning all tracked satellites for very large imports can stall the UI. # Returning all tracked satellites for very large imports can stall the UI.
include_satellites = request.args.get('include_satellites', '').lower() == 'true' include_satellites = request.args.get('include_satellites', '').lower() == 'true'
if include_satellites or len(normalized) <= 32: if include_satellites or len(normalized) <= 32:
response_payload['satellites'] = get_tracked_satellites() response_payload['satellites'] = get_tracked_satellites()
return jsonify(response_payload) return jsonify(response_payload)
@satellite_bp.route('/tracked/<norad_id>', methods=['PUT']) @satellite_bp.route('/tracked/<norad_id>', methods=['PUT'])
+2
View File
@@ -54,8 +54,10 @@
</div> </div>
</header> </header>
{% if not embedded %}
{% set active_mode = 'adsb' %} {% set active_mode = 'adsb' %}
{% include 'partials/nav.html' with context %} {% include 'partials/nav.html' with context %}
{% endif %}
<!-- Slim Statistics Bar --> <!-- Slim Statistics Bar -->
<div class="stats-strip"> <div class="stats-strip">
+2
View File
@@ -54,8 +54,10 @@
</div> </div>
</header> </header>
{% if not embedded %}
{% set active_mode = 'ais' %} {% set active_mode = 'ais' %}
{% include 'partials/nav.html' with context %} {% include 'partials/nav.html' with context %}
{% endif %}
<div class="stats-strip"> <div class="stats-strip">
<div class="stats-strip-inner"> <div class="stats-strip-inner">
+2
View File
@@ -166,7 +166,9 @@
{% block navigation %} {% block navigation %}
{# Include the unified nav partial with active_mode set #} {# Include the unified nav partial with active_mode set #}
{% if not embedded %}
{% include 'partials/nav.html' with context %} {% include 'partials/nav.html' with context %}
{% endif %}
{% endblock %} {% endblock %}
{% block main %} {% block main %}
+2
View File
@@ -74,8 +74,10 @@
</div> </div>
</header> </header>
{% if not embedded %}
{% set active_mode = 'satellite' %} {% set active_mode = 'satellite' %}
{% include 'partials/nav.html' with context %} {% include 'partials/nav.html' with context %}
{% endif %}
<main class="dashboard"> <main class="dashboard">
<!-- Polar Plot --> <!-- Polar Plot -->