跳到主要内容

对象存储

S3 / R2 兼容配置,供运营公告封面与正文插图。Secret Access Key 用与 密钥 相同的 ECIES 加密后提交。均需 Bearer。

GET /api/object-storage/config

{
"configured": true,
"enabled": true,
"endpoint": "https://…",
"bucket": "auroran-assets",
"access_key_id": "…",
"secret_access_key_masked": "****abcd",
"public_base_url": "https://cdn.example.com",
"region": "auto",
"object_prefix": "announcements/",
"updated_at_ms": 1756440000000,
"updated_by": "0x…",
"connection_ok": true,
"connection_message": "ok",
"connection_tested_at_ms": 1756440000000,
"connection_test_steps": null
}

未配置时 configured=false,多数字段为空。Secret 只回 masked,永不回明文。

PUT /api/object-storage/config

保存并尝试连通性测试。

Body:

{
"endpoint": "https://…",
"bucket": "auroran-assets",
"access_key_id": "…",
"secret_ciphertext": { "ephemeral_public_key": "…", "iv": "…", "ciphertext": "…" },
"public_base_url": "https://cdn.example.com",
"region": "auto",
"object_prefix": "announcements/"
}

更新时省略 secret_ciphertext 则保留已存 secret。解密失败 → 400

200: { "ok": true, "config": <同上>, "test": <测试结果或 null> }

POST /api/object-storage/test

端到端探测(上传再删除探测对象)。Body 可空(测已存配置),或带与 PUT 相同的覆盖字段(均可选)。

200:

{
"ok": true,
"message": "ok",
"tested_at_ms": 1756440000000,
"object_key": "…",
"steps": [{ "id": "put", "label": "上传", "ok": true, "message": "", "duration_ms": 120 }]
}

未配置且无覆盖 → 错误信息「S3 未配置」。