heystreamer/app/routers/dashboard.py
Bashy 6ad661c220 Initial commit — BashyOverlay v1
Twitch stream event platform with OBS browser source overlay.

Features:
- Twitch OAuth login (streamer + mod access)
- EventSub WebSocket for subs, gift subs, bits, channel points, follows, raids
- Chat commands via tmi.js in the overlay
- Gap audio — tone plays on new chat message after silence, volume/pitch scale with gap length
- Self-hosted media library (upload sounds and videos)
- Action configuration — map any event to sound, video, or alert
- Per-action cooldowns, test button, enable/disable toggle
- Multiple actions per event (all matching actions fire)
- Activity log dashboard with EventSub connection status
- Layout editor — iframe-based WYSIWYG with drag handles, live style preview
- Custom CSS and custom JS injection into overlay
- Custom DOM events (bashyoverlay:sub, bashyoverlay:raid, etc.) for custom JS hooks
- deploy.sh — one-shot setup and launch script

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 23:48:35 +03:00

28 lines
896 B
Python

from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse
from sqlmodel import Session, select, desc
from app.auth import require_user
from app.database import get_session
from app.models import ActivityLog
from app.templates import templates
router = APIRouter()
@router.get("/", response_class=HTMLResponse)
async def dashboard(request: Request, session: Session = Depends(get_session), user=Depends(require_user)):
from app.main import get_eventsub_task
task = get_eventsub_task()
eventsub_connected = task is not None and not task.done()
logs = session.exec(
select(ActivityLog).order_by(desc(ActivityLog.triggered_at)).limit(50)
).all()
return templates.TemplateResponse("dashboard.html", {
"request": request,
"user": user,
"eventsub_connected": eventsub_connected,
"logs": logs,
})