✨ feat(backend): 补齐本地目录分页搜索与分享校验
This commit is contained in:
1 parent
96e8eeac39
commit
3e32806b59
7 files changed
+137
-15
No files matched your search
+5
-2
@@ -6,7 +6,7 @@ import datetime
|
||||
from collections import Counter
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from apps.admin import services as admin_services
|
||||
from apps.admin.services import FileService, ConfigService, LocalFileService
|
||||
from apps.admin.dependencies import (
|
||||
@@ -831,9 +831,12 @@ async def file_preview(
|
||||
@admin_api.get("/local/lists")
|
||||
async def get_local_lists(
|
||||
path: Optional[str] = None,
|
||||
page: Optional[int] = Query(default=None, ge=1),
|
||||
size: int = Query(default=20, ge=1, le=100),
|
||||
keyword: str = Query(default="", max_length=255),
|
||||
local_file_service: LocalFileService = Depends(get_local_file_service),
|
||||
):
|
||||
listing = await local_file_service.list_files(path or "", legacy=path is None)
|
||||
listing = await local_file_service.list_files(path or "", legacy=path is None, page=page, size=size, keyword=keyword)
|
||||
# 无 path 参数保留旧主题的数组响应;显式 path 支持目录导航。
|
||||
files = listing if path is not None else [item for item in listing["items"] if item["type"] == "file"]
|
||||
return APIResponse(detail=files)
|
||||
|
||||
Reference in new issue
Block a user