Files
pi-pm3/app/frontend
michael 2ec89041ef Phase 4 enhancements: WebSocket auth, HTTPS UI, plugin hooks, build fixes
Security:
- Add token-based WebSocket authentication (closes critical security gap)
  - In-memory token store with 24h TTL (token_store.py)
  - POST /api/auth/token exchanges Basic Auth for WS token
  - GET /api/auth/status public endpoint for auth check
  - WebSocket validates token query param, rejects with close code 4401
  - Frontend LoginPrompt modal for credential entry
  - WebSocket manager handles full auth flow with auth_required state
  - No-op when AUTH_ENABLED=false (preserves existing behavior)

HTTPS:
- Wire HTTPS toggle in Settings UI (POST /api/system/ssl/toggle)
- Add certificate regeneration button
- Display SSL info (expiration, SANs, SHA256 fingerprint)

Plugins:
- Wire trigger_hook("pm3_command") in PM3 service
- Wire trigger_hook("update_check") in update manager

Build/Infrastructure:
- Enable NetworkManager in pi-gen AP setup stage
- Add HF booster board detection patch for Proxmark3
- Update LED PWM control patch
- Fix BLE adapter, UPS drivers, WiFi manager improvements
- Update HTTPS support stage script

Documentation:
- Update PROJECT_STATUS.md and IMPLEMENTATION_PRIORITIES.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 11:45:11 -08:00
..
2026-01-06 13:46:22 -08:00
2026-01-06 13:46:22 -08:00
2026-01-06 13:46:22 -08:00

Dangerous Pi Frontend

Modern, lightweight web interface for Proxmark3 management built with Remix.js.

Features

  • Cyberpunk Theme - Dark mode default with light mode support
  • Responsive Design - Mobile-first, works on all screen sizes
  • Real-time Updates - SSE integration for live status
  • Lightweight - Optimized for Pi Zero 2 W (< 150KB bundle)
  • Progressive Enhancement - Works without JavaScript

Tech Stack

  • Framework: Remix v2 (React Router)
  • Styling: Vanilla CSS (no framework, ~15KB)
  • Build: Vite
  • TypeScript: Full type safety

Development

Prerequisites

Install Dependencies

npm install

Start Development Server

npm run dev

Frontend will be available at http://localhost:3000

The dev server proxies API requests to the backend (http://localhost:8000).

Build for Production

npm run build

Start Production Server

npm start

Project Structure

app/
├── routes/              # Page routes
│   ├── _index.tsx       # Dashboard (/)
│   ├── commands.tsx     # PM3 Commands (/commands)
│   ├── settings.tsx     # Settings (/settings)
│   └── logs.tsx         # Command Logs (/logs)
├── root.tsx             # Root layout
├── styles.css           # Global styles
└── entry.*.tsx          # Client/Server entry points

Pages

Dashboard (/)

  • System status (CPU, memory, disk)
  • PM3 connection status
  • Quick actions
  • Real-time SSE updates

Commands (/commands)

  • Execute PM3 commands
  • Quick command buttons
  • Terminal-style output
  • Command history with ↑/↓ navigation

Settings (/settings)

  • General settings (auth, HTTPS)
  • Wi-Fi configuration
  • Advanced options (PM3 device, BLE)
  • System actions (restart, shutdown)

Logs (/logs)

  • Command history table
  • Export functionality (planned)
  • System logs (planned)

Design System

Colors (Cyberpunk)

  • Primary: Cyan (#00ffff)
  • Secondary: Magenta (#ff00ff)
  • Accent: Green (#00ff88)
  • Background: Dark Blue (#0a0e1a)

Typography

  • Sans: System font stack (zero download)
  • Mono: SF Mono, Monaco, Cascadia Code, etc.

Components

  • Buttons (primary, secondary, danger)
  • Cards with hover effects
  • Status badges with pulse animation
  • Terminal-style code blocks
  • Toast notifications
  • Form inputs with focus states

Theme System

Supports three modes:

  • dark - Cyberpunk dark theme (default)
  • light - Clean light theme
  • auto - Follow system preference

Theme persisted in localStorage, toggled via header button.

API Integration

REST Endpoints

// System
GET  /api/health
GET  /api/system/info
POST /api/system/session/create
GET  /api/system/config

// PM3
GET  /api/pm3/status
POST /api/pm3/command
GET  /api/pm3/commands/history

SSE Events

GET /sse/events

// Events:
- connected
- pm3_status
- update_available
- backup_complete
- ups_battery

Performance Optimization

Targets

  • First Contentful Paint: < 1.5s
  • Time to Interactive: < 3s
  • Bundle Size: < 150KB gzipped

Techniques

  • Server-side rendering (SSR)
  • CSS-only animations
  • System fonts (no web fonts)
  • Code splitting by route
  • Minimal dependencies

Accessibility

  • WCAG 2.1 AA compliant
  • Keyboard navigation
  • Focus indicators
  • ARIA labels
  • Screen reader tested

Testing Checklist

  • Works without JavaScript
  • Mobile responsive (320px+)
  • Dark/light mode toggle
  • SSE connection
  • Command execution
  • Session management
  • Keyboard shortcuts
  • Touch targets (44x44px)

Browser Support

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+
  • Mobile browsers (iOS 14+, Android 10+)

Deployment

With Backend

The frontend should be built and served by the backend in production:

# Build frontend
cd app/frontend
npm run build

# Backend serves from build/client/

Standalone (Development)

For development, run separately:

# Terminal 1: Backend
python -m app.backend.main

# Terminal 2: Frontend
cd app/frontend
npm run dev

Contributing

See UI_GUIDELINES.md for design principles and best practices.

License

Part of the Dangerous Pi project. Built for Dangerous Things.