feat(file): restrict preview to images and videos
- generate size-aware thumbnails (32-512px) with single-flight and atomic writes - add optional v parameter for immutable browser caching - serve PNG for PNG/GIF sources and JPEG otherwise - drop PDF, text and WebP from preview support
This commit is contained in:
@@ -205,6 +205,15 @@ Accept-Language: zh-CN
|
||||
|
||||
具体哪些接口属于二进制响应,以 OpenAPI 中定义的响应 `Content-Type` 为准。
|
||||
|
||||
#### 缩略图预览
|
||||
|
||||
`GET /system/file/preview/{path}` 仅支持图片和视频,其他类型返回 `400`。图片和视频统一返回缩略图:
|
||||
|
||||
- `size`:缩略图最大边长(像素),范围 `32-512`,默认 `256`
|
||||
- `v`:缓存版本号,建议传文件列表返回的 `etag`;传入后响应使用一年强缓存,不传时缓存一天
|
||||
- 响应 `Content-Type` 为 `image/jpeg` 或 `image/png`;PNG/GIF 源图使用 PNG,其余使用 JPEG
|
||||
- 支持 `If-None-Match` 条件请求,`ETag` 已包含缩略图尺寸和算法版本
|
||||
|
||||
### 3.2 SSE
|
||||
|
||||
部分长任务接口使用 `text/event-stream`,不经过 `TimiResponse`。事件类型如下:
|
||||
|
||||
Reference in New Issue
Block a user