Files
disknext/routers/api/v1/download/__init__.py
于小丘 209cb24ab4 feat: add models for physical files, policies, and user management
- Implement PhysicalFile model to manage physical file references and reference counting.
- Create Policy model with associated options and group links for storage policies.
- Introduce Redeem and Report models for handling redeem codes and reports.
- Add Settings model for site configuration and user settings management.
- Develop Share model for sharing objects with unique codes and associated metadata.
- Implement SourceLink model for managing download links associated with objects.
- Create StoragePack model for managing user storage packages.
- Add Tag model for user-defined tags with manual and automatic types.
- Implement Task model for managing background tasks with status tracking.
- Develop User model with comprehensive user management features including authentication.
- Introduce UserAuthn model for managing WebAuthn credentials.
- Create WebDAV model for managing WebDAV accounts associated with users.
2026-02-10 19:07:48 +08:00

116 lines
3.1 KiB
Python

from fastapi import APIRouter, Depends
from middleware.auth import auth_required
from sqlmodels import ResponseBase
from utils import http_exceptions
download_router = APIRouter(
prefix="/download",
tags=["download"]
)
aria2_router = APIRouter(
prefix="/aria2",
tags=["aria2"]
)
download_router.include_router(aria2_router)
@aria2_router.post(
path='/url',
summary='创建URL下载任务',
description='Create a URL download task endpoint.',
dependencies=[Depends(auth_required)]
)
def router_aria2_url() -> ResponseBase:
"""
Create a URL download task endpoint.
Returns:
ResponseBase: A model containing the response data for the URL download task.
"""
http_exceptions.raise_not_implemented()
@aria2_router.post(
path='/torrent/{id}',
summary='创建种子下载任务',
description='Create a torrent download task endpoint.',
dependencies=[Depends(auth_required)]
)
def router_aria2_torrent(id: str) -> ResponseBase:
"""
Create a torrent download task endpoint.
Args:
id (str): The ID of the torrent to download.
Returns:
ResponseBase: A model containing the response data for the torrent download task.
"""
http_exceptions.raise_not_implemented()
@aria2_router.put(
path='/select/{gid}',
summary='重新选择要下载的文件',
description='Re-select files to download endpoint.',
dependencies=[Depends(auth_required)]
)
def router_aria2_select(gid: str) -> ResponseBase:
"""
Re-select files to download endpoint.
Args:
gid (str): The GID of the download task.
Returns:
ResponseBase: A model containing the response data for the re-selection of files.
"""
http_exceptions.raise_not_implemented()
@aria2_router.delete(
path='/task/{gid}',
summary='取消或删除下载任务',
description='Delete a download task endpoint.',
dependencies=[Depends(auth_required)]
)
def router_aria2_delete(gid: str) -> ResponseBase:
"""
Delete a download task endpoint.
Args:
gid (str): The GID of the download task to delete.
Returns:
ResponseBase: A model containing the response data for the deletion of the download task.
"""
http_exceptions.raise_not_implemented()
@aria2_router.get(
'/downloading',
summary='获取正在下载中的任务',
description='Get currently downloading tasks endpoint.',
dependencies=[Depends(auth_required)]
)
def router_aria2_downloading() -> ResponseBase:
"""
Get currently downloading tasks endpoint.
Returns:
ResponseBase: A model containing the response data for currently downloading tasks.
"""
http_exceptions.raise_not_implemented()
@aria2_router.get(
path='/finished',
summary='获取已完成的任务',
description='Get finished tasks endpoint.',
dependencies=[Depends(auth_required)]
)
def router_aria2_finished() -> ResponseBase:
"""
Get finished tasks endpoint.
Returns:
ResponseBase: A model containing the response data for finished tasks.
"""
http_exceptions.raise_not_implemented()