✨ feat: 默认关闭自动检测并支持全量文件枚举

* 默认仅手动检测下载状态,减少非主动的网盘读取请求
* 提供管理员全量文件 ID 快照,排除回收文件且不读取存储
* 验证枚举鉴权、跨分页范围及检测不产生取件副作用
* 明确先验证测试分支,再合并正式分支构建生产版本
This commit is contained in:
orion committed 2026-09-19 01:24:17 +08:00
1 parent 9d2ef0c34b
commit 8af45a70f6
4 files changed
+33 -1

No files matched your search

+14
View File
@@ -188,3 +188,17 @@ class DownloadCheckTests(unittest.IsolatedAsyncioTestCase):
yield b''
with patch.object(WebDAVFileStorage, 'get_file_response', new=AsyncMock(return_value=StreamingResponse(empty()))):
self.assertEqual((await self.check())[0]['status'], 'unavailable')
async def test_full_check_ids_include_other_pages_without_reading_storage(self):
from core.settings import DEFAULT_CONFIG
self.assertEqual(DEFAULT_CONFIG['downloadCheckInterval'], 0)
expired = await FileCodes.create(code='EXPIRED1', expired_count=0)
await FileCodes.create(code='TRASHED1', is_trashed=True)
response = await self.client.get('/admin/file/download-check-ids')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()['detail'], [self.file.id, expired.id])
self.assertEqual(self.requests, 0)
self.assertEqual(await TransferStats.all().count(), 0)
self.app.dependency_overrides.clear()
response = await self.client.get('/admin/file/download-check-ids')
self.assertEqual(response.status_code, 401)