feat: 快照API响应增加顶层version字段,与check接口保持一致

This commit is contained in:
mediabot-pt
2026-07-07 22:49:03 +08:00
parent dfbedcf09d
commit 1436f81667
3 changed files with 2693 additions and 0 deletions

View File

@@ -289,6 +289,7 @@ curl -H "If-None-Match: abc123..." http://par:9012/api/v1/snapshots/pthome
// Response 200 (Content-Type: application/json)
{
"siteId": "pthome",
"version": 5,
"checksum": "abc123def456...",
"generatedAt": "2026-07-07T10:30:00",
"script": "// Groovy 脚本完整源码...",
@@ -456,6 +457,7 @@ Groovy 脚本定义以下方法,mediabot 按需调用:
| 字段 | 类型 | 说明 |
|------|------|------|
| siteId | String | 站点唯一标识 |
| version | Integer | 快照版本号(数字递增) |
| checksum | String | 完整内容 SHA-256(用于 ETag) |
| generatedAt | DateTime | 快照生成/发布时间 |
| script | String | Groovy 脚本完整源码 |

View File

@@ -351,6 +351,7 @@ public class SiteSnapshotServiceImpl implements SiteSnapshotService {
try {
Map<String, Object> bundle = new LinkedHashMap<>();
bundle.put("siteId", snapshot.getSiteId());
bundle.put("version", snapshot.getVersion());
bundle.put("checksum", snapshot.getChecksum());
bundle.put("generatedAt", snapshot.getPublishedAt() != null
? snapshot.getPublishedAt().toString() : LocalDateTime.now().toString());

2690
web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff