Files
cwd/api-docs/cwd-api.json
shumengya 4a45ba80a4
Some checks failed
Create Release / check-release (push) Has been cancelled
Build and Deploy Docs / build-and-deploy (push) Has been cancelled
Publish npm / publish (push) Has been cancelled
chore: sync local changes to Gitea
2026-06-24 22:10:23 +08:00

1166 lines
33 KiB
JSON
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.
{
"info": {
"name": "cwd-api",
"description": "CWD 评论系统 Cloudflare Workers API访客端评论、点赞、访问统计与管理员后台配置、备份等接口。",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_postman_id": "cwd-api-collection-001"
},
"variable": [
{
"key": "baseUrl",
"value": "https://cwd.api.smyhub.com"
},
{
"key": "adminToken",
"value": ""
},
{
"key": "adminName",
"value": "Admin"
},
{
"key": "adminPassword",
"value": ""
},
{
"key": "cwdLikeUser",
"value": ""
},
{
"key": "postSlug",
"value": "/"
},
{
"key": "siteId",
"value": ""
},
{
"key": "commentId",
"value": "1"
},
{
"key": "s3BackupKey",
"value": ""
}
],
"item": [
{
"name": "公开接口",
"item": [
{
"name": "GET / 版本与健康",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "GET 获取评论列表",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/comments?post_slug={{postSlug}}&page=1&limit=20&nested=true",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"comments"
],
"query": [
{
"key": "post_slug",
"value": "{{postSlug}}"
},
{
"key": "page",
"value": "1"
},
{
"key": "limit",
"value": "20"
},
{
"key": "nested",
"value": "true"
},
{
"key": "site_id",
"value": "{{siteId}}",
"disabled": true
},
{
"key": "avatar_prefix",
"value": "",
"disabled": true
}
]
}
}
},
{
"name": "POST 发表评论",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/comments",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"post_slug\": \"{{postSlug}}\",\n \"content\": \"示例评论\",\n \"name\": \"访客\",\n \"email\": \"user@example.com\",\n \"url\": \"\",\n \"post_title\": \"\",\n \"post_url\": \"\",\n \"site_id\": \"{{siteId}}\",\n \"parent_id\": null\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 验证管理员密钥(前台)",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/verify-admin",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"adminToken\": \"your-admin-key-from-settings\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 记录页面访问",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/analytics/visit",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"postSlug\": \"{{postSlug}}\",\n \"postTitle\": \"\",\n \"postUrl\": \"https://example.com/page\",\n \"siteId\": \"{{siteId}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 页面 PV",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/analytics/pv?post_slug={{postSlug}}&siteId={{siteId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"analytics",
"pv"
],
"query": [
{
"key": "post_slug",
"value": "{{postSlug}}"
},
{
"key": "siteId",
"value": "{{siteId}}"
}
]
}
}
},
{
"name": "GET 文章点赞状态",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/like?post_slug={{postSlug}}&siteId={{siteId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"like"
],
"query": [
{
"key": "post_slug",
"value": "{{postSlug}}"
},
{
"key": "siteId",
"value": "{{siteId}}"
}
]
}
}
},
{
"name": "POST 文章点赞",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/like",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"postSlug\": \"{{postSlug}}\",\n \"postTitle\": \"\",\n \"postUrl\": \"\",\n \"siteId\": \"{{siteId}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 评论点赞",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/comments/like",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"{{commentId}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "DELETE 取消评论点赞",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/comments/like?id={{commentId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"comments",
"like"
],
"query": [
{
"key": "id",
"value": "{{commentId}}"
}
]
}
}
},
{
"name": "GET 公开评论配置",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/config/comments",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "POST Telegram Webhook",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/telegram/webhook",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"message\": {}\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
}
]
},
{
"name": "管理员",
"item": [
{
"name": "POST 管理员登录",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/login",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"{{adminName}}\",\n \"password\": \"{{adminPassword}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"auth": {
"type": "noauth"
}
}
},
{
"name": "需 Bearer Token",
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{adminToken}}",
"type": "string"
}
]
},
"item": [
{
"name": "DELETE 删除评论",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/delete?id={{commentId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"comments",
"delete"
],
"query": [
{
"key": "id",
"value": "{{commentId}}"
}
]
}
}
},
{
"name": "GET 评论列表(后台)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/list?page=1&siteId={{siteId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"comments",
"list"
],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "siteId",
"value": "{{siteId}}",
"disabled": true
}
]
}
}
},
{
"name": "GET 导出评论 JSON",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/export",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "POST 导入评论",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/import",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "[]",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 封禁 IP",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/block-ip",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"ip\": \"1.2.3.4\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 封禁邮箱",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/block-email",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"spam@example.com\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "PUT 更新评论状态",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/status?id={{commentId}}&status=approved",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"comments",
"status"
],
"query": [
{
"key": "id",
"value": "{{commentId}}"
},
{
"key": "status",
"value": "approved"
}
]
}
}
},
{
"name": "PUT 编辑评论",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/comments/update",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"{{commentId}}\",\n \"name\": \"\",\n \"email\": \"\",\n \"url\": \"\",\n \"status\": \"approved\",\n \"priority\": 0,\n \"content\": \"\",\n \"postSlug\": \"{{postSlug}}\",\n \"postUrl\": \"\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 导出配置",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/export/config",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "POST 导入配置",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/import/config",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "[\n {\n \"key\": \"comment_admin_email\",\n \"value\": \"\"\n }\n]",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 导出统计数据",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/export/stats",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "POST 导入统计数据",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/import/stats",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"page_stats\": [],\n \"page_visit_daily\": [],\n \"likes\": []\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 评论统计",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/stats/comments",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "GET 全量备份导出",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/export/backup",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "POST 全量备份导入",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/import/backup",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"version\": \"1.0\",\n \"comments\": [],\n \"settings\": []\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 访问概览",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/analytics/overview?siteId={{siteId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"analytics",
"overview"
],
"query": [
{
"key": "siteId",
"value": "{{siteId}}",
"disabled": true
}
]
}
}
},
{
"name": "GET 访问页面列表",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/analytics/pages?siteId={{siteId}}&order=pv",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"analytics",
"pages"
],
"query": [
{
"key": "siteId",
"value": "{{siteId}}",
"disabled": true
},
{
"key": "order",
"value": "pv",
"description": "pv 或 latest"
}
]
}
}
},
{
"name": "GET 站点列表",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/stats/sites",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "GET 点赞记录列表",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/likes/list?siteId={{siteId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"likes",
"list"
],
"query": [
{
"key": "siteId",
"value": "{{siteId}}",
"disabled": true
}
]
}
}
},
{
"name": "GET 点赞统计",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/likes/stats?siteId={{siteId}}",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"likes",
"stats"
],
"query": [
{
"key": "siteId",
"value": "{{siteId}}",
"disabled": true
}
]
}
}
},
{
"name": "GET 功能开关",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/features",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "PUT 功能开关",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/features",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"enableCommentLike\": true,\n \"enableArticleLike\": true,\n \"enableImageLightbox\": true,\n \"commentPlaceholder\": \"\",\n \"visibleDomains\": [],\n \"adminLanguage\": \"zh-CN\",\n \"widgetLanguage\": \"zh-CN\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 管理员通知邮箱",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/email",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "PUT 管理员通知邮箱",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/email",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"admin@example.com\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 邮件通知配置",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/email-notify",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "PUT 邮件通知配置",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/email-notify",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"globalEnabled\": true,\n \"smtp\": {},\n \"templates\": {}\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 发送测试邮件",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/email-test",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"toEmail\": \"you@example.com\",\n \"smtp\": {\n \"host\": \"smtp.example.com\",\n \"port\": 465,\n \"secure\": true,\n \"user\": \"\",\n \"pass\": \"\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET Telegram 配置",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/telegram",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "PUT Telegram 配置",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/telegram",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"botToken\": \"\",\n \"chatId\": \"\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 设置 Telegram Webhook",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/telegram/setup",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "POST 发送 Telegram 测试消息",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/telegram/test",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "GET S3 配置",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/s3",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "PUT S3 配置",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/s3",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"endpoint\": \"\",\n \"bucket\": \"\",\n \"region\": \"auto\",\n \"accessKeyId\": \"\",\n \"secretAccessKey\": \"\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "POST 触发 S3 备份",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/backup/s3",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "GET S3 备份列表",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/backup/s3/list",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "DELETE 删除 S3 备份",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/backup/s3?key={{s3BackupKey}}",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"backup",
"s3"
],
"query": [
{
"key": "key",
"value": "{{s3BackupKey}}"
}
]
}
}
},
{
"name": "GET 下载 S3 备份",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/backup/s3/download?key={{s3BackupKey}}",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"backup",
"s3",
"download"
],
"query": [
{
"key": "key",
"value": "{{s3BackupKey}}"
}
]
}
}
},
{
"name": "GET 后台显示标题",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/admin-display",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "PUT 后台显示标题",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/admin-display",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"layoutTitle\": \"CWD 评论系统\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
},
{
"name": "GET 评论系统配置",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/comments",
"host": [
"{{baseUrl}}"
]
}
}
},
{
"name": "PUT 评论系统配置",
"request": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/settings/comments",
"host": [
"{{baseUrl}}"
]
},
"body": {
"mode": "raw",
"raw": "{\n \"adminEmail\": \"\",\n \"adminBadge\": \"\",\n \"avatarPrefix\": \"\",\n \"adminEnabled\": true,\n \"allowedDomains\": [],\n \"adminKey\": \"\",\n \"requireReview\": false,\n \"blockedIps\": [],\n \"blockedEmails\": []\n}",
"options": {
"raw": {
"language": "json"
}
}
}
}
}
]
}
]
}
]
}