38 lines
2.6 KiB
Markdown
38 lines
2.6 KiB
Markdown
# Owncast–IRC Bridge: Full Implementation
|
||
|
||
## Task Description
|
||
Executed the full 15-task implementation plan at `docs/plans/2026-03-10-owncast-irc-bridge-impl.md` using the executing-plans skill. Built a complete bidirectional Rust chat bridge between Owncast and IRC.
|
||
|
||
## Changes Made (15 commits)
|
||
1. **Project scaffolding** — `cargo init`, Cargo.toml with all deps, `.gitignore`, `config.example.toml`, placeholder binaries
|
||
2. **Config module** (`src/config.rs`) — TOML parsing with serde defaults, env var support for access token, 3 tests
|
||
3. **Events module** (`src/events.rs`) — `BridgeEvent`, `Source`, `OwncastState`, `ControlCommand`, `BridgeStatus` types
|
||
4. **HTML stripping** (`src/html.rs`) — Strips HTML tags, extracts emoji `<img>` alt text, decodes entities, 6 tests
|
||
5. **Owncast API client** (`src/owncast_api.rs`) — `send_chat_message` with retry, `get_status` for health checks
|
||
6. **Health poller** (`src/health.rs`) — Periodic Owncast status polling with state change detection
|
||
7. **Webhook server** (`src/webhook.rs`) — Axum HTTP server parsing CHAT/STREAM_STARTED/STREAM_STOPPED events, 5 tests
|
||
8. **IRC task** (`src/irc_task.rs`) — `irc` crate client with exponential backoff reconnect
|
||
9. **WebSocket task** (`src/websocket.rs`) — tokio-tungstenite client with reconnect, 5 tests
|
||
10. **Control socket** (`src/control.rs`) — Unix socket listener with command parsing, 5 tests
|
||
11. **Router** (`src/router.rs`) — Central orchestration with dedup tracker, echo suppressor, state handling, 4 tests
|
||
12. **Main entry point** (`src/main.rs`) — Wires all tasks together with signal handling (SIGINT/SIGTERM/SIGHUP)
|
||
13. **bridge-ctl CLI** (`src/bin/bridge_ctl.rs`) — Clap-based CLI for runtime control via Unix socket
|
||
14. **Dockerfile** — Multi-stage build (rust:1.85-slim-bookworm builder, debian:bookworm-slim runtime)
|
||
15. **Final fixes** — Added missing `Clone` derive on `IrcConfig`, cleaned up unused imports
|
||
|
||
## Verification
|
||
- Both binaries (`owncast-irc-bridge`, `bridge-ctl`) compile
|
||
- All 28 tests pass across all modules
|
||
- Only benign warnings remain (unused struct fields for future API data)
|
||
|
||
## Bugs Found in Plan
|
||
- Raw string delimiters `r#"..."#` conflicted with TOML `"#channel"` values — fixed with `r##"..."##`
|
||
- `strip_html` had peek/consume bug (didn't advance past `<` and `&` before collecting) — fixed
|
||
- `reqwest::Response::text()` consumes `self`, so status must be captured first — fixed
|
||
|
||
## Follow-up Items
|
||
- Integration testing with actual Owncast and IRC instances
|
||
- Wire remaining control commands (connect/disconnect/reconnect) through to tasks
|
||
- Add `message_buffer_size` buffering logic
|
||
- SIGHUP config reload support
|