optimize directory structure

This commit is contained in:
DIYgod
2018-12-26 18:35:10 +08:00
parent c68251e461
commit 38a90e29b0
475 changed files with 52 additions and 52 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ package-lock.json
.idea
.DS_Store
docs/.vuepress/dist
config/app.json
config/config.js
lib/config/app.json
lib/config/config.js
yarn-error.log
tmp
*.swp
+1 -1
View File
@@ -1 +1 @@
web: node index.js
web: node lib/index.js
+1 -1
View File
@@ -41,7 +41,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
### 提交新的 RSS 内容
1. 在 [/router.js](https://github.com/DIYgod/RSSHub/blob/master/router.js) 里添加路由
1. 在 [/lib/router.js](https://github.com/DIYgod/RSSHub/blob/master/lib/router.js) 里添加路由
2. 在 [/routes/](https://github.com/DIYgod/RSSHub/tree/master/routes) 中的路由对应路径添加获取 RSS 内容的脚本
+2 -2
View File
@@ -21,8 +21,8 @@ services:
CACHE_TYPE: redis
REDIS_URL: 'redis://db.redis:6379/'
volumes:
- ./config/app.json:/app/app.json
- ./config/config.js:/app/config.js
- ./lib/config/app.json:/app/lib/app.json
- ./lib/config/config.js:/app/lib/config.js
depends_on:
- db.redis
+1 -1
View File
@@ -101,7 +101,7 @@ RSSHub provides the following APIs:
### List of Public Routes
::: tip Tip
This API **will not** return any routes under `protected_router.js`.
This API **will not** return any routes under `lib/protected_router.js`.
:::
Eg: <https://rsshub.app/api/routes/github>
+3 -3
View File
@@ -80,7 +80,7 @@ $ git pull
### Configuration
`RSSHub` reads its configurations from `config.js` or system environment variables.
`RSSHub` reads its configurations from `lib/config.js` or system environment variables.
**How to set system environment variables**
@@ -150,7 +150,7 @@ $ docker volume create redis-data
2. Change `environment` section in [docker-compose.yml](https://github.com/DIYgod/RSSHub/blob/master/docker-compose.yml) to configure the corresponding option
- `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1` skips puppeteer Chromium installation. Default to 1, requires `puppeteerWSEndpoint` in `config.js` to be set with a remote Chrome Websocket address, otherwise relevant routes will not work.
- `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1` skips puppeteer Chromium installation. Default to 1, requires `puppeteerWSEndpoint` in `lib/config.js` to be set with a remote Chrome Websocket address, otherwise relevant routes will not work.
- `USE_CHINA_NPM_REGISTRY=1` avoids GFW npm registry interference in mainland China. Default to 0.
3. Deploy
@@ -250,7 +250,7 @@ You can access your `Google App Engine URL` to check the deployment status
### Application Settings
`RSSHub` reads its configurations from `config.js` or environment variables.
`RSSHub` reads its configurations from `lib/config.js` or environment variables.
::: tip
+2 -2
View File
@@ -8,7 +8,7 @@ We welcome all pull requests. Suggestions and feedback are also welcomed [here](
## Submit new RSS source
1. Add a new route in [/router.js](https://github.com/DIYgod/RSSHub/blob/master/router.js)
1. Add a new route in [/lib/router.js](https://github.com/DIYgod/RSSHub/blob/master/lib/router.js)
1. Add the script to the corresponding directory [/routes/](https://github.com/DIYgod/RSSHub/tree/master/routes)
@@ -87,7 +87,7 @@ Some websites provides no API and pages require rendering too, use [puppeteer](h
### Enable caching
All routes has a default cache expiry time set in `config.js`, it should be increased when the data source is not subject to frequent updates.
All routes has a default cache expiry time set in `lib/config.js`, it should be increased when the data source is not subject to frequent updates.
Add to cache:
+3 -3
View File
@@ -84,7 +84,7 @@ $ git pull
### 添加配置
可以通过修改 `config.js` 或者设置环境变量来配置 RSSHub.
可以通过修改 `lib/config.js` 或者设置环境变量来配置 RSSHub.
**如何设置环境变量**
@@ -154,7 +154,7 @@ $ docker volume create redis-data
2. 修改 [docker-compose.yml](https://github.com/DIYgod/RSSHub/blob/master/docker-compose.yml) 中的 `environment` 进行配置
- `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1` 用以跳过 puppeteer Chromium 的安装. 默认为 1, 需要在 `config.js` 中的 `puppeteerWSEndpoint`中设置相应的远程 Chrome Websocket 地址, 以启用相应路由.
- `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1` 用以跳过 puppeteer Chromium 的安装. 默认为 1, 需要在 `lib/config.js` 中的 `puppeteerWSEndpoint`中设置相应的远程 Chrome Websocket 地址, 以启用相应路由.
- `USE_CHINA_NPM_REGISTRY=1` 防止 npm 受到来自 GFW 的干扰. 默认为 0.
3. 部署
@@ -256,7 +256,7 @@ gcloud app deploy
### 应用配置
可以通过修改 `config.js` 或者设置环境变量来配置 RSSHub.
可以通过修改 `lib/config.js` 或者设置环境变量来配置 RSSHub.
::: tip 提示
+32 -32
View File
@@ -260,7 +260,7 @@ sidebar: auto
#### 使用缓存
所有路由都有一个缓存,全局缓存时间在 `config.js` 里设定,但某些接口返回的内容更新频率较低,这时应该给这些数据设置一个更长的缓存时间。
所有路由都有一个缓存,全局缓存时间在 `lib/config.js` 里设定,但某些接口返回的内容更新频率较低,这时应该给这些数据设置一个更长的缓存时间。
- 添加缓存:
@@ -361,48 +361,48 @@ ctx.state.data = {
### 步骤 2: 添加脚本路由
在 [/router.js](https://github.com/DIYgod/RSSHub/blob/master/router.js) 里添加路由:
在 [/lib/router.js](https://github.com/DIYgod/RSSHub/blob/master/lib/router.js) 里添加路由:
#### 举例
1. [bilibili/bangumi](https://github.com/DIYgod/RSSHub/blob/master/routes/bilibili/bangumi.js)
| 类型 | 代码 |
| ---------------------- | ---------------------------------------------------------------------------------- |
| 路由 | `/bilibili/bangumi/:seasonid` |
| 数据来源 | bilibili |
| 路由名称 | bangumi |
| 参数 1 | :seasonid 必选 |
| 参数 2 | 无 |
| 参数 3 | 无 |
| 脚本路径 | `./routes/bilibili/bangumi` |
| router.js 中的完整代码 | `router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi'));` |
| 类型 | 代码 |
| -------------------------- | ---------------------------------------------------------------------------------- |
| 路由 | `/bilibili/bangumi/:seasonid` |
| 数据来源 | bilibili |
| 路由名称 | bangumi |
| 参数 1 | :seasonid 必选 |
| 参数 2 | 无 |
| 参数 3 | 无 |
| 脚本路径 | `./routes/bilibili/bangumi` |
| lib/router.js 中的完整代码 | `router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi'));` |
1. [github/issue](https://github.com/DIYgod/RSSHub/blob/master/routes/github/issue.js)
| 类型 | 代码 |
| ---------------------- | ---------------------------------------------------------------------------- |
| 路由 | `/github/issue/:user/:repo` |
| 数据来源 | github |
| 路由名称 | issue |
| 参数 1 | :user 必选 |
| 参数 2 | :repo 必选 |
| 参数 3 | 无 |
| 脚本路径 | `./routes/github/issue` |
| router.js 中的完整代码 | `router.get('/github/issue/:user/:repo', require('./routes/github/issue'));` |
| 类型 | 代码 |
| -------------------------- | ---------------------------------------------------------------------------- |
| 路由 | `/github/issue/:user/:repo` |
| 数据来源 | github |
| 路由名称 | issue |
| 参数 1 | :user 必选 |
| 参数 2 | :repo 必选 |
| 参数 3 | 无 |
| 脚本路径 | `./routes/github/issue` |
| lib/router.js 中的完整代码 | `router.get('/github/issue/:user/:repo', require('./routes/github/issue'));` |
1. [embassy](https://github.com/DIYgod/RSSHub/blob/master/routes/embassy/index.js)
| 类型 | 代码 |
| ---------------------- | ---------------------------------------------------------------------------- |
| 路由 | `/embassy/:country/:city?` |
| 数据来源 | embassy |
| 路由名称 | 无 |
| 参数 1 | :country 必选 |
| 参数 2 | ?city 可选 |
| 参数 3 | 无 |
| 脚本路径 | `./routes/embassy/index` |
| router.js 中的完整代码 | `router.get('/embassy/:country/:city?', require('./routes/embassy/index'));` |
| 类型 | 代码 |
| -------------------------- | ---------------------------------------------------------------------------- |
| 路由 | `/embassy/:country/:city?` |
| 数据来源 | embassy |
| 路由名称 | 无 |
| 参数 1 | :country 必选 |
| 参数 2 | ?city 可选 |
| 参数 3 | 无 |
| 脚本路径 | `./routes/embassy/index` |
| lib/router.js 中的完整代码 | `router.get('/embassy/:country/:city?', require('./routes/embassy/index'));` |
### 步骤 3: 添加脚本文档
View File
View File
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File
View File

Some files were not shown because too many files have changed in this diff Show More