Initial commit — HeyStreamer 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 (heystreamer:sub, heystreamer:raid, etc.) for custom JS hooks - deploy.sh — one-shot setup and launch script Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
b9291f455e
37 changed files with 2180 additions and 0 deletions
48
app/database.py
Normal file
48
app/database.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from sqlmodel import Session, SQLModel, create_engine, select
|
||||
|
||||
load_dotenv()
|
||||
|
||||
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./heystreamer.db")
|
||||
engine = create_engine(DATABASE_URL, connect_args={"check_same_thread": False})
|
||||
|
||||
|
||||
def create_db() -> None:
|
||||
SQLModel.metadata.create_all(engine)
|
||||
|
||||
|
||||
def get_session():
|
||||
with Session(engine) as session:
|
||||
yield session
|
||||
|
||||
|
||||
def get_settings():
|
||||
from app.models import Settings
|
||||
with Session(engine) as session:
|
||||
s = session.exec(select(Settings)).first()
|
||||
if not s:
|
||||
s = Settings()
|
||||
session.add(s)
|
||||
session.commit()
|
||||
session.refresh(s)
|
||||
return s
|
||||
|
||||
|
||||
def get_layout():
|
||||
from app.models import OverlayLayout
|
||||
with Session(engine) as session:
|
||||
layout = session.exec(select(OverlayLayout)).first()
|
||||
if not layout:
|
||||
layout = OverlayLayout()
|
||||
session.add(layout)
|
||||
session.commit()
|
||||
session.refresh(layout)
|
||||
return layout
|
||||
|
||||
|
||||
def get_admin_user():
|
||||
from app.models import User
|
||||
with Session(engine) as session:
|
||||
return session.exec(select(User).where(User.is_admin == True)).first()
|
||||
Loading…
Add table
Add a link
Reference in a new issue