WIP: Working on player

This commit is contained in:
Mistral Vibe
2026-04-08 15:10:52 +02:00
parent d654ad5987
commit b5c84ec58c
95 changed files with 453 additions and 193 deletions

0
api/src/rehearsalhub/__init__.py Normal file → Executable file
View File

2
api/src/rehearsalhub/config.py Normal file → Executable file
View File

@@ -21,6 +21,8 @@ class Settings(BaseSettings):
# App
domain: str = "localhost"
debug: bool = False
# Additional CORS origins (comma-separated)
cors_origins: str = ""
# Worker
analysis_version: str = "1.0.0"

0
api/src/rehearsalhub/db/__init__.py Normal file → Executable file
View File

0
api/src/rehearsalhub/db/engine.py Normal file → Executable file
View File

0
api/src/rehearsalhub/db/models.py Normal file → Executable file
View File

0
api/src/rehearsalhub/dependencies.py Normal file → Executable file
View File

17
api/src/rehearsalhub/main.py Normal file → Executable file
View File

@@ -52,9 +52,24 @@ def create_app() -> FastAPI:
app.state.limiter = limiter
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
# Get allowed origins from environment or use defaults
allowed_origins = [f"https://{settings.domain}", "http://localhost:3000"]
# Add specific domain for production
if settings.domain != "localhost":
allowed_origins.extend([
f"https://{settings.domain}",
f"http://{settings.domain}",
])
# Add additional CORS origins from environment variable
if settings.cors_origins:
additional_origins = [origin.strip() for origin in settings.cors_origins.split(",")]
allowed_origins.extend(additional_origins)
app.add_middleware(
CORSMiddleware,
allow_origins=[f"https://{settings.domain}", "http://localhost:3000"],
allow_origins=allowed_origins,
allow_credentials=True,
allow_methods=["GET", "POST", "PUT", "PATCH", "DELETE"],
allow_headers=["Authorization", "Content-Type", "Accept"],

0
api/src/rehearsalhub/queue/__init__.py Normal file → Executable file
View File

0
api/src/rehearsalhub/queue/protocol.py Normal file → Executable file
View File

0
api/src/rehearsalhub/queue/redis_queue.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/__init__.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/annotation.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/audio_version.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/band.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/base.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/comment.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/job.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/member.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/reaction.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/rehearsal_session.py Normal file → Executable file
View File

0
api/src/rehearsalhub/repositories/song.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/__init__.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/annotations.py Normal file → Executable file
View File

19
api/src/rehearsalhub/routers/auth.py Normal file → Executable file
View File

@@ -52,14 +52,29 @@ async def login(
status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid credentials"
)
settings = get_settings()
# Determine cookie domain based on settings
cookie_domain = None
if settings.domain != "localhost":
# For production domains, set cookie domain to allow subdomains
if "." in settings.domain: # Check if it's a proper domain
cookie_domain = "." + settings.domain.split(".")[-2] + "." + settings.domain.split(".")[-1]
# For cross-site functionality, use samesite="none" with secure flag.
# localhost is always plain HTTP — never set Secure there or the browser drops the cookie.
is_localhost = settings.domain == "localhost"
samesite_value = "lax" if is_localhost else "none"
secure_flag = False if is_localhost else True
response.set_cookie(
key="rh_token",
value=token.access_token,
httponly=True,
secure=not settings.debug,
samesite="lax",
secure=secure_flag,
samesite=samesite_value,
max_age=settings.access_token_expire_minutes * 60,
path="/",
domain=cookie_domain,
)
return token

0
api/src/rehearsalhub/routers/bands.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/internal.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/invites.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/members.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/sessions.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/songs.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/versions.py Normal file → Executable file
View File

0
api/src/rehearsalhub/routers/ws.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/__init__.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/annotation.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/audio_version.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/auth.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/band.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/comment.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/invite.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/member.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/rehearsal_session.py Normal file → Executable file
View File

0
api/src/rehearsalhub/schemas/song.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/__init__.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/annotation.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/auth.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/avatar.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/band.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/nc_scan.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/session.py Normal file → Executable file
View File

0
api/src/rehearsalhub/services/song.py Normal file → Executable file
View File

0
api/src/rehearsalhub/storage/__init__.py Normal file → Executable file
View File

0
api/src/rehearsalhub/storage/nextcloud.py Normal file → Executable file
View File

0
api/src/rehearsalhub/storage/protocol.py Normal file → Executable file
View File

0
api/src/rehearsalhub/ws.py Normal file → Executable file
View File