mirror of
https://github.com/Vb-Lg/class-history-template.git
synced 2026-11-03 18:46:40 +00:00
docs: use standard markdown links between wiki pages; simplify cms-bot creation section
1 parent
ab333c0b34
commit
537ac58b6e
6 files changed
+24
-38
No files matched your search
+5
-19
@@ -15,36 +15,22 @@ cms-bot 是本模板的**投稿机器人**——一个 GitHub App。访客在「
|
|||||||
> GitHub App 名字全局唯一,`cms-bot` 若被占用就换一个(如 `xx-class-cms-bot`)。
|
> GitHub App 名字全局唯一,`cms-bot` 若被占用就换一个(如 `xx-class-cms-bot`)。
|
||||||
> App 归创建它的账号/组织所有——建议在自己的账号(或组织)下创建,私钥不假人手。
|
> App 归创建它的账号/组织所有——建议在自己的账号(或组织)下创建,私钥不假人手。
|
||||||
|
|
||||||
### 方式 A:手动创建(通用)
|
### 创建步骤
|
||||||
|
|
||||||
1. 打开 GitHub → 头像 → **Settings → Developer settings → GitHub Apps → New GitHub App**。
|
1. 打开 GitHub → 头像 → **Settings → Developer settings → GitHub Apps → New GitHub App**。
|
||||||
(组织仓库也可以在组织 Settings → Developer settings 里建,让 App 归组织所有。)
|
(组织仓库也可以在组织 Settings → Developer settings 里建,让 App 归组织所有。)
|
||||||
2. 按下表填写:
|
2. 按下表填写,然后点页面底部 **Create GitHub App**:
|
||||||
|
|
||||||
| 字段 | 填写 |
|
| 字段 | 填写 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| GitHub App name | `cms-bot` |
|
| GitHub App name | `cms-bot` |
|
||||||
| Homepage URL | 你的仓库地址 |
|
| Homepage URL | 你的仓库地址 |
|
||||||
| Webhook → **Active** | **取消勾选**(本模板只用 REST API,不需要 webhook) |
|
| Webhook → **Active** | **取消勾选**:本模板只用 REST API,不需要 webhook |
|
||||||
| Repository permissions → **Contents** | **Read and write** |
|
| Repository permissions → **Contents** | **Read and write** |
|
||||||
| Repository permissions → **Pull requests** | **Read and write** |
|
| Repository permissions → **Pull requests** | **Read and write** |
|
||||||
| Where can this GitHub App be installed | **Any account**(= 公开,任何仓库都能安装) |
|
| Where can this GitHub App be installed | **Any account**(= 公开,任何仓库都能安装) |
|
||||||
|
|
||||||
3. 页面底部 **Create GitHub App**。
|
其余权限保持默认(No access)即可。
|
||||||
|
|
||||||
### 方式 B:一键创建链接(manifest 流程)
|
|
||||||
|
|
||||||
适合帮别人预填全部权限。生成一个一次性 code(1 小时有效),对方打开链接点一下 Create 即可:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
source ~/proxy.sh # 如需代理
|
|
||||||
curl -sX POST https://api.github.com/user/apps/from-manifest \
|
|
||||||
-H "Authorization: Bearer $(gh auth token)" \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
-d '{"name":"cms-bot","url":"https://github.com/Vb-Lg/class-history-template","public":true,"default_permissions":{"contents":"write","pull_requests":"write"}}'
|
|
||||||
# 返回 {"code":"xxxx"} → 创建链接:
|
|
||||||
# https://github.com/app/apps-from-manifest/xxxx
|
|
||||||
```
|
|
||||||
|
|
||||||
## 二、拿到三样凭据
|
## 二、拿到三样凭据
|
||||||
|
|
||||||
@@ -66,7 +52,7 @@ Pages 项目 → Settings → Variables and Secrets(Production 与 Preview 都
|
|||||||
| `GITHUB_OWNER` | 仓库所有者(用户名或组织名) |
|
| `GITHUB_OWNER` | 仓库所有者(用户名或组织名) |
|
||||||
| `GITHUB_REPO` | 仓库名 |
|
| `GITHUB_REPO` | 仓库名 |
|
||||||
|
|
||||||
可选覆盖项见 [[Deployment\|部署]] 的环境变量总表。
|
可选覆盖项见 [部署](/Vb-Lg/class-history-template/wiki/Deployment) 的环境变量总表。
|
||||||
|
|
||||||
## 四、验证
|
## 四、验证
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -51,4 +51,4 @@ cover: /pages/static/sports-day.png
|
|||||||
|
|
||||||
文章引用的图片、音视频放 `public/pages/static/`,正文以 `/pages/static/文件名` 引用。投稿表单上传的封面图也会由后端提交到该目录。
|
文章引用的图片、音视频放 `public/pages/static/`,正文以 `/pages/static/文件名` 引用。投稿表单上传的封面图也会由后端提交到该目录。
|
||||||
|
|
||||||
以上三类内容也都可以不经过表单、直接改文件提交——投稿表单只是给同学用的便捷入口(见 [[CMS-Bot|cms-bot 使用教程]])。
|
以上三类内容也都可以不经过表单、直接改文件提交——投稿表单只是给同学用的便捷入口(见 [cms-bot 使用教程](/Vb-Lg/class-history-template/wiki/CMS-Bot))。
|
||||||
+3
-3
@@ -17,8 +17,8 @@ Cloudflare Dashboard → Workers & Pages → Create → Pages → Connect to Git
|
|||||||
|
|
||||||
`functions/` 目录会被自动部署为 Pages Functions,无需额外配置:
|
`functions/` 目录会被自动部署为 Pages Functions,无需额外配置:
|
||||||
|
|
||||||
- `POST /api/submit` —— 投稿 → GitHub PR(需配置 [[CMS-Bot|cms-bot]])
|
- `POST /api/submit` —— 投稿 → GitHub PR(需配置 [cms-bot](/Vb-Lg/class-history-template/wiki/CMS-Bot))
|
||||||
- `GET/POST /api/messages` —— 留言墙(需绑定 D1,见 [[Message-Board|留言墙]])
|
- `GET/POST /api/messages` —— 留言墙(需绑定 D1,见 [留言墙](/Vb-Lg/class-history-template/wiki/Message-Board))
|
||||||
|
|
||||||
## 4. 环境变量总表
|
## 4. 环境变量总表
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ Cloudflare Dashboard → Workers & Pages → Create → Pages → Connect to Git
|
|||||||
| `MEDIA_DIR` | | 上传文件目录,默认 `public/pages/static` |
|
| `MEDIA_DIR` | | 上传文件目录,默认 `public/pages/static` |
|
||||||
| `MEDIA_URL_PREFIX` | | 上传文件 URL 前缀,默认 `/pages/static` |
|
| `MEDIA_URL_PREFIX` | | 上传文件 URL 前缀,默认 `/pages/static` |
|
||||||
| `SONGS_DIR` | | 歌曲目录,默认 `src/songs` |
|
| `SONGS_DIR` | | 歌曲目录,默认 `src/songs` |
|
||||||
| `TURNSTILE_SECRET_KEY` | | Turnstile 私钥,见 [[Turnstile\|Turnstile]] |
|
| `TURNSTILE_SECRET_KEY` | | Turnstile 私钥,见 [Turnstile](/Vb-Lg/class-history-template/wiki/Turnstile) |
|
||||||
| `PUBLIC_TURNSTILE_SITE_KEY` | | Turnstile 站点 key(**构建时**变量,需加入构建环境) |
|
| `PUBLIC_TURNSTILE_SITE_KEY` | | Turnstile 站点 key(**构建时**变量,需加入构建环境) |
|
||||||
|
|
||||||
不配置 GitHub 相关变量时:站点正常浏览,仅投稿功能不可用。
|
不配置 GitHub 相关变量时:站点正常浏览,仅投稿功能不可用。
|
||||||
|
|||||||
+7
-7
@@ -8,18 +8,18 @@
|
|||||||
- 📖 **班史列表 / 文章页**:`src/content/*.md` 自动生成,按日期升序排列,支持封面、摘要、上下篇导航
|
- 📖 **班史列表 / 文章页**:`src/content/*.md` 自动生成,按日期升序排列,支持封面、摘要、上下篇导航
|
||||||
- 🎵 **班级歌单**:`src/songs/*.json` 自动生成,支持每日随机排序、随机抽歌
|
- 🎵 **班级歌单**:`src/songs/*.json` 自动生成,支持每日随机排序、随机抽歌
|
||||||
- 💬 **留言墙**:Cloudflare D1 数据库存储
|
- 💬 **留言墙**:Cloudflare D1 数据库存储
|
||||||
- 📝 **在线投稿**:班史 / 音乐两种表单,提交后由 [[CMS-Bot|cms-bot]] 自动建分支并发 PR,管理员审核合并后自动发布
|
- 📝 **在线投稿**:班史 / 音乐两种表单,提交后由 [cms-bot](/Vb-Lg/class-history-template/wiki/CMS-Bot) 自动建分支并发 PR,管理员审核合并后自动发布
|
||||||
|
|
||||||
## 文档导航
|
## 文档导航
|
||||||
|
|
||||||
| 页面 | 内容 |
|
| 页面 | 内容 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [[Quick-Start\|快速开始与定制]] | 本地开发、班级信息定制、删除示例内容 |
|
| [快速开始与定制](/Vb-Lg/class-history-template/wiki/Quick-Start) | 本地开发、班级信息定制、删除示例内容 |
|
||||||
| [[Content-Format\|内容格式]] | 班史文章 / 歌曲的文件格式与字段说明 |
|
| [内容格式](/Vb-Lg/class-history-template/wiki/Content-Format) | 班史文章 / 歌曲的文件格式与字段说明 |
|
||||||
| [[Deployment\|部署到 Cloudflare Pages]] | 构建配置、环境变量总表 |
|
| [部署到 Cloudflare Pages](/Vb-Lg/class-history-template/wiki/Deployment) | 构建配置、环境变量总表 |
|
||||||
| [[CMS-Bot\|cms-bot 使用教程]] | 投稿机器人的创建、安装与配置 |
|
| [cms-bot 使用教程](/Vb-Lg/class-history-template/wiki/CMS-Bot) | 投稿机器人的创建、安装与配置 |
|
||||||
| [[Message-Board\|留言墙(D1)]] | D1 数据库建表与绑定 |
|
| [留言墙(D1)](/Vb-Lg/class-history-template/wiki/Message-Board) | D1 数据库建表与绑定 |
|
||||||
| [[Turnstile\|Turnstile 人机验证]] | 投稿表单人机验证(可选) |
|
| [Turnstile 人机验证](/Vb-Lg/class-history-template/wiki/Turnstile) | 投稿表单人机验证(可选) |
|
||||||
|
|
||||||
## 相关链接
|
## 相关链接
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -28,4 +28,4 @@ npm run dev # http://localhost:4321
|
|||||||
- `src/songs/20250101-example.json` —— 示例歌曲
|
- `src/songs/20250101-example.json` —— 示例歌曲
|
||||||
- `public/pages/static/cover-placeholder.svg` —— 占位封面(可保留备用)
|
- `public/pages/static/cover-placeholder.svg` —— 占位封面(可保留备用)
|
||||||
|
|
||||||
正式写内容请看 [[Content-Format|内容格式]]。
|
正式写内容请看 [内容格式](/Vb-Lg/class-history-template/wiki/Content-Format)。
|
||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
**班史模板 · 文档**
|
**班史模板 · 文档**
|
||||||
|
|
||||||
- [[Home|首页]]
|
- [首页](/Vb-Lg/class-history-template/wiki/Home)
|
||||||
- [[Quick-Start|快速开始与定制]]
|
- [快速开始与定制](/Vb-Lg/class-history-template/wiki/Quick-Start)
|
||||||
- [[Content-Format|内容格式]]
|
- [内容格式](/Vb-Lg/class-history-template/wiki/Content-Format)
|
||||||
- [[Deployment|部署到 Cloudflare Pages]]
|
- [部署到 Cloudflare Pages](/Vb-Lg/class-history-template/wiki/Deployment)
|
||||||
- [[CMS-Bot|cms-bot 使用教程]]
|
- [cms-bot 使用教程](/Vb-Lg/class-history-template/wiki/CMS-Bot)
|
||||||
- [[Message-Board|留言墙(D1)]]
|
- [留言墙(D1)](/Vb-Lg/class-history-template/wiki/Message-Board)
|
||||||
- [[Turnstile|Turnstile 人机验证]]
|
- [Turnstile 人机验证](/Vb-Lg/class-history-template/wiki/Turnstile)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user