This commit is contained in:
2026-07-16 09:33:13 +08:00
parent 085e85967a
commit 01c55721ca
5 changed files with 34 additions and 24 deletions
+1 -5
View File
@@ -2287,16 +2287,12 @@ async def upload_login_video(
admin: User = Depends(get_admin_user),
db: AsyncSession = Depends(get_db),
):
"""上传登录页背景视频,保存 URL 到 system config login_bg_video。"""
"""上传登录页背景视频/动图,保存 URL 到 system config login_bg_video。"""
from app.config import settings
if not file.filename:
raise HTTPException(status_code=400, detail="请选择文件")
allowed_extensions = ('.mp4', '.webm', '.mov')
if not file.filename.lower().endswith(allowed_extensions):
raise HTTPException(status_code=400, detail="仅支持 MP4、WebM、MOV 视频格式")
content = await file.read()
if len(content) > 50 * 1024 * 1024:
raise HTTPException(status_code=400, detail="文件大小不能超过50MB")