Clean Python Flask replacement for odc-api (434k lines Node.js → ~350 lines Python)
- GET /api/1/landmarks/last/{N} - last N detections from SQLite
- POST /api/1/landmarks - ingest detections + forward to AdaMaps
- GET /api/1/gnssConcise/latestValid - GPS fix from Redis
- GET /api/1/status - device status
- GET /api/1/deviceinfo - device identity
- GET /api/1/recording/frames/latest - latest frame path
No /api/1/cmd - that's the CVE, it's gone.
Includes:
- SQLite for local storage + offline queue
- Background thread for AdaMaps retry
- systemd service unit
- install.sh for device deployment
34 lines
856 B
Bash
Executable file
34 lines
856 B
Bash
Executable file
#!/bin/bash
|
|
# adacam-api installer for Hivemapper Bee device
|
|
set -e
|
|
|
|
INSTALL_DIR="/opt/adacam"
|
|
DATA_DIR="/data/adacam"
|
|
|
|
echo "[*] Installing adacam-api..."
|
|
|
|
# Create directories
|
|
mkdir -p "$INSTALL_DIR" "$DATA_DIR"
|
|
|
|
# Copy files
|
|
cp -r adacam_api main.py requirements.txt "$INSTALL_DIR/"
|
|
|
|
# Install Python dependencies
|
|
pip3 install --no-cache-dir -r "$INSTALL_DIR/requirements.txt"
|
|
|
|
# Install systemd service
|
|
cp systemd/adacam-api.service /etc/systemd/system/
|
|
systemctl daemon-reload
|
|
systemctl enable adacam-api
|
|
|
|
# Generate device ID if not present
|
|
if [ ! -f "$DATA_DIR/config.json" ]; then
|
|
python3 -c "from adacam_api import config; config.load()"
|
|
echo "[*] Generated new device ID"
|
|
fi
|
|
|
|
echo "[*] Starting adacam-api..."
|
|
systemctl restart adacam-api
|
|
systemctl status adacam-api --no-pager
|
|
|
|
echo "[+] Installation complete. API running on port 5000"
|