feat: Implement API routers for user, tag, vas, webdav, and slave functionalities
- Added user authentication and registration endpoints with JWT support. - Created tag management routes for creating and deleting tags. - Implemented value-added service (VAS) endpoints for managing storage packs and orders. - Developed WebDAV account management routes for creating, updating, and deleting accounts. - Introduced slave router for handling file uploads, downloads, and aria2 task management. - Enhanced JWT utility functions for token creation and secret key management. - Established lifespan management for FastAPI application startup and shutdown processes. - Integrated password handling utilities with Argon2 hashing and two-factor authentication support.
This commit is contained in:
107
routers/api/v1/download/__init__.py
Normal file
107
routers/api/v1/download/__init__.py
Normal file
@@ -0,0 +1,107 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from middleware.auth import SignRequired
|
||||
from models.response import ResponseBase
|
||||
|
||||
aria2_router = APIRouter(
|
||||
prefix="/aria2",
|
||||
tags=["aria2"]
|
||||
)
|
||||
|
||||
@aria2_router.post(
|
||||
path='/url',
|
||||
summary='创建URL下载任务',
|
||||
description='Create a URL download task endpoint.',
|
||||
dependencies=[Depends(SignRequired)]
|
||||
)
|
||||
def router_aria2_url() -> ResponseBase:
|
||||
"""
|
||||
Create a URL download task endpoint.
|
||||
|
||||
Returns:
|
||||
ResponseModel: A model containing the response data for the URL download task.
|
||||
"""
|
||||
pass
|
||||
|
||||
@aria2_router.post(
|
||||
path='/torrent/{id}',
|
||||
summary='创建种子下载任务',
|
||||
description='Create a torrent download task endpoint.',
|
||||
dependencies=[Depends(SignRequired)]
|
||||
)
|
||||
def router_aria2_torrent(id: str) -> ResponseBase:
|
||||
"""
|
||||
Create a torrent download task endpoint.
|
||||
|
||||
Args:
|
||||
id (str): The ID of the torrent to download.
|
||||
|
||||
Returns:
|
||||
ResponseModel: A model containing the response data for the torrent download task.
|
||||
"""
|
||||
pass
|
||||
|
||||
@aria2_router.put(
|
||||
path='/select/{gid}',
|
||||
summary='重新选择要下载的文件',
|
||||
description='Re-select files to download endpoint.',
|
||||
dependencies=[Depends(SignRequired)]
|
||||
)
|
||||
def router_aria2_select(gid: str) -> ResponseBase:
|
||||
"""
|
||||
Re-select files to download endpoint.
|
||||
|
||||
Args:
|
||||
gid (str): The GID of the download task.
|
||||
|
||||
Returns:
|
||||
ResponseModel: A model containing the response data for the re-selection of files.
|
||||
"""
|
||||
pass
|
||||
|
||||
@aria2_router.delete(
|
||||
path='/task/{gid}',
|
||||
summary='取消或删除下载任务',
|
||||
description='Delete a download task endpoint.',
|
||||
dependencies=[Depends(SignRequired)]
|
||||
)
|
||||
def router_aria2_delete(gid: str) -> ResponseBase:
|
||||
"""
|
||||
Delete a download task endpoint.
|
||||
|
||||
Args:
|
||||
gid (str): The GID of the download task to delete.
|
||||
|
||||
Returns:
|
||||
ResponseModel: A model containing the response data for the deletion of the download task.
|
||||
"""
|
||||
pass
|
||||
|
||||
@aria2_router.get(
|
||||
'/downloading',
|
||||
summary='获取正在下载中的任务',
|
||||
description='Get currently downloading tasks endpoint.',
|
||||
dependencies=[Depends(SignRequired)]
|
||||
)
|
||||
def router_aria2_downloading() -> ResponseBase:
|
||||
"""
|
||||
Get currently downloading tasks endpoint.
|
||||
|
||||
Returns:
|
||||
ResponseModel: A model containing the response data for currently downloading tasks.
|
||||
"""
|
||||
pass
|
||||
|
||||
@aria2_router.get(
|
||||
path='/finished',
|
||||
summary='获取已完成的任务',
|
||||
description='Get finished tasks endpoint.',
|
||||
dependencies=[Depends(SignRequired)]
|
||||
)
|
||||
def router_aria2_finished() -> ResponseBase:
|
||||
"""
|
||||
Get finished tasks endpoint.
|
||||
|
||||
Returns:
|
||||
ResponseModel: A model containing the response data for finished tasks.
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user