From 8dd74e7dd81c58483484ecf84f172f8057f3dd23 Mon Sep 17 00:00:00 2001 From: honue Date: Sat, 28 Oct 2023 11:02:26 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=AE=8C=E5=96=84=E9=A1=B5=E9=9D=A2downl?= =?UTF-8?q?oad=E4=BC=A0=E5=8F=82username?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/download.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/endpoints/download.py b/app/api/endpoints/download.py index 8f1d2fb5..262ec67f 100644 --- a/app/api/endpoints/download.py +++ b/app/api/endpoints/download.py @@ -3,6 +3,8 @@ from typing import Any, List from fastapi import APIRouter, Depends, HTTPException from app import schemas +from app.db.models.user import User +from app.db.userauth import get_current_active_user from app.chain.douban import DoubanChain from app.chain.download import DownloadChain from app.chain.media import MediaChain @@ -27,6 +29,7 @@ def read_downloading( def add_downloading( media_in: schemas.MediaInfo, torrent_in: schemas.TorrentInfo, + current_user: User = Depends(get_current_active_user), _: schemas.TokenPayload = Depends(verify_token)) -> Any: """ 添加下载任务 @@ -45,7 +48,7 @@ def add_downloading( media_info=mediainfo, torrent_info=torrentinfo ) - did = DownloadChain().download_single(context=context) + did = DownloadChain().download_single(context=context, username=current_user.name) return schemas.Response(success=True if did else False, data={ "download_id": did })