feat: Enhance file management and user features
- Add file deduplication mechanism based on PhysicalFile reference counting. - Implement chunked upload support for large files with resumable uploads. - Update sharing page to automatically render README and preview content. - Integrate Redis for caching and token storage (optional). - Refactor project structure to include new models for download tasks, nodes, and tasks. - Introduce user filtering parameters for admin user management. - Add CORS middleware for handling cross-origin requests. - Improve error messages for authentication failures. - Update user model to include two-factor authentication key management. - Enhance API documentation and response models for clarity. - Implement admin checks for user management and permissions.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from loguru import logger as l
|
||||
from sqlalchemy import and_
|
||||
|
||||
@@ -56,6 +56,23 @@ admin_aria2_router = APIRouter(
|
||||
tags=['admin', 'admin_aria2']
|
||||
)
|
||||
|
||||
@admin_router.get(
|
||||
path='/',
|
||||
summary='自己是否为管理员',
|
||||
dependencies=[Depends(admin_required)],
|
||||
status_code=status.HTTP_204_NO_CONTENT
|
||||
)
|
||||
async def is_admin() -> None:
|
||||
"""
|
||||
检查当前用户是否具有管理员权限。
|
||||
|
||||
如果用户是管理员,则返回 204 No Content 响应;否则返回 403 Forbidden 错误。
|
||||
|
||||
Returns:
|
||||
None: 无内容响应
|
||||
"""
|
||||
return None
|
||||
|
||||
@admin_router.get(
|
||||
path='/summary',
|
||||
summary='获取站点概况',
|
||||
|
||||
Reference in New Issue
Block a user