为什么写这篇文章
你是否一直在找一个hexo后台,但不尽人意,或许在没有qexo之前,hpp是一个很好的选择,但是显然拥有更多能力的qexo是更好的选择
怎么用
申请 MongoDB
注册 MongoDB 账号 创建免费 MongoDB 数据库,区域推荐选择 AWS / N.
Virginia (us-east-1) 在 Clusters 页面点击 CONNECT,按步骤设置允许所有 IP 地址的连接),创建数据库用户,并记录数据库连接信息,密码即为你所设置的值
一键部署
点击按钮开始部署
重新进入项目,在项目设置界面添加环境变量 Environment Variables
名称 |
意义 |
示例 |
DOMAINS |
你所允许通信的安全域名 注意双引号而且是英文半角 |
[“.vercel.app”, “127.0.0.1”, “.yoursite.com”] |
MONGODB_HOST |
MongoDB 连接地址 |
mongodb+srv://cluster0.xxxx.mongodb.net |
MONGODB_PORT |
MongoDB 通信端口 默认应填写 27017 |
27017 |
MONGODB_USER |
MongoDB 用户名 |
abudu |
MONGODB_DB |
MongoDB 数据库名 |
Cluster0 |
MONGODB_PASS |
MongoDB 密码 |
JWo0xxxxxxxx |
在 Deployments 点击 Redeploy 开始部署,若没有 Error 信息即可打开域名进入初始化引导
相关api
写在前面
- Qexo 的 API 后方通常加上斜杠,否则可能出现重定向,可能会影响使用
- 若没有特殊说明,以下 API 都需要鉴权 ,具体方法为在 POST 或 GET 中添加项 token=”API密钥”
- Qexo 的 API 分为对公与程序内部调用两种,分别位于 pub 和 api 路径下,本文只说明对外 API,即可以通过 API 密钥进行校验
- 若没有特殊说明,本文提到的参数均需要 POST 请求
对公 API
pub/save/
修改文件
position-relative overflow-auto1 2 3 4
| { "msg": "OK!", "status": true }
|
pub/save_post/
修改文章
position-relative overflow-auto1 2 3 4
| { "msg": "OK!", "status": true }
|
pub/save_draft/
保存文章草稿
position-relative overflow-auto1 2 3 4
| { "msg": "OK!", "status": true }
|
pub/new/
新建文件
position-relative overflow-auto1 2 3 4
| { "msg": "OK!", "status": true }
|
pub/delete/
删除文件
position-relative overflow-auto1 2 3 4
| { "msg": "OK!", "status": true }
|
pub/delete_post/
删除文章
position-relative overflow-auto1 2 3 4
| { "msg": "OK!", "status": true }
|
pub/create_webhook/
创建 Webhook 事件
position-relative overflow-auto1 2 3 4
| { "msg": "设置成功!", "status": true }
|
pub/get_update/
获取更新
position-relative overflow-auto1 2 3 4 5 6 7 8
| { "hasNew": false, "newer": "1.5.5", "newer_link": "https://github.com/am-abudu/Qexo/releases/tag/1.5.5", "newer_time": "2022-02-16 23:27:23", "newer_text": " 修复已知BUG; 添加友链清理功能 ", "status": true }
|
pub/get_posts/
获取文章列表
position-relative overflow-auto1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| { "status": true, "posts": [ { "name": "10", "fullname": "10.md", "path": "source/_posts/10.md", "size": 592, "status": true }, { "name": "11", "fullname": "11.md", "path": "source/_posts/11.md", "size": 1118, "status": true } ] }
|
pub/get_pages/
获取页面列表
position-relative overflow-auto1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| { "status": true, "pages": [ { "name": "404", "path": "source/404/index.md", "size": 5059 }, { "name": "about", "path": "source/about/index.md", "size": 141 } ] }
|
pub/get_configs/
获取配置列表
position-relative overflow-auto1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| { "status": true, "configs": [ { "name": "main.yml", "path": ".github/workflows/main.yml", "size": 1500 }, { "name": "_config.butterfly.yml", "path": "_config.butterfly.yml", "size": 27990 } ] }
|
pub/get_images/
获取图片列表
position-relative overflow-auto1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| { "status": true, "images": [ { "name": "avatar-new-test3.png", "size": 556194, "url": "https://xxx", "date": "2021-11-15 23:03:53", "time": "1636988633.7590833" }, { "name": "image.png", "size": 2080250, "url": "https://xxx", "date": "2022-02-15 16:05:39", "time": "1644912339.5202296" } ] }
|
pub/fix/
自动修复程序
position-relative overflow-auto1 2 3 4
| { "msg": "尝试自动修复了 1 个字段,请在稍后检查和修改配置", "status": true }
|
pub/friends/
获取友链 无需鉴权
position-relative overflow-auto1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| { "data": [ { "name": "iMaeGoo’s Blog", "url": "https://www.imaegoo.com/", "image": "https://www.imaegoo.com/images/avatar.jpg", "description": "虹墨空间站", "time": "1642516414.3821218" }, { "name": "Icarus", "url": "https://ppoffice.github.io/hexo-theme-icarus/", "image": "https://ppoffice.github.io/hexo-theme-icarus/img/avatar.png", "description": "本站主题", "time": "1642516682.7982264" } ], "status": true }
|
pub/add_friend
新增友链
name |
url |
image |
description |
status |
名称 |
链接 |
图片URL |
描述 |
状态(隐藏/显示) |
position-relative overflow-auto1 2 3 4 5
| { "msg": "添加成功!", "time": "1642516682.7982264", "status": true }
|
pub/edit_friend
编辑友链
name |
url |
image |
description |
time |
status |
名称 |
链接 |
图片URL |
描述 |
该友链的时间戳 |
状态(隐藏/显示) |
position-relative overflow-auto1 2 3 4
| { "msg": "修改成功!", "status": true }
|
pub/del_friend
删除友链
position-relative overflow-auto1 2 3 4
| { "msg": "删除成功!", "status": true }
|
pub/ask_friend
申请友链 无需鉴权但需要在设置中开启
name |
url |
image |
description |
名称 |
链接 |
图片URL |
描述 |
position-relative overflow-auto1 2 3 4 5
| { "msg": "申请成功!", "time": "1642516682.7982264", "status": true }
|
pub/last 已移除于1.6.2
获取博主最后在线时间 已移除请使用/pub/status/
position-relative overflow-auto1 2 3 4
| { "msg": "1645543096", "status": true }
|
pub/get_custom
获取自定义的字段 无需鉴权
position-relative overflow-auto1 2 3 4
| { "data": "xxxx", "status": true }
|
pub/get_notifications
获取消息
position-relative overflow-auto1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| { "data": [ { "label": "title", "content": "text", "timestamp": "1647668134.7664979", "time": "2022-03-19 13:35:34" }, { "label": "title1", "content": "text1", "timestamp": "1647668134.7664979", "time": "2022-03-19 13:35:34" },
], "status": true }
|
pub/status
获取博客基本信息 无需鉴权
position-relative overflow-auto1 2 3 4 5 6 7
| { "data": { "posts": "68", "last": "1648050031" }, "status": true }
|
错误示例
错误返回在大多数情况相同
position-relative overflow-auto1 2 3 4
| { "msg": "Error Message", "status": false }
|
条评论