# Dashboard + Multi-Reg System New components added 2026-07-30 for the Conol pool distribution package. ## Architecture additions ``` conol_autoreg/ ├── dashboard_server.py # FastAPI live dashboard (15 KB) — port 9988 ├── multi_reg.py # Multi-threaded parallel registration (20 KB) ├── start_all.bat # Unified launcher with menu (3.3 KB) ├── chrome_cdp.bat # Chrome CDP launcher (667 B) ├── config.example.json # Template config for distribution (734 B) ├── requirements.txt # Python dependencies └── README.md # User-facing guide (3 KB) ``` ## Dashboard (port 9988) FastAPI server with dark HTML interface, auto-refresh every 3s. **API endpoints:** - `GET /api/status` — full pool + gateway status - `GET /api/accounts` — account list - `GET /api/queue` — email queue - `POST /api/queue/add` — add email to queue (JSON body: `{email, password}`) - `POST /api/reload` — signal gateway to reload accounts - `GET /api/queue/clear` — clear queue **HTML interface features:** - Stats cards: Alive, Dead, Total Credits, Avg Credits, Reg Today, Gateway - Full account table with credits bars - Email queue section with add form - Action buttons: Refresh, Start Registration, Farm Quests, Reload Gateway **Startup:** ```bash python dashboard_server.py # → http://127.0.0.1:9988 ``` ## Multi-Threaded Registration (multi_reg.py) Reads `email_queue.jsonl`, registers N accounts per email in parallel. **Usage:** ```bash python multi_reg.py 3 2 # 3 = accounts per email # 2 = max parallel threads ``` **Flow per email:** 1. Uses Chrome CDP via Playwright (`connect_over_cdp`) 2. `asyncio.Semaphore` controls concurrency 3. Per account: signup → recaptcha → send verification → IMAP wait → verify → login 4. Saves cookies → appends to `conol_accounts_pool.jsonl` 5. After registration: auto-farms all 6 quests 6. Updates `email_queue.jsonl` status: `queued` → `registering` → `registered` → `quests_done` **Gmail verification** runs in `ThreadPoolExecutor` (parallel across clients): ```python loop.run_in_executor(None, wait_for_verify_link_sync, gmail_addr, gmail_app, alias, since_epoch) ``` ## Unified Launcher (start_all.bat) Single `.bat` with 9-option menu: 1. Start Gateway (9999) 2. Start Dashboard (9988) 3. Start BOTH + Chrome CDP 4. Start Multi-Reg (from email queue) 5. Start ALL (Gateway + Dash + CDP) 6. Register N accounts (manual) 7. Farm Quests (all accounts) 8. Check Status / Health 9. Kill All Auto-checks: Python installed, deps available, config.json valid, Chrome CDP running, gateway alive. ## Distribution Package For giving to other people: 1. They copy `conol_autoreg` folder (minus your `config.json`) 2. Copy `config.example.json` → `config.json`, fill their gmail + app password 3. Install deps: `pip install fastapi uvicorn httpx playwright requests pyyaml` 4. Install Chromium: `playwright install chromium` 5. Run `start_all.bat` 6. Dashboard opens at `http://127.0.0.1:9988` 7. Add emails via dashboard form → run multi_reg ## FastAPI Pitfall: Request Body Parsing ```python # ❌ WRONG — FastAPI treats `request: dict` as query parameter @app.post("/api/queue/add") async def queue_add(request: dict): email = request.get("email") # → None! # ✅ CORRECT — use `from fastapi import Request` + await request.json() from fastapi import FastAPI, HTTPException, Request @app.post("/api/queue/add") async def queue_add(request: Request): body = await request.json() email = body.get("email") # → works! ``` **Reason:** FastAPI only auto-parses JSON body into Pydantic models or when using `Body()`. A bare `dict` type annotation is treated as a query parameter, not a body parameter. The `Request` object's `.json()` method gives direct access. ## Port Conflict Resolution (Windows) When a process dies but leaves port occupied: ```bash # Find PID on port netstat -ano | grep 9988 # Kill via PowerShell (taskkill fails in git-bash) powershell -Command "Stop-Process -Id -Force" ``` Do NOT use `taskkill //PID` in git-bash — syntax fails. Use PowerShell `Stop-Process` instead.