Includes: - Installation instructions for testing in a virtualenv - Detailed reference for all ps-serve commands (init, create-user, create-key, serve) - Complete workflow examples - Troubleshooting guide - Development tips and security best practices - Quick reference cheat sheet Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Update readme Add userinfo endpoint and asset backup script. Fix s3 and add new DB fields Add pyproject file Cleanup
29 lines
731 B
Python
29 lines
731 B
Python
"""User information routes."""
|
|
from fastapi import APIRouter, Depends, HTTPException, status
|
|
from sqlalchemy.orm import Session
|
|
from pydantic import BaseModel
|
|
import yaml
|
|
|
|
from privatestudio.web.database import get_db
|
|
from privatestudio.web.models import User, TranscodeJob, UploadedAsset, TranscodeProfile
|
|
from privatestudio.web.auth import get_current_user
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/userinfo")
|
|
async def get_user_info(
|
|
current_user: User = Depends(get_current_user),
|
|
):
|
|
"""Get user information for the current user."""
|
|
user_id = current_user.id
|
|
bucket_name = f"user-{user_id}"
|
|
|
|
return {
|
|
"bucket": bucket_name,
|
|
"user_id": user_id,
|
|
"username": current_user.username,
|
|
}
|
|
|