Add Python manager: FastAPI backend + web UI

- main.py: FastAPI app with profile CRUD, start/stop, send message endpoints
- profiles.py: asyncio bot lifecycle using simplex-chat Python SDK
- db.py: SQLite registry tracking profiles, types, config, addresses
- templates/: Jinja2 + HTMX web UI
  - login.html: token-based auth
  - index.html: profile list with live status polling, create dialog
  - profile.html: per-bot dashboard with QR code, contacts/groups, event log, send form
- requirements.txt: fastapi, uvicorn, jinja2, simplex-chat
- start.sh: one-command startup with venv bootstrap

Bot types: echo, broadcast, support (business address), directory, deadmans
Run: cd manager && MANAGER_TOKEN=secret ./start.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jon
2026-06-03 00:53:41 +01:00
parent 5c80ac310f
commit 11e799188d
10 changed files with 1008 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SimpleX Manager — Login</title>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { --bg: #f5f5f7; --card: #fff; --text: #1d1d1f; --accent: #0053D0; --border: #e0e0e5; }
@media (prefers-color-scheme: dark) {
:root { --bg: #111827; --card: #0B2A59; --text: #f5f5f7; --accent: #70F0F9; --border: #1e3a5f; }
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
background: var(--bg); color: var(--text); min-height: 100vh;
display: flex; align-items: center; justify-content: center; }
.box { background: var(--card); border-radius: 12px; padding: 36px 32px;
width: 100%; max-width: 360px; box-shadow: 0 4px 24px rgba(0,0,0,0.1); }
h1 { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 24px; text-align: center; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
input { width: 100%; padding: 10px 12px; font-size: 15px; border: 1px solid var(--border);
border-radius: 8px; background: var(--bg); color: var(--text); outline: none; margin-bottom: 16px; }
input:focus { border-color: var(--accent); }
button { width: 100%; padding: 10px; background: var(--accent); color: #fff; border: none;
border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
@media (prefers-color-scheme: dark) { button { color: #000; } }
.error { color: #DD0000; font-size: 13px; margin-bottom: 12px; text-align: center; }
</style>
</head>
<body>
<div class="box">
<h1>SimpleX Manager</h1>
{% if error %}<div class="error">{{ error }}</div>{% endif %}
<form method="post" action="/login">
<label for="token">Access Token</label>
<input type="password" id="token" name="token" placeholder="Enter token…" autofocus>
<button type="submit">Sign in</button>
</form>
</div>
</body>
</html>