13 Commits

Author SHA1 Message Date
root a95db23240 Add shape tools, select/move, reference overlay, and color tools to pixel editor
Extends the in-app sprite editor with four feature sets:

- Shape tools: line (L), rectangle (R), ellipse (O) with click-drag live
  preview and a FILL toggle for outline vs filled rect/ellipse.
- Select & move: rectangular marquee (M) to select, drag-to-move via a
  floating layer, arrow-key nudge, and clipboard ops (Ctrl+C/X/V, Delete,
  Enter/Esc to commit). Undo/redo and save auto-bake any pending move.
- Reference overlay: load any image as an adjustable-opacity backdrop to
  trace over (rendered under the artwork), with a show/hide toggle.
- Color tools: brush opacity slider, persistent custom palette
  (localStorage; right-click to remove), and an auto-updating recent colors row.

Cache-bust admin assets to ?v=20260609c so the update loads without a manual
hard-refresh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 15:52:31 -07:00
allen 005817d499 Merge pull request 'Admin: in-app sprite pixel editor + receiver health UX & restart-crash fix' (#6) from feature/pixel-editor into main 2026-06-09 12:50:34 -07:00
root 7a80057cb5 Add receiver health UX, fix restart crash, add interface scan selector
Receiver management improvements for the admin Receivers tab:

- Per-receiver health: server now tracks each connection's state
  (connecting/connected/down), message count, and last-message time, exposed
  via new GET /api/admin/receiver-status and POST /api/admin/test-receivers.
- Receivers tab redesign: live "Active Receivers" panel with colored
  indicators (green=receiving, yellow=connected/no data, red=unreachable),
  a clear select -> SAVE & APPLY -> auto-test flow, and selectable scan
  results with a "USE SELECTED RECEIVERS" action.
- Network scan interface selector: scan a chosen interface/subnet instead of
  every local subnet. Oversized subnets (>/20, e.g. a docker /16) are disabled
  in the UI and rejected server-side, eliminating slow/hanging scans.

Critical fix — server crash on receiver restart:

- Receiver connection tasks were awaited inside main()'s top-level
  asyncio.gather. Restarting receivers cancels those tasks, and the resulting
  CancelledError propagated into the gather and killed the whole server
  process (every action after a restart then failed). Receiver tasks now run
  as independent background tasks; restart cancels and awaits them with
  return_exceptions=True so cancellation can never tear down the server.

Also cache-bust admin.css/admin.js/pixel-editor.js (?v=) so updated assets
load without a manual hard-refresh, and surface a clear message instead of a
silent "Loading…" when the status endpoint is unavailable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 12:49:45 -07:00
root 214ee8dd90 Add in-app pixel editor for sprites in admin UI
Build a dependency-free Canvas2D pixel editor integrated into the admin
Sprites tab. Each sprite card gains an EDIT button that opens a full-screen
editor for the sprite at its native 500x333 resolution.

Tools: pencil (1-8px brush, Bresenham interpolation), eraser, color picker
(palette + native input + pick-from-canvas), fill bucket (flood fill), pan.
Features: cursor-centered zoom, space-drag pan, undo/redo (snapshot per
stroke), pixel grid overlay, transparency checkerboard, load existing sprite,
and keyboard shortcuts (B/E/I/F, Space, +/-/0, Ctrl+Z/Y, G, Esc).

Export reuses the existing POST /api/admin/sprites/{type} upload endpoint via
srcCanvas.toBlob, so no server changes are required.

Closes #5

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 15:39:31 -07:00
root 38043d7d1f Add Docker Compose and Podman support for containerized deployment
Adds Dockerfile, docker-compose.yml, and .dockerignore to enable
running ADS-Bit in a container with host networking for LAN receiver
auto-scanning. Bind mounts persist config, sprites, and backgrounds
across container recreation. Updates README with usage instructions.

Closes #4

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 13:52:57 -07:00
root 7af9789db7 Add download buttons for sprites and theme backgrounds
Allow users to download existing sprite and background assets from the
admin panel, useful for editing externally and re-uploading or backing
up customizations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 11:47:20 -07:00
root 9f341a5b14 Add host network info display and custom subnet scan to Receivers tab
Shows the server's network interfaces (IP, subnet) in the admin Receivers
tab so users know which networks are being scanned. Adds an optional subnet
input field to scan arbitrary networks (e.g. VLANs the server can route to
but isn't directly attached to), with validation and a /20 size cap.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 11:06:31 -07:00
root 3391523d45 Add admin theme management: rename, upload, and create themes
Adds a THEMES tab to the admin panel with per-theme cards showing
4 directional previews, editable display names, per-direction PNG
upload, and new theme creation. Display names are stored in
config.json theme_names map rather than renaming filesystem folders.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 10:50:40 -07:00
root 23d469d008 Add balloon, glider, and UAV sprites with admin sprite management
New dedicated pixel art sprites for ADS-B emitter categories B2
(lighter-than-air → balloon), B1 (glider/sailplane → glider), and
B6 (UAV → uav), replacing the previous fallback to smallProp. Adds
an admin Sprites tab for previewing and uploading replacement PNGs
for all 9 aircraft sprite types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 09:44:46 -07:00
root a3fa38b740 Add ADS-B emitter category support via dump1090 JSON API
Poll dump1090's aircraft.json endpoint to get real transponder-reported
aircraft categories (A1=Light, A3=Large, A5=Heavy, A7=Rotorcraft, etc.)
instead of relying solely on heuristics. The SBS protocol on port 30003
doesn't include this field, but the JSON API on port 80 does. Categories
are polled every 5 seconds and merged into flight data. Client uses
emitter category when available, falling back to heuristic classification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 09:12:08 -07:00
root c996ade142 Fix aircraft categorization misclassifying Cessnas as helicopters
N-prefix callsigns (US general aviation) were incorrectly matching the
helicopter detection rules due to 'N' in the helicopter callsign list
and a broken .some() condition. Speed/altitude heuristics were also too
broad, and zero-value speed data (not yet received) triggered false
matches. Types are now re-evaluated as better data arrives instead of
being locked to the first guess.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 09:00:15 -07:00
root 2a2c29de29 Rename project references from Pixel View to ADS-Bit
Rename pixel-view.js to ads-bit.js, rename PixelADSB class to ADSBit,
and update all documentation and code comments to use ADS-Bit branding
consistently throughout the project.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 08:54:59 -07:00
root 22a3078af9 Add admin panel, authentication, and first-run setup wizard for v1.0
Implements credentialed admin panel and multi-step setup wizard so new
users can configure location, receivers, and preferences without editing
JSON files. Adds bcrypt password auth with session cookies, setup lockout
after first run, and expanded config schema with backward compatibility.

New files: admin/{html,css,js}, setup/{html,css,js}
Modified: server.py (auth, setup, admin APIs), index.html (dynamic title),
pixel-view.js (site/display config), requirements.txt (bcrypt),
config.json.example (full schema)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 08:35:07 -07:00
12 changed files with 29 additions and 134 deletions
-1
View File
@@ -3,7 +3,6 @@ __pycache__
*.pyc *.pyc
*.pyo *.pyo
config.json config.json
data/
screenshots/ screenshots/
.claude/ .claude/
CLAUDE.md CLAUDE.md
+2 -6
View File
@@ -23,9 +23,5 @@ __pycache__/
.DS_Store .DS_Store
Thumbs.db Thumbs.db
# Local config — contains the admin password hash and session secret. # Local config (uncomment if you want to ignore local changes)
# Fresh installs start from config.json.example (see CONFIG.md). # config.json
config.json
# Docker config volume (holds the live config.json with secrets)
data/
+3 -15
View File
@@ -18,14 +18,6 @@ python3 server.py
Access at http://localhost:{web_port} (configured in config.json) Access at http://localhost:{web_port} (configured in config.json)
### Deployment / fielding notes
- **Config path** is overridable via the `ADSBIT_CONFIG` env var (defaults to `config.json` beside `server.py`). Docker uses `/app/data/config.json` on a mounted volume.
- **`/health`** (no auth) returns status/version/receiver/flight counts — used by the Docker `HEALTHCHECK` and any external monitoring.
- **`VERSION`** constant in `server.py` is the single source of truth; surfaced at startup, via `GET /api/config`, and in the admin header. Bump it for releases.
- **Auto-scan** (`scan_for_receivers`) skips subnets larger than `MIN_SCAN_PREFIX` (/20) so a docker `/16` doesn't stall startup; the manual scan endpoint enforces the same limit.
- **`docker-entrypoint.sh`** seeds `config.json` from `config.json.example` on first run, so a fresh `docker compose up` needs no manual steps. SIGTERM/SIGINT shut down cleanly (no traceback).
## Architecture ## Architecture
### Components ### Components
@@ -56,15 +48,11 @@ Access at http://localhost:{web_port} (configured in config.json)
- **admin/** - Admin panel (login + tabbed settings UI) - **admin/** - Admin panel (login + tabbed settings UI)
- Theme management: rename display names, upload per-direction background PNGs, create new themes - Theme management: rename display names, upload per-direction background PNGs, create new themes
- Display names stored in `config.json` `theme_names` map (folder name -> display name) - Display names stored in `config.json` `theme_names` map (folder name -> display name)
- Receivers tab: live per-receiver health (via `GET /api/admin/receiver-status` and `POST /api/admin/test-receivers`), a select → SAVE & APPLY → auto-test flow, selectable scan results, and a per-interface scan selector
- Version (from `server.py` `VERSION`) is surfaced via public `GET /api/config` and shown in the admin header
- **pixel-editor.js** - In-app Canvas2D pixel editor (Sprites tab "EDIT" button) - **pixel-editor.js** - In-app Canvas2D pixel editor (Sprites tab "EDIT" button)
- Edits sprites at native 500x333; tools: pencil, eraser, color picker, fill bucket, pan, line, rectangle, ellipse (outline/filled), rectangular select - Edits sprites at native 500x333; tools: pencil, eraser, color picker, fill bucket, pan
- Select & move: marquee + floating layer, drag/arrow-nudge, Ctrl+C/X/V clipboard, Delete, Enter/Esc commit - Zoom/pan, undo/redo (snapshot-per-stroke), grid overlay, retro palette + native color input
- Zoom/pan, undo/redo (snapshot-per-stroke), grid overlay, brush size & opacity, retro + custom (localStorage) + recent palettes, adjustable reference-image overlay
- Exports a 500x333 PNG via `srcCanvas.toBlob` and POSTs to the existing `/api/admin/sprites/{type}` upload endpoint (no new server route) - Exports a 500x333 PNG via `srcCanvas.toBlob` and POSTs to the existing `/api/admin/sprites/{type}` upload endpoint (no new server route)
- Keyboard: B/E/I/F/L/R/O/M tools, Space=pan, +/-/0 zoom, Ctrl+Z/Y undo/redo, Ctrl+C/X/V, arrows nudge, G grid, Esc close - Keyboard: B/E/I/F tools, Space=pan, +/-/0 zoom, Ctrl+Z/Y undo/redo, G grid, Esc close
- **Asset cache-busting:** `admin.html` references `admin.css`/`admin.js`/`pixel-editor.js` with a `?v=YYYYMMDD[x]` query — bump it whenever those files change so browsers reload them
- **setup/** - First-run setup wizard (multi-step configuration) - **setup/** - First-run setup wizard (multi-step configuration)
+2 -9
View File
@@ -13,16 +13,9 @@ RUN pip install --no-cache-dir -r requirements.txt && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
COPY . . COPY . .
RUN chmod +x /app/docker-entrypoint.sh
EXPOSE 2001 EXPOSE 2001
# Persist config on a mounted volume by default (see docker-compose.yml). ENV PYTHONUNBUFFERED=1
ENV PYTHONUNBUFFERED=1 \
ADSBIT_CONFIG=/app/data/config.json
# Liveness probe against the unauthenticated /health endpoint. CMD ["python3", "server.py"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD python3 -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:2001/health',timeout=4).status==200 else 1)" || exit 1
ENTRYPOINT ["/app/docker-entrypoint.sh"]
+11 -15
View File
@@ -7,16 +7,14 @@ A retro SNES-style side-view flight tracker that displays ADS-B aircraft data wi
## Features ## Features
- Real-time aircraft tracking via ADS-B receivers - Real-time aircraft tracking via ADS-B receivers
- Custom pixel art sprites for 9 aircraft types (small prop, regional jet, narrow body, wide body, heavy, helicopter, balloon, glider, UAV) - Custom pixel art sprites for 6 aircraft types (small prop, regional jet, narrow body, wide body, heavy, helicopter)
- Animated sun and moon with accurate astronomical positions - Animated sun and moon with accurate astronomical positions
- Dynamic sky colors based on time of day - Dynamic sky colors based on time of day
- Weather visualization with cloud sprites - Weather visualization with cloud sprites
- Directional view (N/E/S/W) with themed backgrounds - Directional view (N/E/S/W) with themed backgrounds
- Auto-discovery of ADS-B receivers on your network, with per-interface scanning - Auto-discovery of ADS-B receivers on your network
- Canvas-based 10 FPS retro rendering - Canvas-based 10 FPS retro rendering
- Admin panel with password authentication - Admin panel with password authentication
- **In-app pixel editor** — draw and edit sprites in the browser (pencil, shapes, fill, select & move, reference overlay, custom palettes)
- **Receiver health dashboard** — live per-receiver status (receiving / no data / unreachable), connection testing, and select → save → apply flow
- First-run setup wizard - First-run setup wizard
## Quick Start ## Quick Start
@@ -44,16 +42,14 @@ On first run, visit http://localhost:2001 and the setup wizard will guide you th
### First Run ### First Run
```bash ```bash
# Build and start — no config step needed # Create a config file (the setup wizard runs if you skip this)
cp config.json.example config.json
# Build and start
docker compose up -d docker compose up -d
``` ```
A config file is created automatically in `data/` on first run, then the The web UI is available at http://localhost:2001.
browser **setup wizard** walks you through receiver, location, and password
setup. The web UI is available at http://localhost:2001.
A `/health` endpoint (used by the container healthcheck) reports status,
version, and receiver/flight counts: `curl http://localhost:2001/health`.
### Useful Commands ### Useful Commands
@@ -84,11 +80,11 @@ The following paths are bind-mounted from the repo directory and persist across
| Path | Contents | | Path | Contents |
|------|----------| |------|----------|
| `data/` | Server configuration and credentials (`config.json`, auto-seeded) | | `config.json` | Server configuration and credentials |
| `images/` | Aircraft and UI sprites (including uploads) | | `images/` | Aircraft and UI sprites (including uploads) |
| `backgrounds/` | Theme background images (including custom themes) | | `backgrounds/` | Theme background images (including custom themes) |
Host networking (`network_mode: host`) is used so the server can auto-scan your LAN for ADS-B receivers. Auto-scan skips oversized subnets (larger than /20, e.g. a Docker bridge `172.17.0.0/16`); if your receiver lives on such a network, set it explicitly via the admin Receivers tab. Host networking (`network_mode: host`) is used so the server can auto-scan your LAN for ADS-B receivers.
## Requirements ## Requirements
@@ -106,8 +102,8 @@ ADS-Bit uses a first-run setup wizard to configure your installation. You can al
"receiver_port": 30003, "receiver_port": 30003,
"location": { "location": {
"name": "My Location", "name": "My Location",
"lat": 36.2788, "lat": 0.0,
"lon": -115.2283 "lon": 0.0
}, },
"web_port": 2001, "web_port": 2001,
"theme": "desert" "theme": "desert"
-9
View File
@@ -169,15 +169,6 @@ textarea {
margin: 0; margin: 0;
} }
.admin-version {
font-family: 'Courier New', monospace;
font-size: 11px;
color: #54fc54;
text-shadow: none;
margin-left: 6px;
vertical-align: middle;
}
.header-actions { .header-actions {
display: flex; display: flex;
gap: 8px; gap: 8px;
+4 -4
View File
@@ -7,7 +7,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/admin/admin.css?v=20260609d"> <link rel="stylesheet" href="/admin/admin.css?v=20260609c">
</head> </head>
<body> <body>
<!-- Login Screen --> <!-- Login Screen -->
@@ -27,7 +27,7 @@
<!-- Admin Panel --> <!-- Admin Panel -->
<div id="admin-panel" class="hidden"> <div id="admin-panel" class="hidden">
<header class="admin-header"> <header class="admin-header">
<h1 class="retro-title">ADS-Bit Admin <span id="admin-version" class="admin-version"></span></h1> <h1 class="retro-title">ADS-Bit Admin</h1>
<div class="header-actions"> <div class="header-actions">
<a href="/" class="btn btn-small">VIEWER</a> <a href="/" class="btn btn-small">VIEWER</a>
<button id="logout-btn" class="btn btn-small btn-danger">LOGOUT</button> <button id="logout-btn" class="btn btn-small btn-danger">LOGOUT</button>
@@ -297,7 +297,7 @@
<div id="toast" class="toast hidden"></div> <div id="toast" class="toast hidden"></div>
</div> </div>
<script src="/admin/pixel-editor.js?v=20260609d"></script> <script src="/admin/pixel-editor.js?v=20260609c"></script>
<script src="/admin/admin.js?v=20260609d"></script> <script src="/admin/admin.js?v=20260609c"></script>
</body> </body>
</html> </html>
-12
View File
@@ -28,22 +28,10 @@
loadConfig(); loadConfig();
loadThemes(); loadThemes();
loadNetworkInfo(); loadNetworkInfo();
loadVersion();
refreshStatus(); refreshStatus();
statusInterval = setInterval(refreshStatus, 5000); statusInterval = setInterval(refreshStatus, 5000);
} }
async function loadVersion() {
try {
const res = await fetch('/api/config');
if (!res.ok) return;
const data = await res.json();
if (data.version) {
document.getElementById('admin-version').textContent = 'v' + data.version;
}
} catch (e) { /* ignore */ }
}
document.getElementById('login-form').addEventListener('submit', async (e) => { document.getElementById('login-form').addEventListener('submit', async (e) => {
e.preventDefault(); e.preventDefault();
const pw = document.getElementById('login-password').value; const pw = document.getElementById('login-password').value;
+2 -4
View File
@@ -6,11 +6,9 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
- PYTHONUNBUFFERED=1 - PYTHONUNBUFFERED=1
- ADSBIT_CONFIG=/app/data/config.json
volumes: volumes:
# Config persists here; auto-seeded from config.json.example on first run # Persist config (copy config.json.example to config.json before first run)
# (a directory mount, so a fresh `docker compose up` just works). - ./config.json:/app/config.json
- ./data:/app/data
# Persist custom sprite uploads # Persist custom sprite uploads
- ./images:/app/images - ./images:/app/images
# Persist custom theme backgrounds # Persist custom theme backgrounds
-16
View File
@@ -1,16 +0,0 @@
#!/bin/sh
# Seed a config file on first run so `docker compose up` works on a fresh
# clone with no manual steps. The config lives on a mounted data volume so it
# persists across container rebuilds.
set -e
: "${ADSBIT_CONFIG:=/app/config.json}"
CONFIG_DIR=$(dirname "$ADSBIT_CONFIG")
mkdir -p "$CONFIG_DIR"
if [ ! -f "$ADSBIT_CONFIG" ]; then
echo "[entrypoint] No config at $ADSBIT_CONFIG — seeding from config.json.example"
cp /app/config.json.example "$ADSBIT_CONFIG"
fi
exec python3 server.py
Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

+4 -42
View File
@@ -17,16 +17,8 @@ from aiohttp import web, ClientSession, ClientTimeout
import netifaces import netifaces
import bcrypt import bcrypt
VERSION = "1.1.1"
WEB_DIR = Path(__file__).parent WEB_DIR = Path(__file__).parent
# Config path is overridable (handy for containers persisting config on a CONFIG_FILE = WEB_DIR / "config.json"
# named volume); defaults to config.json next to this script for bare-metal.
CONFIG_FILE = Path(os.environ.get("ADSBIT_CONFIG") or (WEB_DIR / "config.json"))
# Smallest subnet prefix (largest network) we'll auto-scan: /20 = 4094 hosts.
# Anything bigger (e.g. a docker /16) is skipped to keep scans fast and safe.
MIN_SCAN_PREFIX = 20
# Track server start time # Track server start time
SERVER_START_TIME = time.time() SERVER_START_TIME = time.time()
@@ -420,15 +412,6 @@ async def scan_for_receivers():
if ip and netmask and not ip.startswith('127.'): if ip and netmask and not ip.startswith('127.'):
try: try:
network = ipaddress.IPv4Network(f"{ip}/{netmask}", strict=False) network = ipaddress.IPv4Network(f"{ip}/{netmask}", strict=False)
# Skip subnets too large to scan quickly (e.g. a docker
# bridge /16 = 65k hosts). Without this, AUTO discovery
# hammers the network and stalls startup on any host with
# Docker or a large/16. Use MANUAL or a custom subnet for
# receivers that live on such networks.
if network.prefixlen < MIN_SCAN_PREFIX:
print(f"Skipping {network} on {iface}: too large "
f"({network.num_addresses} hosts) for auto-scan")
continue
found.extend(await _scan_subnet(network, port)) found.extend(await _scan_subnet(network, port))
except ValueError as e: except ValueError as e:
print(f"Invalid network {ip}/{netmask}: {e}") print(f"Invalid network {ip}/{netmask}: {e}")
@@ -566,7 +549,6 @@ async def handle_receiver_location(request):
async def handle_config(request): async def handle_config(request):
"""Return client-relevant configuration (public, no secrets).""" """Return client-relevant configuration (public, no secrets)."""
return web.json_response({ return web.json_response({
"version": VERSION,
"theme": config.get("theme", "desert"), "theme": config.get("theme", "desert"),
"location": config["location"], "location": config["location"],
"receivers": receivers, "receivers": receivers,
@@ -999,10 +981,9 @@ async def handle_admin_scan_receivers(request):
return web.json_response( return web.json_response(
{"error": f"Invalid subnet: {subnet}"}, status=400) {"error": f"Invalid subnet: {subnet}"}, status=400)
if network.prefixlen < MIN_SCAN_PREFIX: if network.prefixlen < 20:
return web.json_response( return web.json_response(
{"error": f"Subnet too large (max /{MIN_SCAN_PREFIX} = " {"error": "Subnet too large (max /20 = 4096 hosts)"}, status=400)
f"{2 ** (32 - MIN_SCAN_PREFIX) - 2} hosts)"}, status=400)
port = config['receiver_port'] port = config['receiver_port']
found = await _scan_subnet(network, port) found = await _scan_subnet(network, port)
@@ -1188,17 +1169,6 @@ async def handle_http(request):
return web.Response(status=404, text="Not Found") return web.Response(status=404, text="Not Found")
async def handle_health(request):
"""GET /health - liveness/readiness probe (no auth, no secrets)."""
return web.json_response({
"status": "ok",
"version": VERSION,
"receivers": len(receivers),
"flights": len(flights),
"uptime_seconds": int(time.time() - SERVER_START_TIME),
})
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Application setup # Application setup
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -1211,7 +1181,6 @@ async def start_http_server():
app.router.add_get('/ws', websocket_handler) app.router.add_get('/ws', websocket_handler)
# Public API # Public API
app.router.add_get('/health', handle_health)
app.router.add_get('/api/receiver-location', handle_receiver_location) app.router.add_get('/api/receiver-location', handle_receiver_location)
app.router.add_get('/api/config', handle_config) app.router.add_get('/api/config', handle_config)
@@ -1262,7 +1231,7 @@ async def main():
"""Main entry point""" """Main entry point"""
global receivers, receiver_tasks global receivers, receiver_tasks
print(f"ADS-Bit Server v{VERSION} Starting...") print("ADS-Bit Server Starting...")
load_config() load_config()
@@ -1310,11 +1279,4 @@ async def main():
if __name__ == "__main__": if __name__ == "__main__":
# Make SIGTERM (docker stop, systemctl stop) raise KeyboardInterrupt like
# SIGINT does, so shutdown is clean and quiet instead of a stack trace.
import signal
signal.signal(signal.SIGTERM, signal.default_int_handler)
try:
asyncio.run(main()) asyncio.run(main())
except (KeyboardInterrupt, SystemExit):
print("ADS-Bit server shutting down.")