---
title: qexo的搭建与使用
toc: true            # 是否生成目录 
indent: true         # 是否首行缩进 
comments: true       # 是否允许评论
cover: false         # 是否显示封面 
mathjax: false       # 是否渲染公式 
pin: false           # 是否首页置顶 
top_meta: true       # 是否显示顶部信息 
bottom_meta: true    # 是否显示尾部信息
tags:
  - 博客
  - 后台
categories: hexo
keywords: 文章关键词 
author: 青云工作室
description: # Qexo - 一个快速、强大、漂亮的在线 Hexo 编辑器
headimg: https://bu.dusays.com/2022/01/17/0f3d2cf954f82.png
date: 2022-03-19 20:01:18
updated: 2022-03-19 20:01:18
abbrlink: 37212
references: 
  - title: Qexo - 一个快速、强大、漂亮的在线 Hexo 编辑器
    url: https://www.oplog.cn/archives/59651.html
---
![](https://bu.dusays.com/2022/01/17/0f3d2cf954f82.png)

## 为什么写这篇文章

你是否一直在找一个hexo后台，但不尽人意，或许在没有qexo之前，hpp是一个很好的选择，但是显然拥有更多能力的qexo是更好的选择

## 为什么

qexo拥有如下功能

* 自定义图床上传图片
* 在线配置编辑
* 在线文章管理
* 在线页面管理
* 在线友链管理
* 较为完善的缓存功能
* Webhook 清除缓存
* 自动检查更新
* 实验性的在线更新
* 开放的 API

那么看起来qexo是非常强大的

## 怎么用

### 申请 MongoDB

[注册 MongoDB 账号](https://www.mongodb.com/cloud/atlas/register) 创建免费 MongoDB 数据库，区域推荐选择 AWS / N.
Virginia (us-east-1) 在 Clusters 页面点击 CONNECT，按步骤设置允许所有 IP 地址的连接），创建数据库用户，并记录数据库连接信息，密码即为你所设置的值

[![](https://bu.dusays.com/2021/11/09/6fd9e2a69e8bc.png)](https://bu.dusays.com/2021/11/09/6fd9e2a69e8bc.png)

### 一键部署

点击按钮开始部署 [![部署到 Vercel](https://camo.githubusercontent.com/5e471e99e8e022cf454693e38ec843036ec6301e27ee1e1fa10325b1cb720584/68747470733a2f2f76657263656c2e636f6d2f627574746f6e)](https://vercel.com/new/clone?repository-url=https://github.com/am-abudu/Qexo)

重新进入项目，在项目设置界面添加环境变量 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

### 写在前面

1. Qexo 的 API 后方通常加上斜杠，否则可能出现重定向，可能会影响使用
2. 若没有特殊说明，以下 API  **都需要鉴权** ，具体方法为在 POST 或 GET 中添加项 token="API密钥"
3. Qexo 的 API 分为对公与程序内部调用两种，分别位于 pub 和 api 路径下，本文只说明对外 API，即可以通过 API 密钥进行校验
4. 若没有特殊说明，本文提到的参数均需要 POST 请求

### 对公 API

#### pub/save/

修改文件


| file     | content |
| ---------- | --------- |
| 文件路径 | 内容    |

```json position-relative overflow-auto
{
    "msg": "OK!",
    "status": true
}
```

#### pub/save_post/

修改文章


| file   | content |
| -------- | --------- |
| 文章名 | 内容    |

```json position-relative overflow-auto
{
    "msg": "OK!",
    "status": true
}
```

#### pub/save_draft/

保存文章草稿


| file   | content |
| -------- | --------- |
| 文章名 | 内容    |

```json position-relative overflow-auto
{
    "msg": "OK!",
    "status": true
}
```

#### pub/new/

新建文件


| file     | content |
| ---------- | --------- |
| 文件路径 | 内容    |

```json position-relative overflow-auto
{
    "msg": "OK!",
    "status": true
}
```

#### pub/delete/

删除文件


| file     |
| ---------- |
| 文件路径 |

```json position-relative overflow-auto
{
    "msg": "OK!",
    "status": true
}
```

#### pub/delete_post/

删除文章


| file   |
| -------- |
| 文章名 |

```json position-relative overflow-auto
{
    "msg": "OK!",
    "status": true
}
```

#### pub/create_webhook/

创建 Webhook 事件


| uri                                                  |
| ------------------------------------------------------ |
| [https://xxx/api/webhook/](https://xxx/api/webhook/) |

```json position-relative overflow-auto
{
    "msg": "设置成功！",
    "status": true
}
```

#### pub/get_update/

获取更新

```json position-relative overflow-auto
{
    "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/

获取文章列表

```json position-relative overflow-auto
{
    "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/

获取页面列表

```json position-relative overflow-auto
{
    "status": true,
    "pages": [
        {
            "name": "404",
            "path": "source/404/index.md",
            "size": 5059
        },
        {
            "name": "about",
            "path": "source/about/index.md",
            "size": 141
        }
    ]
}
```

#### pub/get_configs/

获取配置列表

```json position-relative overflow-auto
{
    "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/

获取图片列表

```json position-relative overflow-auto
{
    "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/

自动修复程序

```json position-relative overflow-auto
{
    "msg": "尝试自动修复了 1 个字段，请在稍后检查和修改配置",
    "status": true
}
```

#### pub/friends/

获取友链 **无需鉴权**

```json position-relative overflow-auto
{
    "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 | 描述        | 状态(隐藏/显示) |

```json position-relative overflow-auto
{
    "msg": "添加成功！",
    "time": "1642516682.7982264",
    "status": true
}
```

#### pub/edit_friend

编辑友链


| name | url  | image   | description | time           | status          |
| ------ | ------ | --------- | ------------- | ---------------- | ----------------- |
| 名称 | 链接 | 图片URL | 描述        | 该友链的时间戳 | 状态(隐藏/显示) |

```json position-relative overflow-auto
{
    "msg": "修改成功！",
    "status": true
}
```

#### pub/del_friend

删除友链


| time           |
| ---------------- |
| 该友链的时间戳 |

```json position-relative overflow-auto
{
    "msg": "删除成功！",
    "status": true
}
```

#### pub/ask_friend

申请友链 **无需鉴权但需要在设置中开启**


| name | url  | image   | description |
| ------ | ------ | --------- | ------------- |
| 名称 | 链接 | 图片URL | 描述        |

```json position-relative overflow-auto
{
    "msg": "申请成功！",
    "time": "1642516682.7982264",
    "status": true
}
```

#### pub/last 已移除于1.6.2

获取博主最后在线时间 **已移除请使用/pub/status/**

```json position-relative overflow-auto
{
    "msg": "1645543096",
    "status": true
}
```

#### pub/get_custom

获取自定义的字段 **无需鉴权**


| key    |
| -------- |
| 字段名 |

```json position-relative overflow-auto
{
    "data": "xxxx",
    "status": true
}
```

#### pub/get_notifications

获取消息

```json position-relative overflow-auto
{
    "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

获取博客基本信息 **无需鉴权**

```json position-relative overflow-auto
{
    "data": {
        "posts": "68",
        "last": "1648050031"
    },
    "status": true
}
```

### 错误示例

错误返回在大多数情况相同

```json position-relative overflow-auto
{
    "msg": "Error Message", 
    "status": false
}
```

## 更多

去问abudu

终于水完这篇文章了
