Merge pull request #991 from honue/main

This commit is contained in:
jxxghp 2023-10-28 11:06:25 +08:00 committed by GitHub
commit 61e7ec9a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@ from typing import Any, List
from fastapi import APIRouter, Depends, HTTPException from fastapi import APIRouter, Depends, HTTPException
from app import schemas 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.douban import DoubanChain
from app.chain.download import DownloadChain from app.chain.download import DownloadChain
from app.chain.media import MediaChain from app.chain.media import MediaChain
@ -27,6 +29,7 @@ def read_downloading(
def add_downloading( def add_downloading(
media_in: schemas.MediaInfo, media_in: schemas.MediaInfo,
torrent_in: schemas.TorrentInfo, torrent_in: schemas.TorrentInfo,
current_user: User = Depends(get_current_active_user),
_: schemas.TokenPayload = Depends(verify_token)) -> Any: _: schemas.TokenPayload = Depends(verify_token)) -> Any:
""" """
添加下载任务 添加下载任务
@ -45,7 +48,7 @@ def add_downloading(
media_info=mediainfo, media_info=mediainfo,
torrent_info=torrentinfo 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={ return schemas.Response(success=True if did else False, data={
"download_id": did "download_id": did
}) })