Files
cwd/docs/api/admin/feature-settings.md
anghunk 0b28c9fa4c docs: 更新API文档结构并完善功能说明
- 重构API文档侧边栏,将公开API拆分为子分类(评论、点赞、配置、身份验证、访问统计)
- 新增详细的公开API接口文档,包括评论管理、点赞功能、配置获取、身份验证和访问统计
- 完善数据统计功能文档,增加概览数据、访问明细和数据分析说明
- 更新功能设置文档,补充图片预览和个性化设置说明
- 修正管理员登录文档中的错误描述和格式问题
2026-02-06 17:55:31 +08:00

115 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 功能设置相关
管理各项功能开关的接口,包括点赞功能、图片灯箱预览、评论占位符、域名可见性等。
## 获取功能设置
```
GET /admin/settings/feature
```
获取当前的功能开关配置。
- 方法:`GET`
- 路径:`/admin/settings/feature`
- 鉴权:需要 Bearer Token
**成功响应**
- 状态码:`200`
```json
{
"enableCommentLike": true,
"enableArticleLike": true,
"enableImageLightbox": true,
"commentPlaceholder": "发表你的看法...",
"visibleDomains": ["example.com", "blog.example.com"]
}
```
字段说明:
| 字段名 | 类型 | 说明 |
| -------------------- | ------ | ---------------------- |
| `enableCommentLike` | boolean | 是否启用评论点赞功能 |
| `enableArticleLike` | boolean | 是否启用文章点赞功能 |
| `enableImageLightbox` | boolean | 是否启用评论图片灯箱预览功能 |
| `commentPlaceholder` | string \| null | 评论输入框的占位符文本 |
| `visibleDomains` | string[] | 允许显示评论组件的域名列表 |
## 更新功能设置
```
PUT /admin/settings/feature
```
更新功能开关配置。
- 方法:`PUT`
- 路径:`/admin/settings/feature`
- 鉴权:需要 Bearer Token
**请求头**
| 名称 | 必填 | 示例 |
| -------------- | ---- | ------------------ |
| `Content-Type` | 是 | `application/json` |
| `Authorization` | 是 | `Bearer <token>` |
**请求体**
```json
{
"enableCommentLike": true,
"enableArticleLike": true,
"enableImageLightbox": true,
"commentPlaceholder": "发表你的看法...",
"visibleDomains": ["example.com", "blog.example.com"]
}
```
字段说明:
| 字段名 | 类型 | 必填 | 说明 |
| -------------------- | ------- | ---- | ---------------------- |
| `enableCommentLike` | boolean | 否 | 是否启用评论点赞功能 |
| `enableArticleLike` | boolean | 否 | 是否启用文章点赞功能 |
| `enableImageLightbox` | boolean | 否 | 是否启用评论图片灯箱预览功能 |
| `commentPlaceholder` | string | 否 | 评论输入框的占位符文本 |
| `visibleDomains` | string[] | 否 | 允许显示评论组件的域名列表 |
**说明**
- `enableImageLightbox`:启用后,评论内容中的图片可以点击放大预览
- `commentPlaceholder`:自定义评论输入框的占位符文本,留空则使用默认文本
- `visibleDomains`:设置后,只有在此列表中的域名可以正常显示评论组件,其他域名将被隐藏。留空或为 `null` 表示不限制域名。
**成功响应**
- 状态码:`200`
```json
{
"message": "保存成功!"
}
```
**错误响应**
- 状态码:`401`
```json
{
"message": "Unauthorized"
}
```
- 状态码:`500`
```json
{
"message": "Failed to save feature settings"
}
```