Rollen-basiertes Zugriffsystem (public/user/admin), Registrierung mit E-Mail-Verifikation, bcrypt Passwort-Hashing, Admin-Benutzerverwaltung. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
54 lines
3 KiB
Markdown
54 lines
3 KiB
Markdown
# MeshDD-Bot Project Memory
|
|
|
|
## Workflow Rules
|
|
- **Every commit** must include: version bump in `config.yaml` + CHANGELOG.md entry
|
|
- Version is in `config.yaml` (field `version:`), NOT in a separate version.py
|
|
- Changelog format: `## [x.y.z] - YYYY-MM-DD` with `### Added/Changed/Removed` sections
|
|
|
|
## Project Structure
|
|
- Config: `config.yaml` (live-reloaded via file watcher in `meshbot/config.py`)
|
|
- Bot: `meshbot/bot.py` - Meshtastic TCP, commands use `config.get("bot.command_prefix")`
|
|
- Auth: `meshbot/auth.py` - Session-Middleware, Passwort-Hashing, Auth-Routen, Admin-API, Email
|
|
- Web: `meshbot/webserver.py` - aiohttp + WebSocket + Auth-Integration
|
|
- DB: `meshbot/database.py` - SQLite via aiosqlite (nodes, messages, commands, users, tokens, email_logs)
|
|
- Scheduler: `meshbot/scheduler.py` - Cron-based job scheduler
|
|
- Frontend: `static/` - Bootstrap 5.3 dark/light theme, AdminLTE-style layout
|
|
- Entry: `main.py`
|
|
|
|
## Pages & Routes
|
|
- `/` - Dashboard (`static/index.html`, `static/js/dashboard.js`)
|
|
- `/scheduler` - Scheduler (`static/scheduler.html`, `static/js/scheduler.js`) - Admin only
|
|
- `/map` - Leaflet map (`static/map.html`, `static/js/map.js`) - Public
|
|
- `/settings` - Node config (`static/settings.html`, `static/js/settings.js`) - Admin only
|
|
- `/login` + `/register` - Auth (`static/login.html`, `static/js/login.js`)
|
|
- `/admin` - User management (`static/admin.html`, `static/js/admin.js`) - Admin only
|
|
- `/ws` - WebSocket endpoint
|
|
- Auth: `/auth/login`, `/auth/register`, `/auth/logout`, `/auth/verify`, `/auth/set-password`, `/auth/forgot-password`, `/auth/reset-password`
|
|
- API: `/api/nodes`, `/api/messages`, `/api/stats`, `/api/send` (user), `/api/node/config` (admin), `/api/scheduler/jobs` (admin)
|
|
- API Auth: `/api/auth/me`, `/api/admin/users`, `/api/admin/users/{id}/role`, `/api/admin/users/{id}/verify`
|
|
|
|
## Rollen & Zugriffsrechte
|
|
| Bereich | Public | User | Admin |
|
|
|---------|--------|------|-------|
|
|
| `/map`, `/` (Nodes, Stats) | Ja | Ja | Ja |
|
|
| Dashboard Nachrichten + Senden | Nein | Ja | Ja |
|
|
| `/scheduler`, `/settings` | Nein | Nein | Ja |
|
|
| `/admin` | Nein | Nein | Ja |
|
|
|
|
## Frontend Layout Pattern
|
|
- All pages use consistent AdminLTE-style: top-navbar (46px), sidebar (200px), content-wrapper
|
|
- Sidebar nav with active state, 5 entries: Dashboard, Scheduler, Karte, Einstellungen, Benutzer
|
|
- Admin-only sidebar entries use class `sidebar-admin` (hidden via JS if not admin)
|
|
- Navbar: User-Name + Logout button (logged in) or Login button (not logged in)
|
|
- Each JS file has: auth check (`/api/auth/me`), updateNavbar(), updateSidebar(), theme toggle, sidebar toggle
|
|
- Shared styles in `static/css/style.css`
|
|
|
|
## Key Details
|
|
- Meshtastic host configured in config.yaml, not env vars
|
|
- Bot start: `/home/peter/meshdd-bot/venv/bin/python main.py`
|
|
- Forgejo remote with token in URL
|
|
- Current version: 0.5.0
|
|
- Protobuf objects converted via `google.protobuf.json_format.MessageToDict()`
|
|
- Auth: bcrypt (12 rounds), aiohttp-session EncryptedCookieStorage, aiosmtplib for emails
|
|
- SMTP fallback: if no smtp.host configured, verification links logged to console
|