Publish emlog via gitea-publish skill

This commit is contained in:
qwenpaw-skills
2026-08-09 00:36:04 +00:00
commit 90d4ab8c39
2 changed files with 261 additions and 0 deletions
+86
View File
@@ -0,0 +1,86 @@
---
name: emlog
description: 发布文章到 emlog 博客。当用户提到「发文章」「发布到博客」「blog」「emlog」「article_post」「微语笔记」等时使用。基于 emlog REST API,支持文章发布、文章列表、分类查询、草稿管理、微语笔记等功能。
---
# emlog 博客发布 Skill
通过 emlog REST API 与博客系统交互,支持发布文章、查询文章、获取分类、管理草稿、发布微语等。
## 前置条件
- 博客需开启 API 功能(后台:系统-设置-API 设置)
- 需要 API 秘钥(后台可查看)
## 环境变量
| 变量 | 说明 | 默认值 |
|------|------|--------|
| `EMLOG_BASE_URL` | 博客站点地址,如 `https://blog.apescale.com` | `https://blog.apescale.com` |
| `EMLOG_API_KEY` | API 秘钥(后台系统-设置-API 设置) | 无 |
## 使用方式
```bash
# 发布文章(推荐:内容较长时用文件传参)
python3 scripts/emlog.py post \
--title "文章标题" \
--content-file /tmp/article.md \
--sort-id 14 \
--tags "QwenPaw,TencentDB"
# 发布文章(内容较短时直接传)
python3 scripts/emlog.py post --title "标题" --content "正文内容" --sort-id 14
# 获取分类列表
python3 scripts/emlog.py sorts
# 文章列表(可按分类过滤)
python3 scripts/emlog.py list --sort-id 14 --count 10
# 文章详情
python3 scripts/emlog.py detail --id 123
# 草稿列表
python3 scripts/emlog.py drafts
# 发布微语笔记
python3 scripts/emlog.py note --text "这是一条微语"
```
## 鉴权方式
脚本默认使用**免签名鉴权**(传 `api_key` 参数),简单可靠,建议配合 HTTPS 使用。
如需签名鉴权,可传 `--sign` 参数(自动计算 `md5(req_time + api_key)`)。
## 发布参数说明(article_post
| 参数 | 必填 | 说明 |
|------|------|------|
| `title` | ✅ | 标题 |
| `content` | ✅ | 内容(支持 Markdownemlog 会保存 raw 原文) |
| `excerpt` | ⬜ | 摘要 |
| `sort_id` | ⬜ | 分类 ID`emlog.py sorts` 可查) |
| `tags` | ⬜ | 标签,半角逗号分隔 |
| `draft` | ⬜ | `y` 存草稿 / `n` 发布(默认 `n` |
| `post_date` | ⬜ | 发布时间 `2026-08-08 12:00:00` |
| `alias` | ⬜ | 文章别名 |
| `top` | ⬜ | 首页置顶 `y`/`n` |
| `allow_remark` | ⬜ | 允许评论 `y`/`n` |
## 常见错误
| 返回 msg | 含义 | 处理 |
|----------|------|------|
| `sign error` | 签名错误 | 检查 API 秘钥 / 时间戳 |
| `api is closed` | 未开启 API | 后台系统-设置-API 设置开启 |
| `API function is not exist` | 接口名错误 | 检查 `rest-api` 参数 |
| `parameter error` | 必填参数缺失 | 检查 title/content |
## 返回格式
```json
{ "code": 0, "msg": "ok", "data": { "article_id": 14 } }
```
`code=0` 表示成功,`code=1` 表示失败(看 `msg`)。