mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-03 18:48:12 +08:00
feat: rename routes dir - 1/2
This commit is contained in:
@@ -43,4 +43,4 @@ vercel.json
|
|||||||
.git/hooks
|
.git/hooks
|
||||||
|
|
||||||
# rsshub auxiliary files
|
# rsshub auxiliary files
|
||||||
lib/v2/**/radar.js
|
lib/routes/**/radar.js
|
||||||
|
|||||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -32,7 +32,7 @@ If your changes are not related to route, please fill in `routes` section with `
|
|||||||
## New RSS Route Checklist / 新 RSS 路由检查表
|
## New RSS Route Checklist / 新 RSS 路由检查表
|
||||||
|
|
||||||
- [ ] New Route / 新的路由
|
- [ ] New Route / 新的路由
|
||||||
- [ ] Follows [v2 Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [v2 路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard)
|
- [ ] Follows [Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard)
|
||||||
- [ ] Documentation / 文档说明
|
- [ ] Documentation / 文档说明
|
||||||
- [ ] Full text / 全文获取
|
- [ ] Full text / 全文获取
|
||||||
- [ ] Use cache / 使用缓存
|
- [ ] Use cache / 使用缓存
|
||||||
|
|||||||
12
.github/labeler.yml
vendored
12
.github/labeler.yml
vendored
@@ -1,16 +1,16 @@
|
|||||||
'Route: v1':
|
'Route: deprecated':
|
||||||
- changed-files:
|
- changed-files:
|
||||||
- any-glob-to-any-file: ['lib/router.js']
|
- any-glob-to-any-file: ['lib/router.js']
|
||||||
- all-globs-to-any-file: ['lib/routes/**/*.js', '!lib/routes/index.js']
|
- all-globs-to-any-file: ['lib/routes-deprecated/**/*.js', '!lib/routes-deprecated/index.js']
|
||||||
|
|
||||||
'Route: v2':
|
'Route':
|
||||||
- changed-files:
|
- changed-files:
|
||||||
- any-glob-to-any-file: ['lib/v2/**/*.js']
|
- any-glob-to-any-file: ['lib/routes/**/*.js']
|
||||||
|
|
||||||
core enhancement:
|
core enhancement:
|
||||||
- changed-files:
|
- changed-files:
|
||||||
- any-glob-to-any-file: ['lib/routes/index.js']
|
- any-glob-to-any-file: ['lib/routes/index.ts']
|
||||||
- all-globs-to-any-file: ['lib/**', '!/lib/config.js', '!lib/router.js', '!lib/routes/**', '!lib/v2/**']
|
- all-globs-to-any-file: ['lib/**', '!/lib/config.ts', '!lib/routes/**']
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- changed-files:
|
- changed-files:
|
||||||
|
|||||||
3
.github/workflows/docker-release.yml
vendored
3
.github/workflows/docker-release.yml
vendored
@@ -9,8 +9,7 @@ on:
|
|||||||
- 'lib/**'
|
- 'lib/**'
|
||||||
- '!**/maintainer.js'
|
- '!**/maintainer.js'
|
||||||
- '!**/radar.js'
|
- '!**/radar.js'
|
||||||
- '!lib/v2/test/**'
|
- '!lib/**/*.test.ts'
|
||||||
- '!test/**'
|
|
||||||
- 'Dockerfile'
|
- 'Dockerfile'
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ describe('RequestInProgressError', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('v2 route throws an error', () => {
|
describe('route throws an error', () => {
|
||||||
it('v2 route path error should have path mounted', async () => {
|
it('route path error should have path mounted', async () => {
|
||||||
await request.get('/test/error');
|
await request.get('/test/error');
|
||||||
await request.get('/thisDoesNotExist');
|
await request.get('/thisDoesNotExist');
|
||||||
const response = await request.get('/');
|
const response = await request.get('/');
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ import type { Hono, Handler } from 'hono';
|
|||||||
import { serveStatic } from '@hono/node-server/serve-static';
|
import { serveStatic } from '@hono/node-server/serve-static';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
|
|
||||||
import index from '@/v2/index';
|
import index from '@/routes/index';
|
||||||
import robotstxt from '@/v2/robots.txt';
|
import robotstxt from '@/routes/robots.txt';
|
||||||
|
|
||||||
type Root = {
|
type Root = {
|
||||||
get: (routePath: string, filePath: string) => void;
|
get: (routePath: string, filePath: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const imports = directoryImport({
|
const imports = directoryImport({
|
||||||
targetDirectoryPath: path.join(__dirname, './v2'),
|
targetDirectoryPath: path.join(__dirname, './routes'),
|
||||||
importPattern: /router\.js$/,
|
importPattern: /router\.js$/,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ export default function (app: Hono) {
|
|||||||
get: (routePath, filePath) => {
|
get: (routePath, filePath) => {
|
||||||
const wrapedHandler: Handler = async (ctx, ...args) => {
|
const wrapedHandler: Handler = async (ctx, ...args) => {
|
||||||
if (!ctx.get('data')) {
|
if (!ctx.get('data')) {
|
||||||
const handler = require(path.join(__dirname, 'v2', name, filePath));
|
const handler = require(path.join(__dirname, 'routes', name, filePath));
|
||||||
await handler(ctx, ...args);
|
await handler(ctx, ...args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
* Author: @Rongronggg9
|
* Author: @Rongronggg9
|
||||||
*
|
*
|
||||||
* There are at least three folders which are relevant with WeChat MP (Official Account Platform / Media Platform):
|
* There are at least three folders which are relevant with WeChat MP (Official Account Platform / Media Platform):
|
||||||
* lib/v2/wechat
|
* lib/routes/wechat
|
||||||
* lib/v2/gov/npma
|
* lib/routes/gov/npma
|
||||||
* lib/v2/gzh360
|
* lib/routes/gzh360
|
||||||
* lib/v2/pku/nsd/gd
|
* lib/routes/pku/nsd/gd
|
||||||
* lib/v2/sdu/cs
|
* lib/routes/sdu/cs
|
||||||
* lib/v2/nua/utils
|
* lib/routes/nua/utils
|
||||||
* lib/v2/hrbeu
|
* lib/routes/hrbeu
|
||||||
* lib/v2/freewechat
|
* lib/routes/freewechat
|
||||||
*
|
*
|
||||||
* If your new route is not in the above folders, please add it to the list.
|
* If your new route is not in the above folders, please add it to the list.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -54,8 +54,6 @@
|
|||||||
"lib/**/*.js",
|
"lib/**/*.js",
|
||||||
"lib/**/*.ts",
|
"lib/**/*.ts",
|
||||||
"!lib/routes/**",
|
"!lib/routes/**",
|
||||||
"!lib/v2/**",
|
|
||||||
"!lib/v3/**",
|
|
||||||
"!lib/router.js"
|
"!lib/router.js"
|
||||||
],
|
],
|
||||||
"coverageReporters": [
|
"coverageReporters": [
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const target = path.join(__dirname, '../../assets/build/maintainer.json');
|
const target = path.join(__dirname, '../../assets/build/maintainer.json');
|
||||||
const dirname = path.join(__dirname + '../../../lib/v2');
|
const dirname = path.join(__dirname + '../../../lib/routes');
|
||||||
|
|
||||||
// Presence Check
|
// Presence Check
|
||||||
for (const dir of fs.readdirSync(dirname)) {
|
for (const dir of fs.readdirSync(dirname)) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const targetJs = path.join(__dirname, '../../assets/build/radar-rules.js');
|
const targetJs = path.join(__dirname, '../../assets/build/radar-rules.js');
|
||||||
const targetJson = path.join(__dirname, '../../assets/build/radar-rules.json');
|
const targetJson = path.join(__dirname, '../../assets/build/radar-rules.json');
|
||||||
const dirname = path.join(__dirname + '../../../lib/v2');
|
const dirname = path.join(__dirname + '../../../lib/routes');
|
||||||
const toSource = require('tosource');
|
const toSource = require('tosource');
|
||||||
|
|
||||||
// Namespaces that do not require radar.js
|
// Namespaces that do not require radar.js
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ const maintainerURL = 'https://raw.githubusercontent.com/DIYgod/RSSHub/gh-pages/
|
|||||||
const successTag = 'Bug Ping: Pinged';
|
const successTag = 'Bug Ping: Pinged';
|
||||||
const parseFailTag = 'Bug Ping: Parsing Failed';
|
const parseFailTag = 'Bug Ping: Parsing Failed';
|
||||||
const failTag = 'Bug Ping: Not Found';
|
const failTag = 'Bug Ping: Not Found';
|
||||||
const v1route = 'Route: v1';
|
const deprecatedRoute = 'Route: deprecated';
|
||||||
const v2route = 'Route: v2';
|
const route = 'Route';
|
||||||
|
|
||||||
// DnD (do-not-disturb) usernames, add yours here to avoid being notified
|
// DnD (do-not-disturb) usernames, add yours here to avoid being notified
|
||||||
const dndUsernames = new Set([]);
|
const dndUsernames = new Set([]);
|
||||||
@@ -147,11 +147,11 @@ module.exports = async ({ github, context, core }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (emptyCount > 0) {
|
if (emptyCount > 0) {
|
||||||
labels.push(v1route);
|
labels.push(deprecatedRoute);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (successCount > 0) {
|
if (successCount > 0) {
|
||||||
labels.push(v2route);
|
labels.push(route);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write labels (status, affected route count)
|
// Write labels (status, affected route count)
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ Remember to check `user-top-read` and `user-library-read` in the scope for `Pers
|
|||||||
[Bot application](https://telegram.org/blog/bot-revolution)
|
[Bot application](https://telegram.org/blog/bot-revolution)
|
||||||
|
|
||||||
- `TELEGRAM_TOKEN`: Telegram bot token for stickerpack feeds
|
- `TELEGRAM_TOKEN`: Telegram bot token for stickerpack feeds
|
||||||
- `TELEGRAM_SESSION`: for video and file streaming, can be acquired by running `node lib/v2/telegram/tglib/client.js`
|
- `TELEGRAM_SESSION`: for video and file streaming, can be acquired by running `node lib/routes/telegram/tglib/client.js`
|
||||||
|
|
||||||
### Twitter
|
### Twitter
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ To pass a custom object to `ctx.set('json', obj)` for debugging, follow these st
|
|||||||
2. Pass your object to `ctx.set('json', obj)`.
|
2. Pass your object to `ctx.set('json', obj)`.
|
||||||
3. Access the corresponding route + `.debug.json` to view your object. For example, if you want to debug the route `/furstar/characters/:lang?`, you can access the URL: `/furstar/characters/en.debug.json`
|
3. Access the corresponding route + `.debug.json` to view your object. For example, if you want to debug the route `/furstar/characters/:lang?`, you can access the URL: `/furstar/characters/en.debug.json`
|
||||||
|
|
||||||
Here's an example of how to use `ctx.set('json', obj)` taken from [furstar/index.js](https://github.com/DIYgod/RSSHub/blob/master/lib/v2/furstar/index.js)
|
Here's an example of how to use `ctx.set('json', obj)` taken from [furstar/index.js](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/furstar/index.js)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const info = utils.fetchAllCharacters(res.data, base);
|
const info = utils.fetchAllCharacters(res.data, base);
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ sidebar_position: 2
|
|||||||
- Use `kebab-case` for files and folders.
|
- Use `kebab-case` for files and folders.
|
||||||
- Use `CONSTANT_CASE` for constants.
|
- Use `CONSTANT_CASE` for constants.
|
||||||
|
|
||||||
## v2 Route Standard
|
## Route Standard
|
||||||
|
|
||||||
When creating a new route in RSSHub, you need to organize your files in a specific way. Your namespace folder should be stored in the `lib/v2` directory and should include three mandatory files:
|
When creating a new route in RSSHub, you need to organize your files in a specific way. Your namespace folder should be stored in the `lib/routes` directory and should include three mandatory files:
|
||||||
|
|
||||||
- `router.js` Registers the routes
|
- `router.js` Registers the routes
|
||||||
- `maintainer.js` Provides information about the route maintainer
|
- `maintainer.js` Provides information about the route maintainer
|
||||||
@@ -74,7 +74,7 @@ When creating a new route in RSSHub, you need to organize your files in a specif
|
|||||||
Your namespace folder structure should look like this:
|
Your namespace folder structure should look like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
├───lib/v2
|
├───lib/routes
|
||||||
│ ├───furstar
|
│ ├───furstar
|
||||||
│ ├─── templates
|
│ ├─── templates
|
||||||
│ ├─── description.art
|
│ ├─── description.art
|
||||||
@@ -87,7 +87,7 @@ Your namespace folder structure should look like this:
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
**All eligible routes under the `lib/v2` path will be automatically loaded without the need for updating the `lib/router.js`.**
|
**All eligible routes under the `lib/routes` path will be automatically loaded without the need for updating the `lib/router.js`.**
|
||||||
|
|
||||||
### Namespace
|
### Namespace
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ All templates should be placed in the namespace's `templates` folder with the `.
|
|||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
Here's an example taken from the [furstar](https://github.com/DIYgod/RSSHub/blob/master/lib/v2/furstar) namespace:
|
Here's an example taken from the [furstar](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/furstar) namespace:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<div>
|
<div>
|
||||||
@@ -160,6 +160,6 @@ const renderAuthor = (author) => art(path.join(__dirname, 'templates/author.art'
|
|||||||
|
|
||||||
:::danger
|
:::danger
|
||||||
|
|
||||||
The v1 Route Standard is deprecated. All new routes should be following the [v2 Route Standard](/joinus/advanced/script-standard#v2-route-standard).
|
The v1 Route Standard is deprecated. All new routes should be following the [Route Standard](/joinus/advanced/script-standard#route-standard).
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ If you want to see the results, we suggest you install the browser extension. Yo
|
|||||||
|
|
||||||
## Code the rule
|
## Code the rule
|
||||||
|
|
||||||
To create a new RSS feed, create a file called `radar.js` under the corresponding namespace in [/lib/v2/](https://github.com/DIYgod/RSSHub/tree/master/lib/v2). We will continue to use the example of creating an RSS feed for `GitHub Repo Issues`, which is described [here](/joinus/new-rss/before-start). The resulting code will look like this:
|
To create a new RSS feed, create a file called `radar.js` under the corresponding namespace in [/lib/routes/](https://github.com/DIYgod/RSSHub/tree/master/lib/routes). We will continue to use the example of creating an RSS feed for `GitHub Repo Issues`, which is described [here](/joinus/new-rss/before-start). The resulting code will look like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ Before submitting your Pull Request, make sure to carefully review the [Script S
|
|||||||
|
|
||||||
## Create a namespace
|
## Create a namespace
|
||||||
|
|
||||||
The first step in creating a new RSS route is to create a namespace. The namespace should be the **same** as the second level domain name of the main website for which you are creating the RSS feed. For example, if you are creating an RSS feed for [https://github.com/DIYgod/RSSHub/issues](https://github.com/DIYgod/RSSHub/issues), the second level domain name is `github`. Therefore, you should create a folder called `github` under `lib/v2` to serve as the namespace for your RSS route.
|
The first step in creating a new RSS route is to create a namespace. The namespace should be the **same** as the second level domain name of the main website for which you are creating the RSS feed. For example, if you are creating an RSS feed for [https://github.com/DIYgod/RSSHub/issues](https://github.com/DIYgod/RSSHub/issues), the second level domain name is `github`. Therefore, you should create a folder called `github` under `lib/routes` to serve as the namespace for your RSS route.
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ If your changes are not related to route, please fill in `routes` section with `
|
|||||||
## New RSS Route Checklist / 新 RSS 路由检查表
|
## New RSS Route Checklist / 新 RSS 路由检查表
|
||||||
|
|
||||||
- [ ] New Route / 新的路由
|
- [ ] New Route / 新的路由
|
||||||
- [ ] Follows [v2 Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [v2 路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard)
|
- [ ] Follows [Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard)
|
||||||
- [ ] Documentation / 文档说明
|
- [ ] Documentation / 文档说明
|
||||||
- [ ] Full text / 全文获取
|
- [ ] Full text / 全文获取
|
||||||
- [ ] Use cache / 使用缓存
|
- [ ] Use cache / 使用缓存
|
||||||
@@ -89,7 +89,7 @@ NOROUTE
|
|||||||
|
|
||||||
### New RSS Route Checklist
|
### New RSS Route Checklist
|
||||||
|
|
||||||
This checklist will help you ensure that your pull request includes all necessary components. Although you don't have to check off all items to get your PR merged, please make sure that your new route follows the [v2 Script Standard](/joinus/advanced/script-standard). This is a **mandatory** requirement for all new routes.
|
This checklist will help you ensure that your pull request includes all necessary components. Although you don't have to check off all items to get your PR merged, please make sure that your new route follows the [Script Standard](/joinus/advanced/script-standard). This is a **mandatory** requirement for all new routes.
|
||||||
|
|
||||||
```md
|
```md
|
||||||
- [ ] 新的路由 New Route
|
- [ ] 新的路由 New Route
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ If you don't know much about them but would like to learn them, here are some go
|
|||||||
- [W3Schools](https://www.w3schools.com/)
|
- [W3Schools](https://www.w3schools.com/)
|
||||||
- [Git course on Codecademy](https://www.codecademy.com/learn/learn-git)
|
- [Git course on Codecademy](https://www.codecademy.com/learn/learn-git)
|
||||||
|
|
||||||
If you'd like to see examples of how other developers use these technologies to create RSS feeds, you can take a look at some of the code in [our repository](https://github.com/DIYgod/RSSHub/tree/master/lib/v2).
|
If you'd like to see examples of how other developers use these technologies to create RSS feeds, you can take a look at some of the code in [our repository](https://github.com/DIYgod/RSSHub/tree/master/lib/routes).
|
||||||
|
|
||||||
## Submit new RSSHub rules
|
## Submit new RSSHub rules
|
||||||
|
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ RSSHub 支持使用访问密钥 / 码,允许清单和拒绝清单三种方式
|
|||||||
贴纸包路由:[Telegram 机器人](https://telegram.org/blog/bot-revolution)
|
贴纸包路由:[Telegram 机器人](https://telegram.org/blog/bot-revolution)
|
||||||
|
|
||||||
- `TELEGRAM_TOKEN`: Telegram 机器人 token
|
- `TELEGRAM_TOKEN`: Telegram 机器人 token
|
||||||
- `TELEGRAM_SESSION`: 可通过运行 `node lib/v2/telegram/tglib/client.js`
|
- `TELEGRAM_SESSION`: 可通过运行 `node lib/routes/telegram/tglib/client.js`
|
||||||
|
|
||||||
### Twitter
|
### Twitter
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ sidebar_position: 5
|
|||||||
2. 将对象传递给 `ctx.set('json', obj)`。
|
2. 将对象传递给 `ctx.set('json', obj)`。
|
||||||
3. 访问相应的路由 + `.debug.json` 来查看您的对象。例如,如果您想调试 `/furstar/characters/en`,您可以访问 URL:`/furstar/characters/en.debug.json`。
|
3. 访问相应的路由 + `.debug.json` 来查看您的对象。例如,如果您想调试 `/furstar/characters/en`,您可以访问 URL:`/furstar/characters/en.debug.json`。
|
||||||
|
|
||||||
以下是来自 [furstar/index.js](https://github.com/DIYgod/RSSHub/blob/master/lib/v2/furstar/index.js) 的使用 `ctx.set('json', obj)` 的示例:
|
以下是来自 [furstar/index.js](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/furstar/index.js) 的使用 `ctx.set('json', obj)` 的示例:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const info = utils.fetchAllCharacters(res.data, base);
|
const info = utils.fetchAllCharacters(res.data, base);
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ sidebar_position: 2
|
|||||||
- 使用 `kebab-case` 命名文件和文件夹。
|
- 使用 `kebab-case` 命名文件和文件夹。
|
||||||
- 使用 `CONSTANT_CASE` 命名常量。
|
- 使用 `CONSTANT_CASE` 命名常量。
|
||||||
|
|
||||||
## v2 路由规范
|
## 路由规范
|
||||||
|
|
||||||
当在 RSSHub 中编写新的路由时,需要按特定方式组织文件。命名空间文件夹应该存储在 `lib/v2` 目录下,并且应包括三个必需文件:
|
当在 RSSHub 中编写新的路由时,需要按特定方式组织文件。命名空间文件夹应该存储在 `lib/routes` 目录下,并且应包括三个必需文件:
|
||||||
|
|
||||||
- `router.js` 注册路由
|
- `router.js` 注册路由
|
||||||
- `maintainer.js` 提供路由维护者信息
|
- `maintainer.js` 提供路由维护者信息
|
||||||
@@ -73,7 +73,7 @@ sidebar_position: 2
|
|||||||
|
|
||||||
命名空间文件夹结构应该像这样:
|
命名空间文件夹结构应该像这样:
|
||||||
|
|
||||||
├───lib/v2
|
├───lib/routes
|
||||||
│ ├───furstar
|
│ ├───furstar
|
||||||
│ ├─── templates
|
│ ├─── templates
|
||||||
│ ├─── description.art
|
│ ├─── description.art
|
||||||
@@ -85,7 +85,7 @@ sidebar_position: 2
|
|||||||
│ └───someOtherNamespaces
|
│ └───someOtherNamespaces
|
||||||
...
|
...
|
||||||
|
|
||||||
**所有符合条件的,在 `lib/v2` 路径下的路由将会被自动载入,无需更新 `lib/router.js`**
|
**所有符合条件的,在 `lib/routes` 路径下的路由将会被自动载入,无需更新 `lib/router.js`**
|
||||||
|
|
||||||
### 命名空间
|
### 命名空间
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ RSSHub 会将所有路由命名空间的文件夹名附加到路由前面。路
|
|||||||
|
|
||||||
#### 示例
|
#### 示例
|
||||||
|
|
||||||
下面是在 [furstar](https://github.com/DIYgod/RSSHub/blob/master/lib/v2/furstar) 命名空间中示例:
|
下面是在 [furstar](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/furstar) 命名空间中示例:
|
||||||
|
|
||||||
<!-- markdownlint-disable MD046 -->
|
<!-- markdownlint-disable MD046 -->
|
||||||
|
|
||||||
@@ -162,6 +162,6 @@ const renderAuthor = (author) => art(path.join(__dirname, 'templates/author.art'
|
|||||||
|
|
||||||
:::danger
|
:::danger
|
||||||
|
|
||||||
v1 路由规范已被弃用。所有新路由都应遵循 [v2 路由规范](#v2-lu-you-gui-fan)。
|
v1 路由规范已被弃用。所有新路由都应遵循 [路由规范](#lu-you-gui-fan)。
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ sidebar_position: 3
|
|||||||
|
|
||||||
## 编写规则
|
## 编写规则
|
||||||
|
|
||||||
要制作新的 RSSHub Radar 规则,需要在 `/lib/v2/` 目录下,相应的域名空间创建 `radar.js` 文件。下面以制作 `GitHub 仓库 Issues` 的 RSS 源为例,详见此处。编写的代码应如下所示:
|
要制作新的 RSSHub Radar 规则,需要在 `/lib/routes/` 目录下,相应的域名空间创建 `radar.js` 文件。下面以制作 `GitHub 仓库 Issues` 的 RSS 源为例,详见此处。编写的代码应如下所示:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ npm run dev
|
|||||||
|
|
||||||
## 创建命名空间
|
## 创建命名空间
|
||||||
|
|
||||||
制作新的 RSS 路由的第一步是创建命名空间。命名空间应该与您制作 RSS 源的主要网站的二级域名**相同**。例如,如果您正在为 [https://github.com/DIYgod/RSSHub/issues](https://github.com/DIYgod/RSSHub/issues) 制作 RSS 源,第二级域名是 `github`。因此,您应该在 `lib/v2` 下创建名为 `github` 的文件夹,作为您的 RSS 路由的命名空间。
|
制作新的 RSS 路由的第一步是创建命名空间。命名空间应该与您制作 RSS 源的主要网站的二级域名**相同**。例如,如果您正在为 [https://github.com/DIYgod/RSSHub/issues](https://github.com/DIYgod/RSSHub/issues) 制作 RSS 源,第二级域名是 `github`。因此,您应该在 `lib/routes` 下创建名为 `github` 的文件夹,作为您的 RSS 路由的命名空间。
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ If your changes are not related to route, please fill in `routes` with `NOROUTE`
|
|||||||
## New RSS Route Checklist / 新 RSS 路由检查表
|
## New RSS Route Checklist / 新 RSS 路由检查表
|
||||||
|
|
||||||
- [ ] New Route / 新的路由
|
- [ ] New Route / 新的路由
|
||||||
- [ ] Follows [v2 Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [v2 路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard)
|
- [ ] Follows [Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard)
|
||||||
- [ ] Documentation / 文档说明
|
- [ ] Documentation / 文档说明
|
||||||
- [ ] Full text / 全文获取
|
- [ ] Full text / 全文获取
|
||||||
- [ ] Use cache / 使用缓存
|
- [ ] Use cache / 使用缓存
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ sidebar_position: 1
|
|||||||
- [W3Schools](https://www.w3schools.com)
|
- [W3Schools](https://www.w3schools.com)
|
||||||
- [Codecademy 上的 Git 课程](https://www.codecademy.com/learn/learn-git)
|
- [Codecademy 上的 Git 课程](https://www.codecademy.com/learn/learn-git)
|
||||||
|
|
||||||
如果您想查看其他开发人员如何使用这些技术来制作 RSS 订阅的示例,您可以查看 [我们的代码库](https://github.com/DIYgod/RSSHub/tree/master/lib/v2) 中的一些代码。
|
如果您想查看其他开发人员如何使用这些技术来制作 RSS 订阅的示例,您可以查看 [我们的代码库](https://github.com/DIYgod/RSSHub/tree/master/lib/routes) 中的一些代码。
|
||||||
|
|
||||||
## 提交新的 RSSHub 规则
|
## 提交新的 RSSHub 规则
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user