Commit Graph

5 Commits

Author SHA1 Message Date
noelorin 16895dcdd8 docs: document chat/danmaku and broadcaster external push API; add design spec
- README: explain the room chat/danmaku flow and the host-only
  POST /api/room/{room}/broadcast endpoint for OBS/bot/moderator use.
- Add design.md describing the Awwwards-grade visual/UX bar.
2026-08-20 15:03:44 +08:00
noelorin 7274cf58f3 feat(chat): room chat/danmaku over SSE with history replay, host broadcast API and rate limit
- chatHub broadcasts room danmaku over SSE; new subscribers replay the
  last N messages on join so they don't face an empty room.
- Add a host-only external push endpoint POST /api/room/{room}/broadcast
  (requires room:publish, Bearer token) that marks messages host:true.
- Slide-window rate limiter (room+sender+IP, 5 per 3s) guards both the
  public chat and the broadcast endpoint.
- Wire RBAC room:chat policy, SPA routing and the room-creation route.
2026-08-20 15:03:18 +08:00
noelorin 340296f6cc feat(web): rewrite frontend as SolidJS + Tailwind v4 SPA with chat UI
Replace the legacy vanilla HTML/CSS/JS pages with a SolidJS single-page
app (TanStack Router/Query, Ark UI, Tailwind v4) and embed its build
output into the Go binary via //go:embed. SPA routes fall back to
index.html. Includes the room chat/danmaku panel, color picker and
broadcaster overlay on the watch/publish pages. Add web/node_modules
and local data to .gitignore.
2026-08-20 15:03:03 +08:00
noelorin 115b34dcd3 feat(auth): 基于 casbin 的登录与 RBAC 权限系统
- 引入 github.com/casbin/casbin/v2 实现 RBAC (model.conf + policy.csv)
- 角色: admin/publisher/viewer/guest,资源: config/room/user/srs,动作: read/list/publish/subscribe/stop/watch/manage
- JWT 登录 (golang-jwt/jwt/v5,bcrypt 存储,data/users.json 持久化,种子用户 admin/publisher/viewer)
- 中间件: HTTP AuthorizeMiddleware + gRPC Unary/Stream 拦截器,支持 Authorization Bearer/Cookie/Query/X-Token
- 新增 API: POST /api/auth/login|register|logout, GET /api/auth/me|users|check, POST /api/auth/users/role (Casbin 鉴权)
- 保护业务路由: /api/publish/subscribe/stop/rooms/room/*/events/srs/streams 及媒体代理 /rtc/v1/* /api/cf/*
- gRPC 契约新增 Login/Register/GetMe/ListUsers/UpdateUserRole (api/live_sfu.proto + gen)
- 前端 login.html + app.js 自动附加 Authorization,SSE 通过 ?token 传递,未登录自动跳转
- 配置: JWT_SECRET/JWT_TTL/CASBIN_MODEL/CASBIN_POLICY/AUTH_USER_FILE/ALLOW_REGISTER
- 集成 TursoDB 持久化与测试覆盖 (auth_test.go)
2026-08-19 16:42:17 +08:00
noelorin c4a50b07c6 feat: live SFU fan-out demo (Cloudflare Realtime + SRS)
- protobuf/gRPC control plane (LiveSFU service, buf generated)
- Cloudflare Realtime as primary SFU, SRS as secondary backend
- WHIP/WHEP + Cloudflare Realtime media proxies (server injects credentials)
- room fan-out state with SSE; publish/watch frontend
2026-08-17 15:14:51 +08:00