24 Commits

Author SHA1 Message Date
allen 2b7d6eb788 Merge pull request 'Release v1.1.2: publish container image + security workflows' (#12) from release/v1.1.2 into main
CI / Python checks (push) Has been cancelled
CI / Docker build (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
2026-06-10 15:36:03 -07:00
root f56f8e5487 Release v1.1.2: publish container image + add security workflows
CI / Python checks (pull_request) Has been cancelled
CI / Docker build (pull_request) Has been cancelled
CodeQL / Analyze (javascript) (pull_request) Has been cancelled
CodeQL / Analyze (python) (pull_request) Has been cancelled
- Bump VERSION to 1.1.2 (no app behavior change from 1.1.1).
- release.yml: add workflow_dispatch so images can be published manually from
  the Actions tab in addition to on version tags.
- Add CodeQL code scanning (Python + JavaScript), free for public repos.
- Add Dependabot config for GitHub Actions and pip updates.

This is the first release to publish a multi-arch image to GHCR
(ghcr.io/allennpit/ads-bit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 15:36:02 -07:00
allen 69ec5f18a6 Merge pull request 'Set GitHub namespace (AllenNPIT)' (#11) from chore/set-namespace into main
CI / Python checks (push) Has been cancelled
CI / Docker build (push) Has been cancelled
2026-06-10 10:26:48 -07:00
root be361a6e76 Set GitHub namespace (AllenNPIT) in README badges and CHANGELOG links
CI / Python checks (pull_request) Has been cancelled
CI / Docker build (pull_request) Has been cancelled
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 10:26:47 -07:00
allen c93ee24641 Merge pull request 'Package for public GitHub release' (#10) from chore/github-packaging into main
CI / Python checks (push) Has been cancelled
CI / Docker build (push) Has been cancelled
2026-06-10 10:13:54 -07:00
root ebe4e34047 Package for public GitHub release
CI / Python checks (pull_request) Has been cancelled
CI / Docker build (pull_request) Has been cancelled
Add open-source scaffolding and CI; remove Claude-specific dev notes from the
published tree.

- Remove CLAUDE.md from tracking (kept locally, now git-ignored).
- CHANGELOG.md (Keep a Changelog; v1.0 → v1.1.1).
- SECURITY.md (private vuln reporting + operator guidance).
- CONTRIBUTING.md (dev setup, conventions, PR flow).
- .github/: bug + feature issue templates, PR template.
- .github/workflows/ci.yml: byte-compile, validate example config, docker build.
- .github/workflows/release.yml: on a version tag, publish a multi-arch
  (amd64 + arm64) image to GHCR.
- README: license/release/CI badges, prebuilt-image (GHCR) run instructions,
  and a corrected Python-version note (3.9–3.11; netifaces caveat).

Badges and image names use an `OWNER` placeholder to replace with the GitHub
namespace after the repo is created.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 10:13:42 -07:00
allen 2551f8748d Merge pull request 'v1.1.1: harden deployment for easier fielding' (#9) from release/v1.1.1 into main 2026-06-10 09:32:54 -07:00
root 7b7733d202 v1.1.1: harden deployment for easier fielding
Make a fresh deploy (especially Docker) work with no manual steps and behave
well on real-world hosts:

- Auto-scan skips subnets larger than /20 (e.g. a docker bridge 172.17.0.0/16
  = 65k hosts) so AUTO discovery no longer stalls startup or hammers the
  network on any host with Docker. Manual scan shares the same MIN_SCAN_PREFIX.
- Docker: config.json is auto-seeded from config.json.example by a new
  docker-entrypoint.sh and persisted on a ./data directory mount — no more
  single-file bind-mount footgun, no manual cp before first run.
- Config path is overridable via ADSBIT_CONFIG (defaults to ./config.json for
  bare metal; /app/data/config.json in the container).
- New /health endpoint (status/version/receivers/flights) + Docker HEALTHCHECK.
- Clean SIGTERM/SIGINT shutdown (docker stop / systemctl stop) — no traceback.
- .gitignore/.dockerignore exclude the data/ config volume.
- README/CLAUDE.md updated; VERSION bumped to 1.1.1.

Verified: image builds, fresh `docker run` seeds config and reports healthy,
oversized subnets skipped in-container, /health responds, graceful shutdown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 09:32:36 -07:00
allen 0d4181fd9a Merge pull request 'Prep v1.1.0 release: version string, gitignore secrets, docs' (#8) from release/v1.1.0 into main 2026-06-09 23:41:25 -07:00
root cb387e8d12 Prep v1.1.0 release: version string, gitignore secrets, docs
- Add VERSION = "1.1.0" to server.py; print at startup, expose via public
  GET /api/config, and show it in the admin header (so deployed == released
  is verifiable at a glance).
- Ignore config.json in .gitignore — it holds the admin password hash and
  session secret; fresh installs use config.json.example.
- README/CLAUDE.md: document the in-app pixel editor (now with shape tools,
  select/move, reference overlay, custom/recent palettes), the receiver health
  dashboard, 9 sprite types, and the asset cache-busting convention.
- Bump admin asset cache-bust to ?v=20260609d.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 23:41:00 -07:00
allen 79fdbc4687 Merge pull request 'Pixel editor: shape tools, select/move, reference overlay, color tools' (#7) from feature/pixel-editor-enhancements into main 2026-06-09 15:53:05 -07:00
root 5fabd035c2 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 3e7cc11e08 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 58f7fb11a3 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 3f62661ed7 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 b271c15267 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 3a3d46119a 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 0b16218ce9 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 248c33ed80 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 933fa8f257 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 883ef20ced 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 ed4397b21b 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 da188ea290 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 42a50037ab 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
22 changed files with 501 additions and 174 deletions
+1
View File
@@ -3,6 +3,7 @@ __pycache__
*.pyc
*.pyo
config.json
data/
screenshots/
.claude/
CLAUDE.md
+29
View File
@@ -0,0 +1,29 @@
---
name: Bug report
about: Report something that isn't working
title: "[Bug] "
labels: bug
---
**Describe the bug**
A clear description of what's wrong.
**To reproduce**
Steps to reproduce the behavior:
1.
2.
**Expected behavior**
What you expected to happen.
**Screenshots / logs**
If applicable, add screenshots or server log output.
**Environment**
- ADS-Bit version (admin header or `GET /api/config`):
- Install method: [ ] bare metal [ ] Docker [ ] Podman
- OS / Python version:
- Receiver / feed (e.g. dump1090, readsb) and how it's reached:
**Additional context**
Anything else that might help.
+18
View File
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea or improvement
title: "[Feature] "
labels: enhancement
---
**What problem does this solve?**
A clear description of the need or pain point.
**Proposed solution**
What you'd like to happen.
**Alternatives considered**
Any other approaches you thought about.
**Additional context**
Mockups, examples, or references.
+19
View File
@@ -0,0 +1,19 @@
## Summary
<!-- What does this PR change, and why? -->
## Related issues
<!-- e.g. Closes #123 -->
## How was this tested?
<!-- Commands run, manual steps, screenshots. For Docker changes, note that
`docker build` succeeds. -->
## Checklist
- [ ] Server starts and the change works locally (`python3 server.py`)
- [ ] If admin assets changed, bumped the `?v=` cache-bust token in `admin/admin.html`
- [ ] If behavior/version changed, updated `VERSION` and `CHANGELOG.md`
- [ ] No secrets or local config committed (`config.json` stays ignored)
+17
View File
@@ -0,0 +1,17 @@
version: 2
updates:
# Keep GitHub Actions pinned versions current.
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
commit-message:
prefix: "ci"
# Keep Python dependencies current.
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
commit-message:
prefix: "deps"
+30
View File
@@ -0,0 +1,30 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
python:
name: Python checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Byte-compile server
run: python -m compileall -q server.py
- name: Validate example config is valid JSON
run: python -c "import json; json.load(open('config.json.example'))"
docker:
name: Docker build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build -t ads-bit:ci .
+35
View File
@@ -0,0 +1,35 @@
name: CodeQL
# Static security analysis (free for public repositories). Scans the Python
# backend and the vanilla-JS frontend on pushes, PRs, and weekly.
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "23 5 * * 1"
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
actions: read
strategy:
fail-fast: false
matrix:
language: [python, javascript]
steps:
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Analyze
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
+59
View File
@@ -0,0 +1,59 @@
name: Release
# Build and publish a multi-arch image to GitHub Container Registry (GHCR)
# whenever a version tag is pushed (e.g. v1.1.2). Lets users run a prebuilt
# image — including on Raspberry Pi (arm64) — without building locally.
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: "Image tag to publish (e.g. 1.1.2); leave blank for just :latest"
required: false
default: ""
permissions:
contents: read
packages: write
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compute lowercase image name
id: img
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata (tags & labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.img.outputs.name }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+7 -2
View File
@@ -15,6 +15,7 @@ __pycache__/
# Claude Code
.claude/
CLAUDE.md
# Gitea token
.gitea-token
@@ -23,5 +24,9 @@ __pycache__/
.DS_Store
Thumbs.db
# Local config (uncomment if you want to ignore local changes)
# config.json
# Local config — contains the admin password hash and session secret.
# Fresh installs start from config.json.example (see CONFIG.md).
config.json
# Docker config volume (holds the live config.json with secrets)
data/
+61
View File
@@ -0,0 +1,61 @@
# Changelog
All notable changes to this project are documented here. The format is based
on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to
[Semantic Versioning](https://semver.org/).
## [1.1.2] - 2026-06-10
First release with a published container image and security tooling. No
application behavior changes from 1.1.1.
### Added
- Prebuilt multi-arch (amd64 + arm64) container image published to GitHub
Container Registry: `ghcr.io/allennpit/ads-bit`.
- CodeQL code-scanning workflow (Python + JavaScript) and Dependabot updates
for GitHub Actions and pip.
- `workflow_dispatch` trigger on the release workflow for manual image builds.
## [1.1.1] - 2026-06-10
### Added
- `/health` endpoint (status, version, receiver/flight counts) plus a Docker
`HEALTHCHECK`.
- `ADSBIT_CONFIG` environment variable to override the config file path.
### Changed
- Docker first-run now works with no manual steps: `config.json` is auto-seeded
from `config.json.example` by `docker-entrypoint.sh` and persisted on a
`./data` directory mount (removing the single-file bind-mount footgun).
- Network auto-scan skips subnets larger than `/20` (e.g. a Docker bridge
`172.17.0.0/16`) so discovery no longer stalls startup on Docker hosts.
- `SIGTERM`/`SIGINT` (`docker stop`, `systemctl stop`) shut down cleanly
without a stack trace.
## [1.1.0] - 2026-06-09
### Added
- In-app pixel editor for sprites (admin → Sprites → EDIT): pencil, eraser,
color picker, fill bucket, line/rectangle/ellipse shapes, rectangular
select with move/cut/copy/paste, reference-image overlay, brush size &
opacity, custom + recent palettes, zoom/pan, grid, undo/redo.
- Receiver health dashboard: live per-receiver status (receiving / no data /
unreachable), connection testing, a select → save → apply flow, selectable
scan results, and a per-interface scan selector.
- Version surfaced at startup, via `GET /api/config`, and in the admin header.
### Fixed
- Server crash when restarting receiver connections: cancelled receiver tasks
no longer tear down the main event loop.
## [1.0] - 2026-01
### Added
- Initial release: retro SNES-style side-view ADS-B flight tracker with custom
pixel-art sprites, directional backgrounds, weather, sun/moon, admin panel,
first-run setup wizard, and Docker/Podman support.
[1.1.2]: https://github.com/AllenNPIT/ADS-Bit/releases/tag/v1.1.2
[1.1.1]: https://github.com/AllenNPIT/ADS-Bit/releases/tag/v1.1.1
[1.1.0]: https://github.com/AllenNPIT/ADS-Bit/releases/tag/v1.1.0
[1.0]: https://github.com/AllenNPIT/ADS-Bit/releases/tag/v1.0
-147
View File
@@ -1,147 +0,0 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
ADS-Bit is a retro SNES-style side-view flight tracker that displays ADS-B aircraft data with custom pixel art sprites.
## Running the Server
```bash
# Start the server (port configured in config.json, default 2001)
python3 server.py
# Or use the startup script
./start.sh
```
Access at http://localhost:{web_port} (configured in config.json)
## Architecture
### Components
- **server.py** - Python WebSocket server using aiohttp
- Reads configuration from config.json
- Auto-scans for ADS-B receivers or connects to configured IPs
- Parses SBS/BaseStation format messages from receivers (port 30003)
- Polls dump1090 JSON API (`/dump1090/data/aircraft.json`) every 5s for ADS-B emitter categories
- Broadcasts flight data (including emitter category) to WebSocket clients every 1 second
- Cleans up flights not seen in 60 seconds
- Serves static files, admin panel, setup wizard, and APIs
- Authentication via bcrypt password hashing and session cookies
- **config.json** - Configuration file for receiver and location settings
- See CONFIG.md for full documentation
- **ads-bit.js** - JavaScript rendering engine (Canvas-based)
- Handles WebSocket connection and flight data updates
- Renders 10 FPS retro-style canvas animation
- Layer order (bottom to top): sky gradient → clouds → sun → moon → directional background → grid → aircraft → labels
- Directional backgrounds include horizon, so low sun/moon is realistically occluded
- Aircraft sprites flip horizontally when heading west (track 90°-270°)
- View direction rotates between N/E/S/W (arrow keys or A/D), changing the background
- **index.html** - Main HTML interface with embedded styles
- **admin/** - Admin panel (login + tabbed settings UI)
- 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)
- **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
- Zoom/pan, undo/redo (snapshot-per-stroke), grid overlay, retro palette + native color input
- 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 tools, Space=pan, +/-/0 zoom, Ctrl+Z/Y undo/redo, G grid, Esc close
- **setup/** - First-run setup wizard (multi-step configuration)
### Sprite Assets
All PNG sprites face right (eastward) and are flipped in-canvas for westbound aircraft:
- 9 aircraft types: smallProp, regionalJet, narrowBody, wideBody, heavy, helicopter, balloon, glider, uav
- Directional backgrounds: north.png, south.png, east.png, west.png (1536x1024, shown based on view direction)
- Celestial: sun.png, moon_6_phases.png (2x3 sprite sheet)
- Weather: happycloud.png (clear), raincloud.png (rain/snow)
### Aircraft Type Detection Logic
Two-tier system: real ADS-B emitter categories when available, heuristic fallback otherwise.
#### Tier 1: ADS-B Emitter Category (from dump1090 JSON API)
The server polls `http://{receiver_ip}/dump1090/data/aircraft.json` every 5 seconds. The SBS/BaseStation protocol (port 30003) does **not** include emitter category, but the dump1090/readsb JSON API exposes the raw ADS-B transponder category field. When available, this is authoritative and always preferred over heuristics.
Mapping from DO-260B emitter categories to sprite types:
| ADS-B Category | Description | Sprite |
|---|---|---|
| A1 | Light (< 15,500 lbs) | smallProp |
| A2 | Small (15,500 - 75,000 lbs) | regionalJet |
| A3 | Large (75,000 - 300,000 lbs) | narrowBody |
| A4 | High vortex large (B757) | narrowBody |
| A5 | Heavy (> 300,000 lbs) | wideBody or heavy (by altitude/speed) |
| A6 | High performance (> 5g, > 400 kts) | narrowBody |
| A7 | Rotorcraft | helicopter |
| B1 | Glider / sailplane | glider |
| B2 | Lighter-than-air | balloon |
| B4 | Skydiver drop plane | smallProp |
| B6 | UAV | uav |
Once an emitter category is received for an aircraft, it is locked in and heuristic re-evaluation is skipped.
#### Tier 2: Heuristic Fallback (when no emitter category available)
Priority order when ADS-B category is not available (some transponders don't broadcast it):
1. **Helicopter callsigns**: known operator prefixes (LFE, MED, CHP, PHI, ERA, BHS) or keywords (LIFE, MERCY, COPTER, etc.)
2. **Heavy/Wide body callsigns**: major airline ICAO prefixes (CPA, UAE, ETH, QTR, SIA, AAL, DAL, UAL, FDX, UPS, etc.) + altitude/speed thresholds
3. **Altitude/speed extremes**: altitude > 42000 ft or speed > 550 kts = heavy; > 40000 ft or > 500 kts = wideBody
4. **N-number (US GA registration)**: pattern `N` + digit + 2-4 alphanumerics = smallProp (or narrowBody if above 25000 ft)
5. **Regional airline callsigns**: SKW, RPA, ASH, PDT, CHQ, ENY, JIA, CPZ
6. **Speed/altitude heuristics**: speed < 60 + alt < 5000 = helicopter; alt < 18000 + speed < 300 = smallProp or regionalJet
7. **Altitude-only**: < 10000 ft = smallProp, < 25000 ft = regionalJet, higher = narrowBody
8. **Default**: narrowBody (re-evaluated when better data arrives)
Important: `speed=0` or `altitude=0` means data not yet received, not actual zero. The system re-categorizes when better data arrives (speed > 0 and callsign present).
### View Direction Controls
The viewer can rotate between cardinal directions (N/E/S/W), showing aircraft in a 90° field of view:
- **Keyboard**: Left/Right arrow keys or A/D keys
- **UI**: Arrow buttons on the interface
- Each direction displays a unique background image (north.png, east.png, south.png, west.png)
- Sun and moon positions are calculated based on actual azimuth and only appear when in the current field of view
### External APIs
- **Open-Meteo**: Weather and sunrise/sunset data (updates every 10 minutes)
- **ADS-B Receivers**: SBS/BaseStation protocol on port 30003 (flight data)
- **dump1090 JSON API**: `http://{receiver}/dump1090/data/aircraft.json` on port 80 (emitter categories, polled every 5s)
## Dependencies
Python packages required:
- aiohttp (web server and WebSocket)
- netifaces (network interface scanning)
- bcrypt (password hashing)
No package.json - frontend is vanilla JavaScript with no build step.
## Key Code Patterns
- Canvas version parameter on assets (`?v=36`) for cache busting
- Aircraft direction: `const isFacingLeft = flight.track > 90 && flight.track < 270`
- Moon phases use sprite sheet cropping with 2x3 grid (3 columns, 2 rows)
- Flight data stored in global `flights` dict keyed by ICAO hex code
## Debugging
```bash
# Check for running server instances
ps aux | grep server.py
# Kill all instances
pkill -9 -f server.py
# Test receiver connectivity (replace with your receiver IP)
nc -zv <receiver_ip> 30003
```
+59
View File
@@ -0,0 +1,59 @@
# Contributing to ADS-Bit
Thanks for your interest in improving ADS-Bit! Contributions of all kinds —
bug reports, features, sprites, themes, docs — are welcome.
## Development setup
ADS-Bit is a Python (aiohttp) backend with a vanilla-JavaScript frontend.
There is **no build step** for the frontend.
```bash
git clone <your-fork-url>
cd ADS-Bit
pip install -r requirements.txt # Python 3.93.11 recommended (see note below)
cp config.json.example config.json # optional; the setup wizard runs otherwise
python3 server.py # serves on http://localhost:2001
```
Or with Docker (no local Python needed):
```bash
docker compose up -d
```
> **Python version note:** the `netifaces` dependency can be hard to build on
> Python 3.12+. Use Python 3.93.11, or just use the Docker image (Python 3.11).
## Project layout
- `server.py` — aiohttp server: receiver connections, flight state, APIs, auth.
- `ads-bit.js` / `index.html` — Canvas-based retro viewer.
- `admin/` — admin panel, including the in-browser `pixel-editor.js`.
- `setup/` — first-run setup wizard.
- `images/`, `backgrounds/` — sprite and theme assets.
## Conventions
- **Frontend assets are cache-busted** via a `?v=YYYYMMDD[x]` query in
`admin/admin.html`. If you change `admin.css`, `admin.js`, or
`pixel-editor.js`, bump that token so browsers reload them.
- The `VERSION` constant in `server.py` is the single source of truth; bump it
for releases and add a `CHANGELOG.md` entry.
- Keep the retro aesthetic (Press Start 2P, blue/gold palette) for UI work.
- Match the style of surrounding code; no frontend framework or build tooling.
## Submitting changes
1. Fork and create a topic branch (`feature/…`, `fix/…`, `chore/…`).
2. Make focused commits with clear messages.
3. Verify locally: the server starts, the page loads, and your change works.
For Docker changes, confirm `docker build` succeeds.
4. Open a pull request describing what changed and how you tested it.
CI will byte-compile the server, validate `config.json.example`, and build the
Docker image on every PR.
## Reporting bugs / requesting features
Use the issue templates. For security issues, see [SECURITY.md](SECURITY.md).
+9 -2
View File
@@ -13,9 +13,16 @@ RUN pip install --no-cache-dir -r requirements.txt && \
rm -rf /var/lib/apt/lists/*
COPY . .
RUN chmod +x /app/docker-entrypoint.sh
EXPOSE 2001
ENV PYTHONUNBUFFERED=1
# Persist config on a mounted volume by default (see docker-compose.yml).
ENV PYTHONUNBUFFERED=1 \
ADSBIT_CONFIG=/app/data/config.json
CMD ["python3", "server.py"]
# Liveness probe against the unauthenticated /health endpoint.
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"]
+34 -12
View File
@@ -1,5 +1,9 @@
# ADS-Bit
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Release](https://img.shields.io/github/v/release/AllenNPIT/ADS-Bit)](https://github.com/AllenNPIT/ADS-Bit/releases)
[![CI](https://github.com/AllenNPIT/ADS-Bit/actions/workflows/ci.yml/badge.svg)](https://github.com/AllenNPIT/ADS-Bit/actions/workflows/ci.yml)
A retro SNES-style side-view flight tracker that displays ADS-B aircraft data with custom pixel art sprites.
![ADS-Bit Screenshot](screenshots/screenshot.png)
@@ -7,14 +11,16 @@ A retro SNES-style side-view flight tracker that displays ADS-B aircraft data wi
## Features
- Real-time aircraft tracking via ADS-B receivers
- Custom pixel art sprites for 6 aircraft types (small prop, regional jet, narrow body, wide body, heavy, helicopter)
- Custom pixel art sprites for 9 aircraft types (small prop, regional jet, narrow body, wide body, heavy, helicopter, balloon, glider, UAV)
- Animated sun and moon with accurate astronomical positions
- Dynamic sky colors based on time of day
- Weather visualization with cloud sprites
- Directional view (N/E/S/W) with themed backgrounds
- Auto-discovery of ADS-B receivers on your network
- Auto-discovery of ADS-B receivers on your network, with per-interface scanning
- Canvas-based 10 FPS retro rendering
- 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
## Quick Start
@@ -39,17 +45,33 @@ On first run, visit http://localhost:2001 and the setup wizard will guide you th
- [Docker](https://docs.docker.com/get-docker/) with Compose V2, **or** [Podman](https://podman.io/) with `podman-compose`
### First Run
### Run the prebuilt image (no clone needed)
Once a release is published, a multi-arch image (amd64 + arm64, e.g. Raspberry Pi)
is available from GitHub Container Registry:
```bash
# Create a config file (the setup wizard runs if you skip this)
cp config.json.example config.json
docker run -d --name ads-bit --network host --restart unless-stopped \
-e ADSBIT_CONFIG=/app/data/config.json \
-v "$PWD/data:/app/data" \
ghcr.io/allennpit/ads-bit:latest
```
# Build and start
Then open http://localhost:2001 and complete the setup wizard.
### Build from source
```bash
# Build and start — no config step needed
docker compose up -d
```
The web UI is available at http://localhost:2001.
A config file is created automatically in `data/` on first run, then the
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
@@ -80,15 +102,15 @@ The following paths are bind-mounted from the repo directory and persist across
| Path | Contents |
|------|----------|
| `config.json` | Server configuration and credentials |
| `data/` | Server configuration and credentials (`config.json`, auto-seeded) |
| `images/` | Aircraft and UI sprites (including uploads) |
| `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.
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.
## Requirements
- Python 3.8+
- Python 3.93.11 (3.12+ may require build tools for `netifaces`; the Docker image uses 3.11)
- ADS-B receiver providing SBS/BaseStation format on port 30003 (dump1090, readsb, etc.)
- Modern web browser with Canvas support
@@ -102,8 +124,8 @@ ADS-Bit uses a first-run setup wizard to configure your installation. You can al
"receiver_port": 30003,
"location": {
"name": "My Location",
"lat": 0.0,
"lon": 0.0
"lat": 36.2788,
"lon": -115.2283
},
"web_port": 2001,
"theme": "desert"
+35
View File
@@ -0,0 +1,35 @@
# Security Policy
## Supported Versions
| Version | Supported |
|---------|-----------|
| 1.1.x | ✅ |
| < 1.1 | ❌ |
## Reporting a Vulnerability
Please **do not** open a public issue for security vulnerabilities.
Instead, use GitHub's private vulnerability reporting:
**Security → Report a vulnerability** on the repository.
Include as much detail as you can:
- Affected version (see the version in the admin header or `GET /api/config`)
- Steps to reproduce / proof of concept
- Impact and any suggested remediation
You can expect an acknowledgement within a few days. Please allow reasonable
time for a fix before any public disclosure.
## Security Notes for Operators
ADS-Bit is intended for trusted LANs, not direct exposure to the public
internet. If you must expose it:
- Set a strong admin password (changed from the setup default).
- Put it behind HTTPS via a reverse proxy or tunnel (e.g. Caddy, nginx,
Tailscale). The built-in server speaks plain HTTP.
- Never commit your `config.json` — it contains the admin password hash and
session secret. It is git-ignored by default; fresh installs start from
`config.json.example`.
+9
View File
@@ -169,6 +169,15 @@ textarea {
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 {
display: flex;
gap: 8px;
+4 -4
View File
@@ -7,7 +7,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<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 rel="stylesheet" href="/admin/admin.css?v=20260609c">
<link rel="stylesheet" href="/admin/admin.css?v=20260609d">
</head>
<body>
<!-- Login Screen -->
@@ -27,7 +27,7 @@
<!-- Admin Panel -->
<div id="admin-panel" class="hidden">
<header class="admin-header">
<h1 class="retro-title">ADS-Bit Admin</h1>
<h1 class="retro-title">ADS-Bit Admin <span id="admin-version" class="admin-version"></span></h1>
<div class="header-actions">
<a href="/" class="btn btn-small">VIEWER</a>
<button id="logout-btn" class="btn btn-small btn-danger">LOGOUT</button>
@@ -297,7 +297,7 @@
<div id="toast" class="toast hidden"></div>
</div>
<script src="/admin/pixel-editor.js?v=20260609c"></script>
<script src="/admin/admin.js?v=20260609c"></script>
<script src="/admin/pixel-editor.js?v=20260609d"></script>
<script src="/admin/admin.js?v=20260609d"></script>
</body>
</html>
+12
View File
@@ -28,10 +28,22 @@
loadConfig();
loadThemes();
loadNetworkInfo();
loadVersion();
refreshStatus();
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) => {
e.preventDefault();
const pw = document.getElementById('login-password').value;
+4 -2
View File
@@ -6,9 +6,11 @@ services:
restart: unless-stopped
environment:
- PYTHONUNBUFFERED=1
- ADSBIT_CONFIG=/app/data/config.json
volumes:
# Persist config (copy config.json.example to config.json before first run)
- ./config.json:/app/config.json
# Config persists here; auto-seeded from config.json.example on first run
# (a directory mount, so a fresh `docker compose up` just works).
- ./data:/app/data
# Persist custom sprite uploads
- ./images:/app/images
# Persist custom theme backgrounds
+16
View File
@@ -0,0 +1,16 @@
#!/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.

After

Width:  |  Height:  |  Size: 264 KiB

+42 -4
View File
@@ -17,8 +17,16 @@ from aiohttp import web, ClientSession, ClientTimeout
import netifaces
import bcrypt
VERSION = "1.1.2"
WEB_DIR = Path(__file__).parent
CONFIG_FILE = WEB_DIR / "config.json"
# Config path is overridable (handy for containers persisting config on a
# 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
SERVER_START_TIME = time.time()
@@ -412,6 +420,15 @@ async def scan_for_receivers():
if ip and netmask and not ip.startswith('127.'):
try:
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))
except ValueError as e:
print(f"Invalid network {ip}/{netmask}: {e}")
@@ -549,6 +566,7 @@ async def handle_receiver_location(request):
async def handle_config(request):
"""Return client-relevant configuration (public, no secrets)."""
return web.json_response({
"version": VERSION,
"theme": config.get("theme", "desert"),
"location": config["location"],
"receivers": receivers,
@@ -981,9 +999,10 @@ async def handle_admin_scan_receivers(request):
return web.json_response(
{"error": f"Invalid subnet: {subnet}"}, status=400)
if network.prefixlen < 20:
if network.prefixlen < MIN_SCAN_PREFIX:
return web.json_response(
{"error": "Subnet too large (max /20 = 4096 hosts)"}, status=400)
{"error": f"Subnet too large (max /{MIN_SCAN_PREFIX} = "
f"{2 ** (32 - MIN_SCAN_PREFIX) - 2} hosts)"}, status=400)
port = config['receiver_port']
found = await _scan_subnet(network, port)
@@ -1169,6 +1188,17 @@ async def handle_http(request):
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
# ---------------------------------------------------------------------------
@@ -1181,6 +1211,7 @@ async def start_http_server():
app.router.add_get('/ws', websocket_handler)
# Public API
app.router.add_get('/health', handle_health)
app.router.add_get('/api/receiver-location', handle_receiver_location)
app.router.add_get('/api/config', handle_config)
@@ -1231,7 +1262,7 @@ async def main():
"""Main entry point"""
global receivers, receiver_tasks
print("ADS-Bit Server Starting...")
print(f"ADS-Bit Server v{VERSION} Starting...")
load_config()
@@ -1279,4 +1310,11 @@ async def 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())
except (KeyboardInterrupt, SystemExit):
print("ADS-Bit server shutting down.")