feat: batch download

This commit is contained in:
tao.chen
2026-08-27 19:35:30 +08:00
parent 7225b72906
commit a897a08534
10 changed files with 443 additions and 77 deletions
+8 -5
View File
@@ -52,6 +52,7 @@ curl -F "file=@report.pdf" http://localhost:8080/upload
| POST | `/upload` | 上传文件(`multipart/form-data`,字段名 `file`) |
| GET | `/files` | 列出当前未过期文件 |
| GET | `/download/:filename` | 下载文件 |
| POST | `/download-zip` | 批量下载 (body: `{"files":[...]}`, 最多 100 项) |
| DELETE | `/files/:filename` | 删除文件 |
---
@@ -60,19 +61,21 @@ curl -F "file=@report.pdf" http://localhost:8080/upload
```text
tmp-upload/
├── main.go # 入口、配置、路由注册 (60 行)
├── embed.go # //go:embed + init() 拼接 (29 行)
├── main.go # 入口、配置、路由注册 (61 行)
├── embed.go # //go:embed + init() 拼接 (38 行)
├── audit.go # 审计日志子系统 (102 行)
├── quota.go # 配额管理 + formatSize (112 行)
├── handlers.go # HTTP handlers + DTOs (296 行)
├── handlers.go # HTTP handlers + DTOs (440 行)
├── cleaner.go # TTL 过期清理 (57 行)
├── audit_test.go # audit 单元测试
├── security_test.sh # HTTP 端到端测试
├── go.mod / go.sum
└── static/
├── index.html.tpl # HTML 骨架 (含 /*EMBED_CSS*/、/*EMBED_JS*/ 占位符)
├── app.css # CSS (327 行)
── app.js # JS (486 行)
├── app.css # CSS (357 行)
── app.js # JS — 主程序 (441 行)
├── helpers.js # JS — 纯函数 + 倒计时 (58 行)
└── batch.js # JS — 批量选择 / 批量下载 (87 行)
```
### 单文件部署说明