mirror of
https://github.com/trailofbits/algo.git
synced 2026-09-09 19:27:49 +02:00
Implements issue #196 - a local web application that allows users to deploy Algo VPN servers through a browser-based GUI. Features: - Single-step launch: `./algo-web` opens browser automatically - Cloud provider support: DigitalOcean, Hetzner, Linode, Vultr (MVP) - Real-time credential validation via provider APIs - Dynamic region loading after validation - Live deployment progress streaming via SSE - Terminal-style output with color-coded log lines - Config file downloads (individual + ZIP archive) Technical stack: - Starlette + uvicorn (ASGI web framework) - htmx for frontend interactivity (no build step) - Server-Sent Events for streaming Ansible output - Credentials passed via --extra-vars (never persisted) Design: - "Luxury Terminal" dark theme with electric teal accents - Algo VPN and Trail of Bits branding - Responsive layout (desktop, tablet, mobile) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
75 lines
2.2 KiB
Bash
Executable File
75 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
# Algo VPN Web UI launcher
|
|
# Starts a local web server and opens the browser for GUI-based VPN deployment
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Configuration via environment variables
|
|
PORT="${ALGO_WEB_PORT:-8080}"
|
|
HOST="${ALGO_WEB_HOST:-127.0.0.1}"
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${CYAN}"
|
|
echo " _ _ __ ______ _ _ "
|
|
echo " / \ | | __ _ ___ \ \ / / _ \| \ | |"
|
|
echo " / _ \ | |/ _\` |/ _ \ \ \ / /| |_) | \| |"
|
|
echo " / ___ \| | (_| | (_) | \ V / | __/| |\ |"
|
|
echo "/_/ \_\_|\__, |\___/ \_/ |_| |_| \_|"
|
|
echo " |___/ "
|
|
echo -e "${NC}"
|
|
echo "Web UI for deploying personal VPN servers"
|
|
echo ""
|
|
|
|
# Check if uv is installed
|
|
if ! command -v uv &> /dev/null; then
|
|
echo -e "${RED}Error: uv is not installed.${NC}"
|
|
echo "Please run ./algo first to install uv, or install it manually:"
|
|
echo " curl -LsSf https://astral.sh/uv/install.sh | sh"
|
|
exit 1
|
|
fi
|
|
|
|
# Install web dependencies if needed
|
|
echo "Checking dependencies..."
|
|
if ! uv pip show starlette &> /dev/null 2>&1; then
|
|
echo "Installing web dependencies..."
|
|
uv pip install '.[web]' --quiet
|
|
fi
|
|
|
|
echo -e "${GREEN}Starting Algo VPN Web UI${NC}"
|
|
echo -e "Server: ${CYAN}http://$HOST:$PORT${NC}"
|
|
echo ""
|
|
echo "Press Ctrl+C to stop the server"
|
|
echo ""
|
|
|
|
# Open browser after short delay (background)
|
|
# Use platform-specific command
|
|
open_browser() {
|
|
local url="http://$HOST:$PORT"
|
|
sleep 1.5
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
open "$url" 2>/dev/null || true
|
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
xdg-open "$url" 2>/dev/null || sensible-browser "$url" 2>/dev/null || true
|
|
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
|
|
start "$url" 2>/dev/null || true
|
|
else
|
|
# Fallback: try python webbrowser module
|
|
python3 -c "import webbrowser; webbrowser.open('$url')" 2>/dev/null || true
|
|
fi
|
|
}
|
|
|
|
open_browser &
|
|
|
|
# Run web server (foreground)
|
|
exec uv run uvicorn app.main:app --host "$HOST" --port "$PORT" --no-access-log
|