This commit adds the complete Dangerous Pi web management interface with all MVP features implemented and tested locally. ## New Features ### Backend (Python + FastAPI) - Complete FastAPI backend with async support - 40+ API endpoints (Health, PM3, WiFi, Updates, UPS, BLE, Plugins) - 6 managers: Session, WiFi, Update, UPS, BLE, Plugin - SQLite database with sessions, config, history, crash reports - Server-Sent Events (SSE) for real-time notifications - Mock PM3 worker for development without hardware ### WiFi Manager - Interface detection (USB vs built-in) - Network scanning with signal strength - Mode switching (AP/Client/Dual/Auto/Off) - Network connection with password support - Hidden SSID and saved networks support - Static IP and DHCP configuration - 10 WiFi API endpoints ### Update Manager - GitHub releases API integration - Automatic periodic update checks - Semantic version comparison - Update download with progress tracking - SHA256 checksum verification - Automatic installation with backup and rollback - PM3 client rebuild after updates - 6 Update API endpoints ### UPS Manager - I2C battery monitoring (MAX17040-compatible) - Battery percentage, voltage, current tracking - Power source detection (AC/Battery) - Safe shutdown triggers at configurable thresholds - Event callbacks for battery warnings - SSE and BLE notification integration - 3 UPS API endpoints ### BLE Manager - Bluetooth Low Energy notification support - Auto-detects BLE capability - Multiple notification types (updates, battery, shutdown, etc.) - BLE advertising management - Device connection tracking - 4 BLE API endpoints ### Plugin Framework - Dynamic plugin loading/unloading - Plugin lifecycle management (load, enable, disable, unload) - Hook system for extensibility - JSON-based metadata - Example "Hello World" plugin included - 7 Plugin API endpoints ### Frontend (Remix.js + React) - Cyberpunk-themed responsive UI - Dashboard with system status - PM3 command interface with history - Settings page with WiFi and Update management - Command logs viewer - Theme toggle (Dark/Light/Auto) - Server-side rendering (SSR) - Mobile-first responsive design ### System Integration - Systemd service with security hardening - Automated install/uninstall scripts - Environment configuration template - Hardware access groups (i2c, bluetooth, gpio, dialout) - Pi-gen stage 04 integration for OS image building - Port conflict resolution with ttyd-bash - I2C interface auto-enable for UPS HAT ### Testing - test_backend.py - Backend API tests - test_ups.py - UPS manager tests - test_ble.py - BLE manager tests - test_plugins.py - Plugin manager tests - All tests passing locally ### Documentation - 12 comprehensive documentation files - claude.md - AI development guide - WIFI_MANAGER.md - WiFi management guide - UPDATE_MANAGER.md - Update system guide - PORT_CONFLICT.md - Port conflict resolution guide - MVP_COMPLETE.md - MVP implementation summary - PROJECT_STATUS.md - Project status and roadmap - systemd/README.md - Service management docs - pi-gen integration documentation ## Technical Details - ~5,000+ lines of backend code - 11 Python dependencies (smbus2 added for UPS) - FastAPI with async/await throughout - Type hints and docstrings on all functions - RESTful API design with SSE for notifications - Security hardening (non-root, protected dirs, resource limits) ## Next Steps - Deploy to Raspberry Pi Zero 2 W hardware - Test with real Proxmark3 device - Test UPS HAT integration - Test BLE on Pi hardware - Build custom OS image with pi-gen - Performance optimization for Pi Zero 2 W 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
2.0 KiB
Bash
Executable File
68 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Installation script for Dangerous Pi systemd service
|
|
|
|
set -e
|
|
|
|
echo "Installing Dangerous Pi systemd service..."
|
|
|
|
# Check if running as root
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "Error: This script must be run as root (use sudo)"
|
|
exit 1
|
|
fi
|
|
|
|
# Variables
|
|
SERVICE_NAME="dangerous-pi"
|
|
SERVICE_FILE="dangerous-pi.service"
|
|
INSTALL_DIR="/opt/dangerous-pi"
|
|
SYSTEMD_DIR="/etc/systemd/system"
|
|
|
|
# Create installation directory if it doesn't exist
|
|
if [ ! -d "$INSTALL_DIR" ]; then
|
|
echo "Creating installation directory: $INSTALL_DIR"
|
|
mkdir -p "$INSTALL_DIR"
|
|
fi
|
|
|
|
# Copy service file to systemd directory
|
|
echo "Installing systemd service unit..."
|
|
cp "$(dirname "$0")/$SERVICE_FILE" "$SYSTEMD_DIR/"
|
|
chmod 644 "$SYSTEMD_DIR/$SERVICE_FILE"
|
|
|
|
# Create .env file if it doesn't exist
|
|
if [ ! -f "$INSTALL_DIR/.env" ]; then
|
|
echo "Creating environment configuration file..."
|
|
cp "$(dirname "$0")/dangerous-pi.env.example" "$INSTALL_DIR/.env"
|
|
chown pi:pi "$INSTALL_DIR/.env"
|
|
chmod 600 "$INSTALL_DIR/.env"
|
|
echo "NOTE: Please edit $INSTALL_DIR/.env to configure your installation"
|
|
fi
|
|
|
|
# Create data and logs directories
|
|
echo "Creating data and logs directories..."
|
|
mkdir -p "$INSTALL_DIR/data"
|
|
mkdir -p "$INSTALL_DIR/logs"
|
|
chown -R pi:pi "$INSTALL_DIR/data" "$INSTALL_DIR/logs"
|
|
chmod 755 "$INSTALL_DIR/data" "$INSTALL_DIR/logs"
|
|
|
|
# Add pi user to required groups for hardware access
|
|
echo "Adding pi user to hardware access groups..."
|
|
usermod -a -G i2c,bluetooth,gpio,dialout pi || true
|
|
|
|
# Reload systemd daemon
|
|
echo "Reloading systemd daemon..."
|
|
systemctl daemon-reload
|
|
|
|
# Enable service to start on boot
|
|
echo "Enabling $SERVICE_NAME service..."
|
|
systemctl enable "$SERVICE_NAME.service"
|
|
|
|
echo ""
|
|
echo "✅ Installation complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. Edit configuration: sudo nano $INSTALL_DIR/.env"
|
|
echo " 2. Start the service: sudo systemctl start $SERVICE_NAME"
|
|
echo " 3. Check status: sudo systemctl status $SERVICE_NAME"
|
|
echo " 4. View logs: sudo journalctl -u $SERVICE_NAME -f"
|
|
echo ""
|