Harden embedded satellite dashboard loading

This commit is contained in:
James Smith
2026-03-18 23:00:21 +00:00
parent 62ee2252a3
commit a61d4331f0
3 changed files with 42 additions and 22 deletions

View File

@@ -509,7 +509,7 @@ def get_satellite_position():
for sat in sat_input:
sat_name, norad_id, tle_data = _resolve_satellite_request(sat, tracked_by_norad, tracked_by_name)
# Special handling for ISS - use real-time API for accurate position
# Special handling for ISS - prefer real-time API, but fall back to TLE if offline.
if norad_id == 25544 or sat_name == 'ISS':
iss_data = _fetch_iss_realtime(lat, lon)
if iss_data:

View File

@@ -1416,7 +1416,7 @@
<!-- Satellite Dashboard (Embedded) -->
<div id="satelliteVisuals" class="satellite-dashboard-embed" style="display: none;">
<iframe id="satelliteDashboardFrame" src="/satellite/dashboard?embedded=true" frameborder="0"
<iframe id="satelliteDashboardFrame" src="/satellite/dashboard?embedded=true&v={{ version }}" frameborder="0"
style="width: 100%; height: 100%; min-height: 700px; border: none; border-radius: 8px;"
allowfullscreen>
</iframe>

View File

@@ -602,6 +602,18 @@
let _txRequestId = 0;
let _telemetryPollTimer = null;
let _passRequestId = 0;
const BUILTIN_TX_FALLBACK = {
25544: [
{ description: 'APRS digipeater', downlink_low: 145.825, downlink_high: 145.825, uplink_low: null, uplink_high: null, mode: 'FM AX.25', baud: 1200, status: 'active', type: 'beacon', service: 'Packet' },
{ description: 'SSTV events', downlink_low: 145.800, downlink_high: 145.800, uplink_low: null, uplink_high: null, mode: 'FM', baud: null, status: 'active', type: 'image', service: 'SSTV' }
],
57166: [
{ description: 'Meteor LRPT weather downlink', downlink_low: 137.900, downlink_high: 137.900, uplink_low: null, uplink_high: null, mode: 'LRPT', baud: 72000, status: 'active', type: 'image', service: 'Weather' }
],
59051: [
{ description: 'Meteor LRPT weather downlink', downlink_low: 137.900, downlink_high: 137.900, uplink_low: null, uplink_high: null, mode: 'LRPT', baud: 72000, status: 'active', type: 'image', service: 'Weather' }
]
};
let satellites = {
25544: { name: 'ISS (ZARYA)', color: '#00ffff' },
@@ -1637,9 +1649,17 @@
const data = await r.json();
if (requestId !== _txRequestId) return;
if (data.status !== 'success') throw new Error('Unexpected response');
renderTransmitters(data.transmitters || []);
const txList = (data.transmitters && data.transmitters.length)
? data.transmitters
: (BUILTIN_TX_FALLBACK[noradId] || []);
renderTransmitters(txList);
} catch (e) {
if (requestId !== _txRequestId) return;
const fallback = BUILTIN_TX_FALLBACK[noradId] || [];
if (fallback.length) {
renderTransmitters(fallback);
return;
}
const timedOut = e && (e.name === 'AbortError' || String(e).includes('AbortError'));
container.innerHTML = `<div style="text-align:center;color:var(--text-secondary);padding:15px;font-size:11px;">${timedOut ? 'Timed out loading transmitter data' : 'Failed to load transmitter data'}</div>`;
if (countEl) countEl.textContent = '';