fix: missing file and table escape

This commit is contained in:
NeverBehave 2020-05-03 12:29:36 -04:00
parent 08021c086c
commit 2d734edc07
8 changed files with 58 additions and 49 deletions

View File

@ -3,8 +3,9 @@ const fs = require('fs');
module.exports = {
ROUTE_TYPE: 'route',
GUIDE_TYPE: 'guide',
LANG_CN: 'cn',
LANG_EN: 'en',
NAV_TYPE: 'nav',
LANG_CN: 'zh-CN',
LANG_EN: 'en-US',
readFile: async (filePath) => fs.promises.readFile(filePath, { encoding: 'utf8' }),
writeFile: async (filePath, data) => fs.promises.writeFile(filePath, data, { encoding: 'utf8' }),
};

View File

@ -19,7 +19,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以
可以配合浏览器扩展 [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) 食用
[Telegram 群](https://t.me/rsshub) | [Telegram 频道](https://t.me/awesomeRSSHub)
[Telegram 群](https://t.me/rsshub) \| [Telegram 频道](https://t.me/awesomeRSSHub)
## 鸣谢

View File

@ -21,6 +21,12 @@ const loopSideBar = (children, type, lang, prefix) =>
type,
lang,
}));
const loopNav = (nav, lang) =>
nav.map((e) => ({
path: path.resolve(__dirname, e.link.slice(1), 'README.md'),
type: file.NAV_TYPE,
lang,
}));
const loopType = (sidebar, lang, prefix) => loopSideBar(sidebar[0].children, file.GUIDE_TYPE, lang, prefix).concat(loopSideBar(sidebar[1].children, file.ROUTE_TYPE, lang, prefix));
/**
@ -37,12 +43,12 @@ const buildFileList = async () => {
let fileList = [];
Object.keys(config.themeConfig.locales).forEach((key) => {
const locale = config.themeConfig.locales[key];
const key_path = key.slice(1);
if (locale.hasOwnProperty('sidebar')) {
if (locale.sidebar['/']) {
fileList = fileList.concat(loopType(locale.sidebar['/'], file.LANG_CN, ''));
} else if (locale.sidebar['/en/']) {
fileList = fileList.concat(loopType(locale.sidebar['/en/'], file.LANG_EN, 'en/'));
}
fileList = fileList.concat(loopType(locale.sidebar[key], locale.lang, key_path));
}
if (locale.hasOwnProperty('nav')) {
fileList = fileList.concat(loopNav(locale.nav, locale.lang));
}
});

View File

@ -8,18 +8,18 @@ sidebar: auto
部署涉及到以下基本编程常识:
1. 命令行操作
1. [Git](https://git-scm.com/)
1. [Node.js](https://nodejs.org/)
1. [npm](https://www.npmjs.com/get-npm) 或 [yarn](https://yarnpkg.com/zh-Hans/docs/install)
1. 命令行操作
2. [Git](https://git-scm.com/)
3. [Node.js](https://nodejs.org/)
4. [npm](https://www.npmjs.com/get-npm) 或 [yarn](https://yarnpkg.com/zh-Hans/docs/install)
部署到可外网访问则可能涉及到:
1. [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/)
1. [Docker](https://www.docker.com/get-started) 或 [docker-compose](https://docs.docker.com/compose/install/)
1. [Redis](https://redis.io/download)
1. [Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs)
1. [Google App Engine](https://cloud.google.com/appengine/)
1. [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/)
2. [Docker](https://www.docker.com/get-started) 或 [docker-compose](https://docs.docker.com/compose/install/)
3. [Redis](https://redis.io/download)
4. [Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs)
5. [Google App Engine](https://cloud.google.com/appengine/)
## Docker Compose 部署
@ -73,7 +73,7 @@ $ docker pull diygod/rsshub
$ docker run -d --name rsshub -p 1200:1200 diygod/rsshub
```
在浏览器中打开 [http://127.0.0.1:1200/](http://127.0.0.1:1200/)enjoy it! ✅
在浏览器中打开 <http://127.0.0.1:1200/>enjoy it! ✅
您可以使用下面的命令来关闭 RSSHub
@ -153,7 +153,7 @@ $ yarn start
$ pm2 start lib/index.js --name rsshub
```
在浏览器中打开 [http://127.0.0.1:1200/](http://127.0.0.1:1200/)enjoy it! ✅
在浏览器中打开 <http://127.0.0.1:1200/>enjoy it! ✅
详细使用说明参照 [指南](https://docs.rsshub.app/),替换所有路由例子中的 `https://rsshub.app/``http://localhost:1200` 即可正常使用
@ -163,10 +163,8 @@ $ pm2 start lib/index.js --name rsshub
在项目根目录新建一个 `.env` 文件,每行以 `NAME=VALUE` 格式添加环境变量,例如
```
CACHE_TYPE=redis
CACHE_EXPIRE=600
```
CACHE_TYPE=redis
CACHE_EXPIRE=600
注意它不会覆盖已有的环境变量,更多规则请参考 [dotenv](https://github.com/motdotla/dotenv)
@ -265,7 +263,7 @@ env_variables:
::: warning 注意
- 需要 [DockerHub](https://hub.docker.com) 账号
- [Play with Docker](https://labs.play-with-docker.com/) 一次仅能使用 4 小时,不能作为持久化解决方案,应当用于测试/验证路由规则
- [Play with Docker](https://labs.play-with-docker.com/) 一次仅能使用 4 小时,不能作为持久化解决方案,应当用于测试 / 验证路由规则
- 如果部署完成后不能看到自动识别的端口,请手动点击顶部按钮`open port`并输入`1200`
- 有的时候 PWD 会抽风,如果遇到点击`Start`后空白页面,或者拉起失败,请重试
@ -319,7 +317,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式
`protected_route.js` 内的路由将启用 HTTP Basic Authentication 认证
支持该认证协议的阅读器,在添加源地址时,需要在源地址前添加认证信息,例如:http://usernam3:passw0rd@127.0.0.1:1200/protected/rsshub/routes
支持该认证协议的阅读器,在添加源地址时,需要在源地址前添加认证信息,例如:`http&#x3A;//usernam3:passw0rd@127.0.0.1passw0rd@127.0.0.1:1200/protected/rsshub/routes`
`HTTP_BASIC_AUTH_NAME`: Http basic authentication 用户名,默认为 `usernam3`,请务必修改
@ -401,7 +399,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式
- 邮箱 邮件列表路由:
- `EMAIL_CONFIG_{email}`: 邮箱设置,替换 `{email}` 为 邮箱账号,邮件账户的 `@` 替换为 `.`,例如 `EMAIL_CONFIG_xxx.qq.com`。内容格式为 `password=密码&host=服务器&port=端口`,例如 `password=123456&host=imap.qq.com&port=993`
- `EMAIL_CONFIG_{email}`: 邮箱设置,替换 `{email}` 为 邮箱账号,邮件账户的 `@` 替换为 `.`,例如 `EMAIL_CONFIG_xxx.qq.com`。内容格式为 `password = 密码 & host = 服务器 & port = 端口`,例如 `password=123456&host=imap.qq.com&port=993`
- 吹牛部落 栏目更新
@ -411,7 +409,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式
- `WEIBO_APP_KEY`: 微博 App Key
- `WEIBO_APP_SECRET`: 微博 App Secret
- `WEIBO_REDIRECT_URL`: 微博登录授权回调地址,默认为 `RSSHub地址/weibo/timeline/0`,自定义回调地址请确保最后可以转跳到 `RSSHub地址/weibo/timeline/0?code=xxx`
- `WEIBO_REDIRECT_URL`: 微博登录授权回调地址,默认为 `RSSHub 地址 / weibo/timeline/0`,自定义回调地址请确保最后可以转跳到 `RSSHub 地址 / weibo/timeline/0?code=xxx`
- 饭否 全部路由: [申请地址](https://github.com/FanfouAPI/FanFouAPIDoc/wiki/Oauth)
@ -426,7 +424,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式
- 北大未名 BBS 全站十大
- `PKUBBS_COOKIE`: BBS 注册用户登录后的 Cookie 值获取方式1.登录后打开论坛首页 2. 打开控制台 3. 刷新 4. 找到 <https://bbs.pku.edu.cn/v2/home.php> 请求 5. 找到请求头中的 Cookie
- `PKUBBS_COOKIE`: BBS 注册用户登录后的 Cookie 值获取方式1. 登录后打开论坛首页 2. 打开控制台 3. 刷新 4. 找到 <https://bbs.pku.edu.cn/v2/home.php> 请求 5. 找到请求头中的 Cookie
- nhentai torrent: [注册地址](https://nhentai.net/register/)

View File

@ -30,14 +30,16 @@ sidebar: auto
#### 获取源数据
- 获取源数据的主要手段为使用 [got](https://github.com/sindresorhus/got) 发起 HTTP 请求(请求接口或请求网页)获取数据
- 个别情况需要使用 [puppeteer](https://github.com/GoogleChrome/puppeteer) 模拟浏览器渲染目标页面并获取数据
- 返回的数据一般为 JSON 或 HTML 格式
- 对于 HTML 格式的数据,使用 [cheerio](https://github.com/cheeriojs/cheerio) 进行处理
- 以下三种获取数据方法按 **「推荐优先级」** 排列:
1. **使用 got 从接口获取数据**
1. **使用 got 从接口获取数据**
样例:[/lib/routes/bilibili/coin.js](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/bilibili/coin.js)。
@ -101,7 +103,7 @@ sidebar: auto
// 至此本路由结束
```
2. **使用 got 从 HTML 获取数据**
2. **使用 got 从 HTML 获取数据**
有时候数据是写在 HTML 里的,**没有接口供我们调用**,样例: [/lib/routes/douban/explore.js](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/douban/explore.js)。
@ -153,7 +155,7 @@ sidebar: auto
// 至此本路由结束
```
3. **使用 puppeteer 渲染页面获取数据**
3. **使用 puppeteer 渲染页面获取数据**
::: tip 提示
@ -213,16 +215,16 @@ sidebar: auto
// 注:由于此路由只是起到一个新专栏上架提醒的作用,无法访问付费文章,因此没有文章正文
```
4. **使用通用配置型路由**
4. **使用通用配置型路由**
很大一部分网站是可以通过一个配置范式来生成 RSS 的。
通用配置即通过 cheerio**CSS 选择器、jQuery 函数**)读取 json 数据来简便的生成 RSS。
首先我们需要几个数据:
1. RSS 来源链接
2. 数据来源链接
3. RSS 标题(非 item 标题)
1. RSS 来源链接
2. 数据来源链接
3. RSS 标题(非 item 标题)
```js
const buildData = require('@/utils/common-config');
@ -341,7 +343,7 @@ ctx.state.data = {
};
```
##### BT/磁力源
##### BT / 磁力源
用于下载类 RSS**额外**添加这些字段能使你的 RSS 被 BT 客户端识别并自动下载:
@ -392,13 +394,13 @@ ctx.state.data = {
- `example`: 路由举例
- `path`: 路由路径
- `:paramsDesc`: 路由参数说明,数组,支持 markdown
1. 参数说明必须对应其在路径中出现的顺序
1. 如缺少说明将会导致`npm run docs:dev`报错
1. 说明中的 `'` `"` 必须通过反斜杠转义 `\'` `\"`
1. 不必在说明中标注`可选/必选`,组件会根据路由`?`自动判断
1. 参数说明必须对应其在路径中出现的顺序
2. 如缺少说明将会导致`npm run docs:dev`报错
3. 说明中的 `'` `"` 必须通过反斜杠转义 `\'` `\"`
4. 不必在说明中标注`可选 / 必选`,组件会根据路由`?`自动判断
- 文档样例:
1. 无参数:
1. 无参数:
```vue
<Route author="HenryQW" example="/sspai/series" path="/sspai/series" />
@ -412,7 +414,7 @@ ctx.state.data = {
***
2. 多参数:
2. 多参数:
```vue
<Route author="HenryQW" example="/github/issue/DIYgod/RSSHub" path="/github/issue/:user/:repo" :paramsDesc="['用户名', '仓库名']" />
@ -455,7 +457,7 @@ ctx.state.data = {
1. 请一定要注意把`<Route>`的标签关闭!
1. 执行 `npm run format` 自动标准化代码格式,提交代码, 然后提交 pull request
2. 执行 `npm run format` 自动标准化代码格式,提交代码, 然后提交 pull request
## 提交新的 RSSHub Radar 规则

View File

@ -162,9 +162,10 @@ pageClass: routes
<Route author="SettingDust wolfyu1991" example="/mp4ba/6" path="/mp4ba/:param" :paramsDesc="['类型']" supportBT="1"/>
**类型参考这里**
| 电影 | 连续剧 | 动画 | 综艺 | 纪录片 |
\| ---- \| ------ \| ---- \| ---- \| ------ \|
| 6 | 7 | 15 | 20 | 24 |
| ---- | ------ | ---- | ---- | ------ |
| 6 | 7 | 15 | 20 | 24 |
| 动作片 | 喜剧片 | 爱情片 | 科幻片 | 恐怖片 |
| ------ | ------ | ------ | ------ | ------ |

View File

@ -14,7 +14,7 @@ RSSHub 是采用 MIT 许可的开源项目, 使用完全免费. 但是随着项
- 通过 [Patreon](https://www.patreon.com/DIYgod) 赞助
- 通过 [爱发电](https://afdian.net/@diygod) 赞助
- 给我们发邮件联系赞助事宜: i@diygod.me
- 给我们发邮件联系赞助事宜: [i@diygod.me](mailto:i@diygod.me)
## 一次性赞助

View File

@ -109,9 +109,10 @@ Solidot 提供的 feed:
| hk | tw | en |
`类別`
| 新聞總集 | 兩岸國際 | 財經 | 娛樂 | 體育 | 健康 |
\| -------- \| -------- \| -------- \| ------------- \| ------ \| ------ \|
| (空) | world | business | entertainment | sports | health |
| 新聞總集 | 兩岸國際 | 財經 | 娛樂 | 體育 | 健康 |
| -------- | -------- | -------- | ------------- | ------ | ------ |
| (空) | world | business | entertainment | sports | health |
</Route>