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
24 lines
580 B
Python
24 lines
580 B
Python
"""Flask app factory."""
|
|
from flask import Flask
|
|
from . import config, db, forwarder
|
|
from .routes import landmarks, gnss, status, frames
|
|
|
|
|
|
def create_app():
|
|
"""Create and configure the Flask app."""
|
|
app = Flask(__name__)
|
|
|
|
# Load config and init DB
|
|
config.load()
|
|
db.init()
|
|
|
|
# Register blueprints
|
|
app.register_blueprint(landmarks.bp)
|
|
app.register_blueprint(gnss.bp)
|
|
app.register_blueprint(status.bp)
|
|
app.register_blueprint(frames.bp)
|
|
|
|
# Start background forwarder thread
|
|
forwarder.start_retry_thread()
|
|
|
|
return app
|