Merge branch 'upstream-shared-observer-location'

This commit is contained in:
Smittix
2026-01-30 22:52:17 +00:00
16 changed files with 581 additions and 250 deletions
+53 -12
View File
@@ -63,18 +63,59 @@ cd intercept
docker compose up -d docker compose up -d
``` ```
> **Note:** Docker requires privileged mode for USB SDR access. See `docker-compose.yml` for configuration options. > **Note:** Docker requires privileged mode for USB SDR access. See `docker-compose.yml` for configuration options.
### ADS-B History (Optional) ### ADS-B History (Optional)
The ADS-B history feature persists aircraft messages to Postgres for long-term analysis. The ADS-B history feature persists aircraft messages to Postgres for long-term analysis.
```bash ```bash
# Start with ADS-B history and Postgres # Start with ADS-B history and Postgres
docker compose --profile history up -d docker compose --profile history up -d
``` ```
Then open **/adsb/history** for the reporting dashboard. Set the following environment variables (for example in a `.env` file):
```bash
INTERCEPT_ADSB_HISTORY_ENABLED=true
INTERCEPT_ADSB_DB_HOST=adsb_db
INTERCEPT_ADSB_DB_PORT=5432
INTERCEPT_ADSB_DB_NAME=intercept_adsb
INTERCEPT_ADSB_DB_USER=intercept
INTERCEPT_ADSB_DB_PASSWORD=intercept
```
### Other ADS-B Settings
Set these as environment variables for either local installs or Docker:
| Variable | Default | Description |
|----------|---------|-------------|
| `INTERCEPT_ADSB_AUTO_START` | `false` | Auto-start ADS-B tracking when the dashboard loads |
| `INTERCEPT_SHARED_OBSERVER_LOCATION` | `true` | Share observer location across ADS-B/AIS/SSTV/Satellite modules |
**Local install example**
```bash
INTERCEPT_ADSB_AUTO_START=true \
INTERCEPT_SHARED_OBSERVER_LOCATION=false \
python app.py
```
**Docker example (.env)**
```bash
INTERCEPT_ADSB_AUTO_START=true
INTERCEPT_SHARED_OBSERVER_LOCATION=false
```
To store Postgres data on external storage, set `PGDATA_PATH` (defaults to `./pgdata`):
```bash
PGDATA_PATH=/mnt/usbpi1/intercept/pgdata
```
Then open **/adsb/history** for the reporting dashboard.
### Open the Interface ### Open the Interface
+17 -10
View File
@@ -27,7 +27,7 @@ from typing import Any
from flask import Flask, render_template, jsonify, send_file, Response, request,redirect, url_for, flash, session from flask import Flask, render_template, jsonify, send_file, Response, request,redirect, url_for, flash, session
from werkzeug.security import check_password_hash from werkzeug.security import check_password_hash
from config import VERSION, CHANGELOG from config import VERSION, CHANGELOG, SHARED_OBSERVER_LOCATION_ENABLED
from utils.dependencies import check_tool, check_all_dependencies, TOOL_DEPENDENCIES from utils.dependencies import check_tool, check_all_dependencies, TOOL_DEPENDENCIES
from utils.process import cleanup_stale_processes from utils.process import cleanup_stale_processes
from utils.sdr import SDRFactory from utils.sdr import SDRFactory
@@ -271,15 +271,22 @@ def login():
return render_template('login.html', version=VERSION) return render_template('login.html', version=VERSION)
@app.route('/') @app.route('/')
def index() -> str: def index() -> str:
tools = { tools = {
'rtl_fm': check_tool('rtl_fm'), 'rtl_fm': check_tool('rtl_fm'),
'multimon': check_tool('multimon-ng'), 'multimon': check_tool('multimon-ng'),
'rtl_433': check_tool('rtl_433'), 'rtl_433': check_tool('rtl_433'),
'rtlamr': check_tool('rtlamr') 'rtlamr': check_tool('rtlamr')
} }
devices = [d.to_dict() for d in SDRFactory.detect_devices()] devices = [d.to_dict() for d in SDRFactory.detect_devices()]
return render_template('index.html', tools=tools, devices=devices, version=VERSION, changelog=CHANGELOG) return render_template(
'index.html',
tools=tools,
devices=devices,
version=VERSION,
changelog=CHANGELOG,
shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED,
)
@app.route('/favicon.svg') @app.route('/favicon.svg')
+16 -12
View File
@@ -136,23 +136,27 @@ AIRODUMP_HEADER_LINES = _get_env_int('AIRODUMP_HEADER_LINES', 2)
BT_SCAN_TIMEOUT = _get_env_int('BT_SCAN_TIMEOUT', 10) BT_SCAN_TIMEOUT = _get_env_int('BT_SCAN_TIMEOUT', 10)
BT_UPDATE_INTERVAL = _get_env_float('BT_UPDATE_INTERVAL', 2.0) BT_UPDATE_INTERVAL = _get_env_float('BT_UPDATE_INTERVAL', 2.0)
# ADS-B settings # ADS-B settings
ADSB_SBS_PORT = _get_env_int('ADSB_SBS_PORT', 30003) ADSB_SBS_PORT = _get_env_int('ADSB_SBS_PORT', 30003)
ADSB_UPDATE_INTERVAL = _get_env_float('ADSB_UPDATE_INTERVAL', 1.0) ADSB_UPDATE_INTERVAL = _get_env_float('ADSB_UPDATE_INTERVAL', 1.0)
ADSB_HISTORY_ENABLED = _get_env_bool('ADSB_HISTORY_ENABLED', False) ADSB_AUTO_START = _get_env_bool('ADSB_AUTO_START', False)
ADSB_HISTORY_ENABLED = _get_env_bool('ADSB_HISTORY_ENABLED', False)
ADSB_DB_HOST = _get_env('ADSB_DB_HOST', 'localhost') ADSB_DB_HOST = _get_env('ADSB_DB_HOST', 'localhost')
ADSB_DB_PORT = _get_env_int('ADSB_DB_PORT', 5432) ADSB_DB_PORT = _get_env_int('ADSB_DB_PORT', 5432)
ADSB_DB_NAME = _get_env('ADSB_DB_NAME', 'intercept_adsb') ADSB_DB_NAME = _get_env('ADSB_DB_NAME', 'intercept_adsb')
ADSB_DB_USER = _get_env('ADSB_DB_USER', 'intercept') ADSB_DB_USER = _get_env('ADSB_DB_USER', 'intercept')
ADSB_DB_PASSWORD = _get_env('ADSB_DB_PASSWORD', 'intercept') ADSB_DB_PASSWORD = _get_env('ADSB_DB_PASSWORD', 'intercept')
ADSB_HISTORY_BATCH_SIZE = _get_env_int('ADSB_HISTORY_BATCH_SIZE', 500) ADSB_HISTORY_BATCH_SIZE = _get_env_int('ADSB_HISTORY_BATCH_SIZE', 500)
ADSB_HISTORY_FLUSH_INTERVAL = _get_env_float('ADSB_HISTORY_FLUSH_INTERVAL', 1.0) ADSB_HISTORY_FLUSH_INTERVAL = _get_env_float('ADSB_HISTORY_FLUSH_INTERVAL', 1.0)
ADSB_HISTORY_QUEUE_SIZE = _get_env_int('ADSB_HISTORY_QUEUE_SIZE', 50000) ADSB_HISTORY_QUEUE_SIZE = _get_env_int('ADSB_HISTORY_QUEUE_SIZE', 50000)
# Satellite settings # Observer location settings
SATELLITE_UPDATE_INTERVAL = _get_env_int('SATELLITE_UPDATE_INTERVAL', 30) SHARED_OBSERVER_LOCATION_ENABLED = _get_env_bool('SHARED_OBSERVER_LOCATION', True)
SATELLITE_TRAJECTORY_POINTS = _get_env_int('SATELLITE_TRAJECTORY_POINTS', 30)
SATELLITE_ORBIT_MINUTES = _get_env_int('SATELLITE_ORBIT_MINUTES', 45) # Satellite settings
SATELLITE_UPDATE_INTERVAL = _get_env_int('SATELLITE_UPDATE_INTERVAL', 30)
SATELLITE_TRAJECTORY_POINTS = _get_env_int('SATELLITE_TRAJECTORY_POINTS', 30)
SATELLITE_ORBIT_MINUTES = _get_env_int('SATELLITE_ORBIT_MINUTES', 45)
# Update checking # Update checking
GITHUB_REPO = _get_env('GITHUB_REPO', 'smittix/intercept') GITHUB_REPO = _get_env('GITHUB_REPO', 'smittix/intercept')
+8
View File
@@ -36,6 +36,10 @@ services:
# - INTERCEPT_ADSB_DB_NAME=intercept_adsb # - INTERCEPT_ADSB_DB_NAME=intercept_adsb
# - INTERCEPT_ADSB_DB_USER=intercept # - INTERCEPT_ADSB_DB_USER=intercept
# - INTERCEPT_ADSB_DB_PASSWORD=intercept # - INTERCEPT_ADSB_DB_PASSWORD=intercept
# ADS-B auto-start on dashboard load (default false)
- INTERCEPT_ADSB_AUTO_START=${INTERCEPT_ADSB_AUTO_START:-false}
# Shared observer location across modules
- INTERCEPT_SHARED_OBSERVER_LOCATION=${INTERCEPT_SHARED_OBSERVER_LOCATION:-true}
# Network mode for WiFi scanning (requires host network) # Network mode for WiFi scanning (requires host network)
# network_mode: host # network_mode: host
restart: unless-stopped restart: unless-stopped
@@ -68,6 +72,10 @@ services:
- INTERCEPT_ADSB_DB_NAME=intercept_adsb - INTERCEPT_ADSB_DB_NAME=intercept_adsb
- INTERCEPT_ADSB_DB_USER=intercept - INTERCEPT_ADSB_DB_USER=intercept
- INTERCEPT_ADSB_DB_PASSWORD=intercept - INTERCEPT_ADSB_DB_PASSWORD=intercept
# ADS-B auto-start on dashboard load (default false)
- INTERCEPT_ADSB_AUTO_START=${INTERCEPT_ADSB_AUTO_START:-false}
# Shared observer location across modules
- INTERCEPT_SHARED_OBSERVER_LOCATION=${INTERCEPT_SHARED_OBSERVER_LOCATION:-true}
restart: unless-stopped restart: unless-stopped
healthcheck: healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:5050/health"] test: ["CMD", "curl", "-sf", "http://localhost:5050/health"]
+76 -43
View File
@@ -61,55 +61,88 @@ INTERCEPT automatically detects known trackers:
1. **Select Hardware** - Choose your SDR type (RTL-SDR uses dump1090, others use readsb) 1. **Select Hardware** - Choose your SDR type (RTL-SDR uses dump1090, others use readsb)
2. **Check Tools** - Ensure dump1090 or readsb is installed 2. **Check Tools** - Ensure dump1090 or readsb is installed
3. **Set Location** - Choose location source: 3. **Set Location** - Choose location source:
- **Manual Entry** - Type coordinates directly - **Manual Entry** - Type coordinates directly
- **Browser GPS** - Use browser's built-in geolocation (requires HTTPS) - **Browser GPS** - Use browser's built-in geolocation (requires HTTPS)
- **USB GPS Dongle** - Connect a USB GPS receiver for continuous updates - **USB GPS Dongle** - Connect a USB GPS receiver for continuous updates
4. **Start Tracking** - Click "Start Tracking" to begin ADS-B reception - **Shared Location** - By default, the observer location is shared across modules
5. **View Map** - Aircraft appear on the interactive Leaflet map (disable with `INTERCEPT_SHARED_OBSERVER_LOCATION=false`)
4. **Start Tracking** - Click "Start Tracking" to begin ADS-B reception
5. **View Map** - Aircraft appear on the interactive Leaflet map
6. **Click Aircraft** - Click markers for detailed information 6. **Click Aircraft** - Click markers for detailed information
7. **Display Options** - Toggle callsigns, altitude, trails, range rings, clustering 7. **Display Options** - Toggle callsigns, altitude, trails, range rings, clustering
8. **Filter Aircraft** - Use dropdown to show all, military, civil, or emergency only 8. **Filter Aircraft** - Use dropdown to show all, military, civil, or emergency only
9. **Full Dashboard** - Click "Full Screen Dashboard" for dedicated radar view 9. **Full Dashboard** - Click "Full Screen Dashboard" for dedicated radar view
> Note: ADS-B auto-start is disabled by default. To enable auto-start on dashboard load,
> set `INTERCEPT_ADSB_AUTO_START=true`.
### Emergency Squawks ### Emergency Squawks
The system highlights aircraft transmitting emergency squawks: The system highlights aircraft transmitting emergency squawks:
- **7500** - Hijack - **7500** - Hijack
- **7600** - Radio failure - **7600** - Radio failure
- **7700** - General emergency - **7700** - General emergency
## ADS-B History (Optional) ## ADS-B History (Optional)
The history dashboard persists aircraft messages and per-aircraft snapshots to Postgres for long-running tracking and reporting. The history dashboard persists aircraft messages and per-aircraft snapshots to Postgres for long-running tracking and reporting.
### Enable History ### Enable History
Set the following environment variables (Docker recommended): Set the following environment variables (Docker recommended):
| Variable | Default | Description | | Variable | Default | Description |
|----------|---------|-------------| |----------|---------|-------------|
| `INTERCEPT_ADSB_HISTORY_ENABLED` | `false` | Enables history storage and reporting | | `INTERCEPT_ADSB_HISTORY_ENABLED` | `false` | Enables history storage and reporting |
| `INTERCEPT_ADSB_DB_HOST` | `localhost` | Postgres host (use `adsb_db` in Docker) | | `INTERCEPT_ADSB_DB_HOST` | `localhost` | Postgres host (use `adsb_db` in Docker) |
| `INTERCEPT_ADSB_DB_PORT` | `5432` | Postgres port | | `INTERCEPT_ADSB_DB_PORT` | `5432` | Postgres port |
| `INTERCEPT_ADSB_DB_NAME` | `intercept_adsb` | Database name | | `INTERCEPT_ADSB_DB_NAME` | `intercept_adsb` | Database name |
| `INTERCEPT_ADSB_DB_USER` | `intercept` | Database user | | `INTERCEPT_ADSB_DB_USER` | `intercept` | Database user |
| `INTERCEPT_ADSB_DB_PASSWORD` | `intercept` | Database password | | `INTERCEPT_ADSB_DB_PASSWORD` | `intercept` | Database password |
### Docker Setup ### Other ADS-B Settings
`docker-compose.yml` includes an `adsb_db` service and a persistent volume for history storage: | Variable | Default | Description |
|----------|---------|-------------|
```bash | `INTERCEPT_ADSB_AUTO_START` | `false` | Auto-start ADS-B tracking when the dashboard loads |
docker compose up -d | `INTERCEPT_SHARED_OBSERVER_LOCATION` | `true` | Share observer location across ADS-B/AIS/SSTV/Satellite modules |
```
**Local install example**
### Using the History Dashboard
```bash
1. Open **/adsb/history** INTERCEPT_ADSB_AUTO_START=true \
2. Use **Start Tracking** to run ADS-B in headless mode INTERCEPT_SHARED_OBSERVER_LOCATION=false \
3. View aircraft history and timelines python app.py
4. Stop tracking when desired (session history is recorded) ```
**Docker example (.env)**
```bash
INTERCEPT_ADSB_AUTO_START=true
INTERCEPT_SHARED_OBSERVER_LOCATION=false
```
### Docker Setup
`docker-compose.yml` includes an `adsb_db` service and a persistent volume for history storage:
```bash
docker compose --profile history up -d
```
To store Postgres data on external storage, set `PGDATA_PATH` (defaults to `./pgdata`):
```bash
PGDATA_PATH=/mnt/usbpi1/intercept/pgdata
```
### Using the History Dashboard
1. Open **/adsb/history**
2. Use **Start Tracking** to run ADS-B in headless mode
3. View aircraft history and timelines
4. Stop tracking when desired (session history is recorded)
## Satellite Mode ## Satellite Mode
+7 -1
View File
@@ -33,7 +33,9 @@ from config import (
ADSB_DB_PASSWORD, ADSB_DB_PASSWORD,
ADSB_DB_PORT, ADSB_DB_PORT,
ADSB_DB_USER, ADSB_DB_USER,
ADSB_AUTO_START,
ADSB_HISTORY_ENABLED, ADSB_HISTORY_ENABLED,
SHARED_OBSERVER_LOCATION_ENABLED,
) )
from utils.logging import adsb_logger as logger from utils.logging import adsb_logger as logger
from utils.validation import ( from utils.validation import (
@@ -812,7 +814,11 @@ 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."""
return render_template('adsb_dashboard.html') return render_template(
'adsb_dashboard.html',
shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED,
adsb_auto_start=ADSB_AUTO_START,
)
@adsb_bp.route('/history') @adsb_bp.route('/history')
+5 -1
View File
@@ -15,6 +15,7 @@ from typing import Generator
from flask import Blueprint, jsonify, request, Response, render_template from flask import Blueprint, jsonify, request, Response, render_template
import app as app_module import app as app_module
from config import SHARED_OBSERVER_LOCATION_ENABLED
from utils.logging import get_logger from utils.logging import get_logger
from utils.validation import validate_device_index, validate_gain from utils.validation import validate_device_index, validate_gain
from utils.sse import format_sse from utils.sse import format_sse
@@ -480,4 +481,7 @@ def stream_ais():
@ais_bp.route('/dashboard') @ais_bp.route('/dashboard')
def ais_dashboard(): def ais_dashboard():
"""Popout AIS dashboard.""" """Popout AIS dashboard."""
return render_template('ais_dashboard.html') return render_template(
'ais_dashboard.html',
shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED,
)
+9 -4
View File
@@ -11,7 +11,9 @@ from urllib.parse import urlparse
import requests import requests
from flask import Blueprint, jsonify, request, render_template, Response from flask import Blueprint, jsonify, request, render_template, Response
from config import SHARED_OBSERVER_LOCATION_ENABLED
from data.satellites import TLE_SATELLITES from data.satellites import TLE_SATELLITES
from utils.logging import satellite_logger as logger from utils.logging import satellite_logger as logger
@@ -118,9 +120,12 @@ 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."""
return render_template('satellite_dashboard.html') return render_template(
'satellite_dashboard.html',
shared_observer_location=SHARED_OBSERVER_LOCATION_ENABLED,
)
@satellite_bp.route('/predict', methods=['POST']) @satellite_bp.route('/predict', methods=['POST'])
+13 -10
View File
@@ -31,16 +31,19 @@ let autoScroll = localStorage.getItem('autoScroll') !== 'false';
let muted = localStorage.getItem('audioMuted') === 'true'; let muted = localStorage.getItem('audioMuted') === 'true';
// Observer location (load from localStorage or default to London) // Observer location (load from localStorage or default to London)
let observerLocation = (function() { let observerLocation = (function() {
const saved = localStorage.getItem('observerLocation'); if (window.ObserverLocation && ObserverLocation.getForModule) {
if (saved) { return ObserverLocation.getForModule('observerLocation');
try { }
const parsed = JSON.parse(saved); const saved = localStorage.getItem('observerLocation');
if (parsed.lat && parsed.lon) return parsed; if (saved) {
} catch (e) {} try {
} const parsed = JSON.parse(saved);
return { lat: 51.5074, lon: -0.1278 }; if (parsed.lat && parsed.lon) return parsed;
})(); } catch (e) {}
}
return { lat: 51.5074, lon: -0.1278 };
})();
// Message storage for export // Message storage for export
let allMessages = []; let allMessages = [];
+103
View File
@@ -0,0 +1,103 @@
// Shared observer location helper for map-based modules.
// Default: shared location enabled unless explicitly disabled via config.
window.ObserverLocation = (function() {
const DEFAULT_LOCATION = { lat: 51.5074, lon: -0.1278 };
const SHARED_KEY = 'observerLocation';
const AIS_KEY = 'ais_observerLocation';
const LEGACY_LAT_KEY = 'observerLat';
const LEGACY_LON_KEY = 'observerLon';
function isSharedEnabled() {
return window.INTERCEPT_SHARED_OBSERVER_LOCATION !== false;
}
function normalize(lat, lon) {
const latNum = parseFloat(lat);
const lonNum = parseFloat(lon);
if (Number.isNaN(latNum) || Number.isNaN(lonNum)) return null;
if (latNum < -90 || latNum > 90 || lonNum < -180 || lonNum > 180) return null;
return { lat: latNum, lon: lonNum };
}
function parseLocation(raw) {
if (!raw) return null;
try {
const parsed = JSON.parse(raw);
if (parsed && parsed.lat !== undefined && parsed.lon !== undefined) {
return normalize(parsed.lat, parsed.lon);
}
} catch (e) {}
return null;
}
function readKey(key) {
return parseLocation(localStorage.getItem(key));
}
function readLegacyLatLon() {
const lat = localStorage.getItem(LEGACY_LAT_KEY);
const lon = localStorage.getItem(LEGACY_LON_KEY);
if (!lat || !lon) return null;
return normalize(lat, lon);
}
function getShared() {
const current = readKey(SHARED_KEY);
if (current) return current;
const legacy = readKey(AIS_KEY) || readLegacyLatLon();
if (legacy) {
setShared(legacy);
return legacy;
}
return { ...DEFAULT_LOCATION };
}
function setShared(location, options = {}) {
if (!location) return;
localStorage.setItem(SHARED_KEY, JSON.stringify(location));
if (options.updateLegacy !== false) {
localStorage.setItem(LEGACY_LAT_KEY, location.lat.toString());
localStorage.setItem(LEGACY_LON_KEY, location.lon.toString());
}
}
function getForModule(moduleKey, options = {}) {
if (isSharedEnabled()) {
return getShared();
}
if (moduleKey) {
const moduleLocation = readKey(moduleKey);
if (moduleLocation) return moduleLocation;
}
if (options.fallbackToLatLon) {
const legacy = readLegacyLatLon();
if (legacy) return legacy;
}
return { ...DEFAULT_LOCATION };
}
function setForModule(moduleKey, location, options = {}) {
if (!location) return;
if (isSharedEnabled()) {
setShared(location, options);
return;
}
if (moduleKey) {
localStorage.setItem(moduleKey, JSON.stringify(location));
} else if (options.fallbackToLatLon) {
localStorage.setItem(LEGACY_LAT_KEY, location.lat.toString());
localStorage.setItem(LEGACY_LON_KEY, location.lon.toString());
}
}
return {
isSharedEnabled,
getShared,
setShared,
getForModule,
setForModule,
normalize,
DEFAULT_LOCATION: { ...DEFAULT_LOCATION }
};
})();
+28 -14
View File
@@ -547,9 +547,14 @@ document.addEventListener('DOMContentLoaded', () => {
/** /**
* Load and display current observer location * Load and display current observer location
*/ */
function loadObserverLocation() { function loadObserverLocation() {
const lat = localStorage.getItem('observerLat'); let lat = localStorage.getItem('observerLat');
const lon = localStorage.getItem('observerLon'); let lon = localStorage.getItem('observerLon');
if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
const shared = ObserverLocation.getShared();
lat = shared.lat.toString();
lon = shared.lon.toString();
}
const latInput = document.getElementById('observerLatInput'); const latInput = document.getElementById('observerLatInput');
const lonInput = document.getElementById('observerLonInput'); const lonInput = document.getElementById('observerLonInput');
@@ -633,9 +638,9 @@ function detectLocationGPS(btn) {
/** /**
* Save observer location to localStorage * Save observer location to localStorage
*/ */
function saveObserverLocation() { function saveObserverLocation() {
const latInput = document.getElementById('observerLatInput'); const latInput = document.getElementById('observerLatInput');
const lonInput = document.getElementById('observerLonInput'); const lonInput = document.getElementById('observerLonInput');
const lat = parseFloat(latInput?.value); const lat = parseFloat(latInput?.value);
const lon = parseFloat(lonInput?.value); const lon = parseFloat(lonInput?.value);
@@ -658,8 +663,12 @@ function saveObserverLocation() {
return; return;
} }
localStorage.setItem('observerLat', lat.toString()); if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
localStorage.setItem('observerLon', lon.toString()); ObserverLocation.setShared({ lat, lon });
} else {
localStorage.setItem('observerLat', lat.toString());
localStorage.setItem('observerLon', lon.toString());
}
// Also update dashboard-specific location keys for ADS-B and AIS // Also update dashboard-specific location keys for ADS-B and AIS
const locationObj = JSON.stringify({ lat: lat, lon: lon }); const locationObj = JSON.stringify({ lat: lat, lon: lon });
@@ -669,12 +678,17 @@ function saveObserverLocation() {
// Update display // Update display
const currentLatDisplay = document.getElementById('currentLatDisplay'); const currentLatDisplay = document.getElementById('currentLatDisplay');
const currentLonDisplay = document.getElementById('currentLonDisplay'); const currentLonDisplay = document.getElementById('currentLonDisplay');
if (currentLatDisplay) currentLatDisplay.textContent = lat.toFixed(4) + '°'; if (currentLatDisplay) currentLatDisplay.textContent = lat.toFixed(4) + '°';
if (currentLonDisplay) currentLonDisplay.textContent = lon.toFixed(4) + '°'; if (currentLonDisplay) currentLonDisplay.textContent = lon.toFixed(4) + '°';
if (typeof showNotification === 'function') { if (typeof showNotification === 'function') {
showNotification('Location', 'Observer location saved'); showNotification('Location', 'Observer location saved');
} }
if (window.observerLocation) {
window.observerLocation.lat = lat;
window.observerLocation.lon = lon;
}
// Refresh SSTV ISS schedule if available // Refresh SSTV ISS schedule if available
if (typeof SSTV !== 'undefined' && typeof SSTV.loadIssSchedule === 'function') { if (typeof SSTV !== 'undefined' && typeof SSTV.loadIssSchedule === 'function') {
+33 -20
View File
@@ -37,15 +37,20 @@ const SSTV = (function() {
/** /**
* Load location into input fields * Load location into input fields
*/ */
function loadLocationInputs() { function loadLocationInputs() {
const latInput = document.getElementById('sstvObsLat'); const latInput = document.getElementById('sstvObsLat');
const lonInput = document.getElementById('sstvObsLon'); const lonInput = document.getElementById('sstvObsLon');
const storedLat = localStorage.getItem('observerLat'); let storedLat = localStorage.getItem('observerLat');
const storedLon = localStorage.getItem('observerLon'); let storedLon = localStorage.getItem('observerLon');
if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
if (latInput && storedLat) latInput.value = storedLat; const shared = ObserverLocation.getShared();
if (lonInput && storedLon) lonInput.value = storedLon; storedLat = shared.lat.toString();
storedLon = shared.lon.toString();
}
if (latInput && storedLat) latInput.value = storedLat;
if (lonInput && storedLon) lonInput.value = storedLon;
// Add change handlers to save and refresh // Add change handlers to save and refresh
if (latInput) latInput.addEventListener('change', saveLocationFromInputs); if (latInput) latInput.addEventListener('change', saveLocationFromInputs);
@@ -55,19 +60,23 @@ const SSTV = (function() {
/** /**
* Save location from input fields * Save location from input fields
*/ */
function saveLocationFromInputs() { function saveLocationFromInputs() {
const latInput = document.getElementById('sstvObsLat'); const latInput = document.getElementById('sstvObsLat');
const lonInput = document.getElementById('sstvObsLon'); const lonInput = document.getElementById('sstvObsLon');
const lat = parseFloat(latInput?.value); const lat = parseFloat(latInput?.value);
const lon = parseFloat(lonInput?.value); const lon = parseFloat(lonInput?.value);
if (!isNaN(lat) && lat >= -90 && lat <= 90 && if (!isNaN(lat) && lat >= -90 && lat <= 90 &&
!isNaN(lon) && lon >= -180 && lon <= 180) { !isNaN(lon) && lon >= -180 && lon <= 180) {
localStorage.setItem('observerLat', lat.toString()); if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
localStorage.setItem('observerLon', lon.toString()); ObserverLocation.setShared({ lat, lon });
loadIssSchedule(); // Refresh pass predictions } else {
} localStorage.setItem('observerLat', lat.toString());
localStorage.setItem('observerLon', lon.toString());
}
loadIssSchedule(); // Refresh pass predictions
}
} }
/** /**
@@ -94,8 +103,12 @@ const SSTV = (function() {
if (latInput) latInput.value = lat; if (latInput) latInput.value = lat;
if (lonInput) lonInput.value = lon; if (lonInput) lonInput.value = lon;
localStorage.setItem('observerLat', lat); if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
localStorage.setItem('observerLon', lon); ObserverLocation.setShared({ lat: parseFloat(lat), lon: parseFloat(lon) });
} else {
localStorage.setItem('observerLat', lat);
localStorage.setItem('observerLon', lon);
}
btn.innerHTML = originalText; btn.innerHTML = originalText;
btn.disabled = false; btn.disabled = false;
+89 -60
View File
@@ -17,10 +17,15 @@
{% else %} {% else %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
{% endif %} {% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/responsive.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/responsive.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/adsb_dashboard.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/adsb_dashboard.css') }}">
</head> <script>
window.INTERCEPT_SHARED_OBSERVER_LOCATION = {{ shared_observer_location | tojson }};
window.INTERCEPT_ADSB_AUTO_START = {{ adsb_auto_start | tojson }};
</script>
<script src="{{ url_for('static', filename='js/core/observer-location.js') }}"></script>
</head>
<body> <body>
<div class="radar-bg"></div> <div class="radar-bg"></div>
<div class="scanline"></div> <div class="scanline"></div>
@@ -517,16 +522,19 @@
} }
// Observer location and range rings (load from localStorage or default to London) // Observer location and range rings (load from localStorage or default to London)
let observerLocation = (function() { let observerLocation = (function() {
const saved = localStorage.getItem('observerLocation'); if (window.ObserverLocation && ObserverLocation.getForModule) {
if (saved) { return ObserverLocation.getForModule('observerLocation');
try { }
const parsed = JSON.parse(saved); const saved = localStorage.getItem('observerLocation');
if (parsed.lat && parsed.lon) return parsed; if (saved) {
} catch (e) {} try {
} const parsed = JSON.parse(saved);
return { lat: 51.5074, lon: -0.1278 }; if (parsed.lat && parsed.lon) return parsed;
})(); } catch (e) {}
}
return { lat: 51.5074, lon: -0.1278 };
})();
let rangeRingsLayer = null; let rangeRingsLayer = null;
let observerMarker = null; let observerMarker = null;
@@ -1802,8 +1810,12 @@ ACARS: ${r.statistics.acarsMessages} messages`;
observerLocation.lat = lat; observerLocation.lat = lat;
observerLocation.lon = lon; observerLocation.lon = lon;
// Save to localStorage for persistence // Save to localStorage for persistence
localStorage.setItem('observerLocation', JSON.stringify(observerLocation)); if (window.ObserverLocation) {
ObserverLocation.setForModule('observerLocation', observerLocation);
} else {
localStorage.setItem('observerLocation', JSON.stringify(observerLocation));
}
if (radarMap) { if (radarMap) {
radarMap.setView([lat, lon], radarMap.getZoom()); radarMap.setView([lat, lon], radarMap.getZoom());
@@ -1830,8 +1842,12 @@ ACARS: ${r.statistics.acarsMessages} messages`;
observerLocation.lat = position.coords.latitude; observerLocation.lat = position.coords.latitude;
observerLocation.lon = position.coords.longitude; observerLocation.lon = position.coords.longitude;
// Save to localStorage for persistence // Save to localStorage for persistence
localStorage.setItem('observerLocation', JSON.stringify(observerLocation)); if (window.ObserverLocation) {
ObserverLocation.setForModule('observerLocation', observerLocation);
} else {
localStorage.setItem('observerLocation', JSON.stringify(observerLocation));
}
document.getElementById('obsLat').value = observerLocation.lat.toFixed(4); document.getElementById('obsLat').value = observerLocation.lat.toFixed(4);
document.getElementById('obsLon').value = observerLocation.lon.toFixed(4); document.getElementById('obsLon').value = observerLocation.lon.toFixed(4);
@@ -1920,14 +1936,17 @@ ACARS: ${r.statistics.acarsMessages} messages`;
} }
}); });
function updateLocationFromGps(position) { function updateLocationFromGps(position) {
observerLocation.lat = position.latitude; observerLocation.lat = position.latitude;
observerLocation.lon = position.longitude; observerLocation.lon = position.longitude;
document.getElementById('obsLat').value = position.latitude.toFixed(4); document.getElementById('obsLat').value = position.latitude.toFixed(4);
document.getElementById('obsLon').value = position.longitude.toFixed(4); document.getElementById('obsLon').value = position.longitude.toFixed(4);
if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
// Center map on GPS location (on first fix) ObserverLocation.setShared({ lat: position.latitude, lon: position.longitude });
if (radarMap && !radarMap._gpsInitialized) { }
// Center map on GPS location (on first fix)
if (radarMap && !radarMap._gpsInitialized) {
radarMap.setView([position.latitude, position.longitude], radarMap.getZoom()); radarMap.setView([position.latitude, position.longitude], radarMap.getZoom());
radarMap._gpsInitialized = true; radarMap._gpsInitialized = true;
// Draw range rings immediately after centering // Draw range rings immediately after centering
@@ -2523,28 +2542,32 @@ sudo make install</code>
} }
} }
async function syncTrackingStatus() { async function syncTrackingStatus() {
// This function checks LOCAL tracking status on page load // This function checks LOCAL tracking status on page load
// For local mode: auto-start if session is already running OR SDR is available // For local mode: auto-start if session is already running OR SDR is available
// For agent mode: don't auto-start (user controls agent tracking) // For agent mode: don't auto-start (user controls agent tracking)
const useAgent = typeof adsbCurrentAgent !== 'undefined' && adsbCurrentAgent !== 'local'; const useAgent = typeof adsbCurrentAgent !== 'undefined' && adsbCurrentAgent !== 'local';
if (useAgent) { if (useAgent) {
console.log('[ADS-B] Agent mode on page load - not auto-starting local'); console.log('[ADS-B] Agent mode on page load - not auto-starting local');
return; return;
} }
try { try {
const response = await fetch('/adsb/session'); const response = await fetch('/adsb/session');
if (!response.ok) { if (!response.ok) {
// No session info - try to auto-start if SDR available // No session info - only auto-start if enabled
console.log('[ADS-B] No session found, attempting auto-start...'); if (window.INTERCEPT_ADSB_AUTO_START) {
await tryAutoStartLocal(); console.log('[ADS-B] No session found, attempting auto-start...');
return; await tryAutoStartLocal();
} } else {
const data = await response.json(); console.log('[ADS-B] No session found; auto-start disabled');
}
if (data.tracking_active) { return;
}
const data = await response.json();
if (data.tracking_active) {
// Session is running - auto-connect to stream // Session is running - auto-connect to stream
console.log('[ADS-B] Local session already active - auto-connecting to stream'); console.log('[ADS-B] Local session already active - auto-connecting to stream');
@@ -2580,18 +2603,24 @@ sudo make install</code>
document.getElementById('trackingDot').classList.add('active'); document.getElementById('trackingDot').classList.add('active');
const statusEl = document.getElementById('trackingStatus'); const statusEl = document.getElementById('trackingStatus');
statusEl.textContent = 'TRACKING'; statusEl.textContent = 'TRACKING';
} else { } else {
// Session not active - try to auto-start // Session not active - only auto-start if enabled
console.log('[ADS-B] No active session, attempting auto-start...'); if (window.INTERCEPT_ADSB_AUTO_START) {
await tryAutoStartLocal(); console.log('[ADS-B] No active session, attempting auto-start...');
} await tryAutoStartLocal();
} else {
} catch (err) { console.log('[ADS-B] No active session; auto-start disabled');
console.warn('[ADS-B] Failed to sync tracking status:', err); }
// Try auto-start anyway }
await tryAutoStartLocal();
} } catch (err) {
} console.warn('[ADS-B] Failed to sync tracking status:', err);
// Try auto-start only if enabled
if (window.INTERCEPT_ADSB_AUTO_START) {
await tryAutoStartLocal();
}
}
}
async function tryAutoStartLocal() { async function tryAutoStartLocal() {
// Try to auto-start local ADS-B tracking if SDR is available // Try to auto-start local ADS-B tracking if SDR is available
+23 -14
View File
@@ -20,6 +20,10 @@
{% endif %} {% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/ais_dashboard.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/ais_dashboard.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/responsive.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/responsive.css') }}">
<script>
window.INTERCEPT_SHARED_OBSERVER_LOCATION = {{ shared_observer_location | tojson }};
</script>
<script src="{{ url_for('static', filename='js/core/observer-location.js') }}"></script>
</head> </head>
<body> <body>
<!-- Radar background effects --> <!-- Radar background effects -->
@@ -219,7 +223,12 @@
const MAX_TRAIL_POINTS = 50; const MAX_TRAIL_POINTS = 50;
// Observer location // Observer location
let observerLocation = { lat: 51.5074, lon: -0.1278 }; let observerLocation = (function() {
if (window.ObserverLocation && ObserverLocation.getForModule) {
return ObserverLocation.getForModule('ais_observerLocation');
}
return { lat: 51.5074, lon: -0.1278 };
})();
let rangeRingsLayer = null; let rangeRingsLayer = null;
let observerMarker = null; let observerMarker = null;
@@ -376,17 +385,9 @@
// Initialize map // Initialize map
function initMap() { function initMap() {
// Load saved observer location if (observerLocation) {
const saved = localStorage.getItem('ais_observerLocation'); document.getElementById('obsLat').value = observerLocation.lat;
if (saved) { document.getElementById('obsLon').value = observerLocation.lon;
try {
const parsed = JSON.parse(saved);
if (parsed.lat && parsed.lon) {
observerLocation = parsed;
document.getElementById('obsLat').value = parsed.lat;
document.getElementById('obsLon').value = parsed.lon;
}
} catch (e) {}
} }
vesselMap = L.map('vesselMap', { vesselMap = L.map('vesselMap', {
@@ -470,7 +471,11 @@
const lon = parseFloat(document.getElementById('obsLon').value); const lon = parseFloat(document.getElementById('obsLon').value);
if (!isNaN(lat) && !isNaN(lon) && lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) { if (!isNaN(lat) && !isNaN(lon) && lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) {
observerLocation = { lat, lon }; observerLocation = { lat, lon };
localStorage.setItem('ais_observerLocation', JSON.stringify(observerLocation)); if (window.ObserverLocation) {
ObserverLocation.setForModule('ais_observerLocation', observerLocation);
} else {
localStorage.setItem('ais_observerLocation', JSON.stringify(observerLocation));
}
if (observerMarker) { if (observerMarker) {
observerMarker.setLatLng([lat, lon]); observerMarker.setLatLng([lat, lon]);
} }
@@ -1058,7 +1063,11 @@
drawRangeRings(); drawRangeRings();
// Save to localStorage // Save to localStorage
localStorage.setItem('ais_observerLocation', JSON.stringify(observerLocation)); if (window.ObserverLocation) {
ObserverLocation.setForModule('ais_observerLocation', observerLocation);
} else {
localStorage.setItem('ais_observerLocation', JSON.stringify(observerLocation));
}
} }
function showGpsIndicator(show) { function showGpsIndicator(show) {
+19 -2
View File
@@ -14,6 +14,10 @@
window._showDisclaimerOnLoad = true; window._showDisclaimerOnLoad = true;
} }
</script> </script>
<script>
window.INTERCEPT_SHARED_OBSERVER_LOCATION = {{ shared_observer_location | tojson }};
</script>
<script src="{{ url_for('static', filename='js/core/observer-location.js') }}"></script>
<!-- Fonts - Conditional CDN/Local loading --> <!-- Fonts - Conditional CDN/Local loading -->
{% if offline_settings.fonts_source == 'local' %} {% if offline_settings.fonts_source == 'local' %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/fonts-local.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/fonts-local.css') }}">
@@ -2252,6 +2256,9 @@
// Observer location for distance calculations (load from localStorage or default to London) // Observer location for distance calculations (load from localStorage or default to London)
let observerLocation = (function () { let observerLocation = (function () {
if (window.ObserverLocation && ObserverLocation.getForModule) {
return ObserverLocation.getForModule('observerLocation');
}
const saved = localStorage.getItem('observerLocation'); const saved = localStorage.getItem('observerLocation');
if (saved) { if (saved) {
try { try {
@@ -8375,8 +8382,15 @@
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition( navigator.geolocation.getCurrentPosition(
position => { position => {
document.getElementById('obsLat').value = position.coords.latitude.toFixed(4); const lat = position.coords.latitude;
document.getElementById('obsLon').value = position.coords.longitude.toFixed(4); const lon = position.coords.longitude;
document.getElementById('obsLat').value = lat.toFixed(4);
document.getElementById('obsLon').value = lon.toFixed(4);
observerLocation.lat = lat;
observerLocation.lon = lon;
if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
ObserverLocation.setShared({ lat, lon });
}
showInfo('Location updated!'); showInfo('Location updated!');
}, },
error => { error => {
@@ -8476,6 +8490,9 @@
// Update observerLocation // Update observerLocation
observerLocation.lat = position.latitude; observerLocation.lat = position.latitude;
observerLocation.lon = position.longitude; observerLocation.lon = position.longitude;
if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
ObserverLocation.setShared({ lat: position.latitude, lon: position.longitude });
}
// Update APRS user location // Update APRS user location
updateAprsUserLocation(position); updateAprsUserLocation(position);
+82 -47
View File
@@ -17,10 +17,14 @@
{% else %} {% else %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
{% endif %} {% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/responsive.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/responsive.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/satellite_dashboard.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/satellite_dashboard.css') }}">
</head> <script>
window.INTERCEPT_SHARED_OBSERVER_LOCATION = {{ shared_observer_location | tojson }};
</script>
<script src="{{ url_for('static', filename='js/core/observer-location.js') }}"></script>
</head>
<body> <body>
<div class="grid-bg"></div> <div class="grid-bg"></div>
<div class="scanline"></div> <div class="scanline"></div>
@@ -313,16 +317,33 @@
} }
} }
document.addEventListener('DOMContentLoaded', () => { function applySharedObserverLocation() {
setupEmbeddedMode(); if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
initGroundMap(); const shared = ObserverLocation.getShared();
updateClock(); if (shared) {
setInterval(updateClock, 1000); const latInput = document.getElementById('obsLat');
setInterval(updateCountdown, 1000); const lonInput = document.getElementById('obsLon');
setInterval(updateRealTimePositions, 5000); if (latInput) latInput.value = shared.lat.toFixed(4);
loadAgents(); if (lonInput) lonInput.value = shared.lon.toFixed(4);
getLocation(); return true;
}); }
}
return false;
}
document.addEventListener('DOMContentLoaded', () => {
setupEmbeddedMode();
const usedShared = applySharedObserverLocation();
initGroundMap();
updateClock();
setInterval(updateClock, 1000);
setInterval(updateCountdown, 1000);
setInterval(updateRealTimePositions, 5000);
loadAgents();
if (!usedShared) {
getLocation();
}
});
async function loadAgents() { async function loadAgents() {
try { try {
@@ -376,10 +397,13 @@
if (data.status === 'success' && data.result) { if (data.status === 'success' && data.result) {
const agentStatus = data.result; const agentStatus = data.result;
if (agentStatus.gps_position) { if (agentStatus.gps_position) {
const gps = agentStatus.gps_position; const gps = agentStatus.gps_position;
document.getElementById('obsLat').value = gps.lat.toFixed(4); document.getElementById('obsLat').value = gps.lat.toFixed(4);
document.getElementById('obsLon').value = gps.lon.toFixed(4); document.getElementById('obsLon').value = gps.lon.toFixed(4);
if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
ObserverLocation.setShared({ lat: gps.lat, lon: gps.lon });
}
// Update observer marker label // Update observer marker label
const agent = agents.find(a => a.id == agentId); const agent = agents.find(a => a.id == agentId);
@@ -407,39 +431,50 @@
now.toISOString().substring(11, 19) + ' UTC'; now.toISOString().substring(11, 19) + ' UTC';
} }
function initGroundMap() { function initGroundMap() {
groundMap = L.map('groundMap', { groundMap = L.map('groundMap', {
center: [20, 0], center: [20, 0],
zoom: 2, zoom: 2,
minZoom: 1, minZoom: 1,
maxZoom: 10, maxZoom: 10,
worldCopyJump: true worldCopyJump: true
}); });
// Use settings manager for tile layer (allows runtime changes) // Use settings manager for tile layer (allows runtime changes)
window.groundMap = groundMap; window.groundMap = groundMap;
if (typeof Settings !== 'undefined' && Settings.createTileLayer) { if (typeof Settings !== 'undefined' && Settings.createTileLayer) {
Settings.createTileLayer().addTo(groundMap); Settings.createTileLayer().addTo(groundMap);
Settings.registerMap(groundMap); Settings.registerMap(groundMap);
} else { } else {
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png', { L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OSM</a> &copy; <a href="https://carto.com/">CARTO</a>', attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OSM</a> &copy; <a href="https://carto.com/">CARTO</a>',
maxZoom: 19, maxZoom: 19,
subdomains: 'abcd' subdomains: 'abcd'
}).addTo(groundMap); }).addTo(groundMap);
} }
}
const lat = parseFloat(document.getElementById('obsLat')?.value);
const lon = parseFloat(document.getElementById('obsLon')?.value);
if (!Number.isNaN(lat) && !Number.isNaN(lon)) {
groundMap.setView([lat, lon], 3);
}
}
function getLocation() { function getLocation() {
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(pos => { navigator.geolocation.getCurrentPosition(pos => {
document.getElementById('obsLat').value = pos.coords.latitude.toFixed(4); const lat = pos.coords.latitude;
document.getElementById('obsLon').value = pos.coords.longitude.toFixed(4); const lon = pos.coords.longitude;
calculatePasses(); document.getElementById('obsLat').value = lat.toFixed(4);
}, () => { document.getElementById('obsLon').value = lon.toFixed(4);
calculatePasses(); if (window.ObserverLocation && ObserverLocation.isSharedEnabled()) {
}); ObserverLocation.setShared({ lat, lon });
} else { }
calculatePasses();
}, () => {
calculatePasses();
});
} else {
calculatePasses(); calculatePasses();
} }
} }