Merge branch 'i18n'
This commit is contained in:
commit
3dce9d6c98
|
|
@ -1,37 +1,85 @@
|
|||
module.exports = {
|
||||
title: 'RSSHub',
|
||||
description: '🍰 万物皆可 RSS',
|
||||
ga: 'UA-48084758-10',
|
||||
serviceWorker: true,
|
||||
locales: {
|
||||
'/': {
|
||||
lang: 'zh-CN',
|
||||
title: 'RSSHub',
|
||||
description: '🍰 万物皆可 RSS',
|
||||
},
|
||||
'/en/': {
|
||||
lang: 'en-US',
|
||||
title: 'RSSHub',
|
||||
description: '🍰 万物皆可 RSS',
|
||||
},
|
||||
},
|
||||
themeConfig: {
|
||||
repo: 'DIYgod/RSSHub',
|
||||
editLinks: true,
|
||||
editLinkText: '在 GitHub 上编辑此页',
|
||||
lastUpdated: '上次更新',
|
||||
serviceWorker: {
|
||||
updatePopup: {
|
||||
message: '发现新内容可用',
|
||||
buttonText: '刷新',
|
||||
docsDir: 'docs',
|
||||
locales: {
|
||||
'/': {
|
||||
lang: 'zh-CN',
|
||||
selectText: '选择语言',
|
||||
label: '简体中文',
|
||||
editLinkText: '在 GitHub 上编辑此页',
|
||||
lastUpdated: '上次更新',
|
||||
serviceWorker: {
|
||||
updatePopup: {
|
||||
message: '发现新内容可用',
|
||||
buttonText: '刷新',
|
||||
},
|
||||
},
|
||||
nav: [
|
||||
{
|
||||
text: '使用',
|
||||
link: '/',
|
||||
},
|
||||
{
|
||||
text: '参与我们',
|
||||
link: '/joinus/',
|
||||
},
|
||||
{
|
||||
text: '部署',
|
||||
link: '/install/',
|
||||
},
|
||||
{
|
||||
text: '支持 RSSHub',
|
||||
link: '/support/',
|
||||
},
|
||||
],
|
||||
},
|
||||
'/en/': {
|
||||
lang: 'en-US',
|
||||
selectText: 'Languages',
|
||||
label: 'English',
|
||||
editLinkText: 'Edit this page on GitHub',
|
||||
lastUpdated: 'Last Updated',
|
||||
serviceWorker: {
|
||||
updatePopup: {
|
||||
message: 'New content is available',
|
||||
buttonText: 'Refresh',
|
||||
},
|
||||
},
|
||||
nav: [
|
||||
{
|
||||
text: 'Use',
|
||||
link: '/en/',
|
||||
},
|
||||
{
|
||||
text: 'Join us',
|
||||
link: '/en/joinus/',
|
||||
},
|
||||
{
|
||||
text: 'Deploy',
|
||||
link: '/en/install/',
|
||||
},
|
||||
{
|
||||
text: 'Support RSSHub',
|
||||
link: '/en/support/',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
docsDir: 'docs',
|
||||
nav: [
|
||||
{
|
||||
text: '使用',
|
||||
link: '/',
|
||||
},
|
||||
{
|
||||
text: '参与我们',
|
||||
link: '/joinus/',
|
||||
},
|
||||
{
|
||||
text: '部署',
|
||||
link: '/install/',
|
||||
},
|
||||
{
|
||||
text: '支持 RSSHub',
|
||||
link: '/support/',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,404 @@
|
|||
---
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Deployment
|
||||
|
||||
RSSHub provides painless deployment, you may open an [issue](https://github.com/DIYgod/RSSHub/issues/new) if you believe you have encountered a problem not listed [here](https://github.com/DIYgod/RSSHub/issues), the community will try to sort it out asap.
|
||||
|
||||
## Manual Deployment
|
||||
|
||||
Manually deploy a new `RSSHub` instance to a location of your choice.
|
||||
|
||||
## System requirement
|
||||
|
||||
Please ensure you have installed both [Git](https://git-scm.com/) and [Node.js >= 8.0.0](https://nodejs.org/).
|
||||
|
||||
### Install Git
|
||||
|
||||
::: tip
|
||||
|
||||
Entering `git` to check whether Git is already installed:
|
||||
|
||||
Use `cmd` for windows, use `terminal` for UNIX-based OS including macOS.
|
||||
|
||||
```bash
|
||||
$ git
|
||||
usage: git [--version] [--help] [-C <path>] [-c name=value]
|
||||
...
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
- Windows:Download Git [from git's official website](https://git-scm.com/downloads).
|
||||
- macOS:Use [Homebrew](https://brew.sh/) `$ brew install git` or [download from git's official website](https://git-scm.com/download/mac).
|
||||
- UNIX: your package manager `$ sudo apt-get install git`.
|
||||
|
||||
### Install Node.JS
|
||||
|
||||
#### Windows
|
||||
|
||||
Windows please download [from node's official website](https://nodejs.org/zh-cn/). During the installation, please check `Add to PATH` option.
|
||||
|
||||
#### UNIX-based
|
||||
|
||||
The easiest way to install NodeJS is using [nvm](https://github.com/creationix/nvm).
|
||||
|
||||
Install `nvm`
|
||||
|
||||
```bash
|
||||
$ curl https://raw.github.com/creationix/nvm/master/install.sh | sh
|
||||
```
|
||||
|
||||
Upon completion please restart your terminal to install `Node.js`.
|
||||
|
||||
```bash
|
||||
$ nvm install node
|
||||
```
|
||||
|
||||
### Download RSSHub
|
||||
|
||||
Execute the following commands to download the source code
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/DIYgod/RSSHub.git
|
||||
$ cd RSSHub
|
||||
```
|
||||
|
||||
Execute the following commands to the dependencies
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
::: tip
|
||||
|
||||
[Yarn](https://yarn.bootcss.com/) is recommended over `npm` for its performance and stability
|
||||
|
||||
Use `Yarn` simplifies the dependency installation process
|
||||
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Launch
|
||||
|
||||
Under `RSSHub`'s root directory, execute the following commands to launch
|
||||
|
||||
```bash
|
||||
$ npm start
|
||||
```
|
||||
|
||||
Visit [http://127.0.0.1:1200/](http://127.0.0.1:1200/), and enjoy it! ✅
|
||||
|
||||
### Update
|
||||
|
||||
Under `RSSHub`'s directory, execute the following commands to pull the latest source code for `RSSHub`
|
||||
|
||||
```bash
|
||||
$ git pull
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
`RSSHub` reads its configurations from `config.js` or system environment variables.
|
||||
|
||||
**How to set system environment variables**
|
||||
|
||||
Under Windows, enter `$ set PORT=1000` in cmd
|
||||
|
||||
Under UNIX-based OS, enter `$ PORT=1000` in terminal
|
||||
|
||||
Enter `$ npm start` to start a `RSSHub` install with port `1000`.
|
||||
|
||||
System environment variables set here will be purged after closing cmd/terminal, if you want persist the variables, you can create a simple [batch script](https://en.wikipedia.org/wiki/Batch_file) or [shell script](https://en.wikipedia.org/wiki/Shell_script).
|
||||
|
||||
To configure more options please refer to [Settings](#Settings).
|
||||
|
||||
### Use Redis for caching
|
||||
|
||||
By default, `RSSHub` caches everything for 5 minutes in RAM. Redis support is built-in.
|
||||
|
||||
::: tip
|
||||
|
||||
Unless you are expecting high traffic or deploying in cluster-mode, Redis is not necessary.
|
||||
|
||||
:::
|
||||
|
||||
#### Install Redis
|
||||
|
||||
**Windows**
|
||||
|
||||
Please download Redis for Windows from [Redis' github](https://github.com/MicrosoftArchive/redis/releases).
|
||||
|
||||
Under your installation directory, execute the following commands to start Redis.
|
||||
|
||||
```bash
|
||||
$ redis-server redis.windows.conf
|
||||
```
|
||||
|
||||
**MacOS**
|
||||
|
||||
Use [Homebrew](https://brew.sh/) to install Redis.
|
||||
|
||||
```bash
|
||||
$ brew install redis
|
||||
```
|
||||
|
||||
Execute the following commands to start Redis.
|
||||
|
||||
```bash
|
||||
$ brew services start redis
|
||||
```
|
||||
|
||||
**UNIX-based**
|
||||
|
||||
Use your package manager to install Redis.
|
||||
|
||||
```bash
|
||||
# apt
|
||||
$ sudo apt install redis-server
|
||||
|
||||
# yum
|
||||
$ sudo yum install redis
|
||||
```
|
||||
|
||||
Execute `$ redis-server` to start Redis.
|
||||
|
||||
#### Enable RSSHub to Redis as the caching backend
|
||||
|
||||
Change `CACHE_TYPE` to `redis`, RSSHub will try to connect to `redis://localhost:6379/`. For changing the target address, please refer to [Settings](#Settings).
|
||||
|
||||
## Docker Deployment
|
||||
|
||||
Docker is the most popular containerization technology, it simplifies the deployment process down to one line of code.
|
||||
|
||||
### Install Docker
|
||||
|
||||
Please refer to [Docker's official guide](https://docs.docker.com/engine/installation/)
|
||||
|
||||
### Deployment
|
||||
|
||||
Execute the following command to pull RSSHub's docker image.
|
||||
|
||||
```bash
|
||||
$ docker pull diygod/rsshub
|
||||
```
|
||||
|
||||
Start a RSSHub container
|
||||
|
||||
```bash
|
||||
$ docker run -d --name rsshub -p 1200:1200 diygod/rsshub
|
||||
```
|
||||
|
||||
Visit [http://127.0.0.1:1200/](http://127.0.0.1:1200/), and enjoy it! ✅
|
||||
|
||||
Execute the following command to stop `RSSHub`.
|
||||
|
||||
```bash
|
||||
$ docker stop rsshub
|
||||
```
|
||||
|
||||
### Update
|
||||
|
||||
Execute the following command to pull the latest `RSSHub` docker image.
|
||||
|
||||
```bash
|
||||
# stop the current rsshub container
|
||||
$ docker stop rsshub
|
||||
|
||||
# delete the existing rsshub container
|
||||
$ docker rm rsshub
|
||||
|
||||
# pull the latest rsshub image
|
||||
$ docker pull diygod/rsshub
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
The simplest way to configure RSSHub container is via system environment variables.
|
||||
|
||||
For example, adding `-e CACHE_EXPIRE=3600` will set the cache time to 1 hour.
|
||||
|
||||
```bash
|
||||
$ docker run -d --name rsshub -p 1200:1200 -e CACHE_EXPIRE=3600 -e GITHUB_ACCESS_TOKEN=example diygod/rsshub
|
||||
```
|
||||
|
||||
To configure more options please refer to [Settings](#Settings).
|
||||
|
||||
### Docker-compose Deployment
|
||||
|
||||
[docker-compose](https://docs.docker.com/compose/overview/) simplifies multi-container deployment process:
|
||||
|
||||
1. Create a docker volume to persist Redis caches
|
||||
|
||||
```bash
|
||||
$ 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
|
||||
|
||||
3. Deploy
|
||||
|
||||
```bash
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
4. Update
|
||||
|
||||
```bash
|
||||
$ docker-compose build
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
## Heroku Deployment
|
||||
|
||||
[](https://heroku.com/deploy?template=https%3A%2F%2Fgithub.com%2FDIYgod%2FRSSHub)
|
||||
|
||||
## Google App Engine(GAE) Deployment
|
||||
|
||||
### Before You Begin
|
||||
|
||||
Follow the [official guide](https://cloud.google.com/appengine/docs/flexible/nodejs/quickstart) for completing your GCP account settings, creating a new Node project, adding billing information (required), installing git and initializing gcloud([link](https://cloud.google.com/sdk/gcloud/)). Node.js is not required if you don't plan to debug RSSHub locally.
|
||||
|
||||
Please note, GAE free tier doesn't support Flexible Environment , please check the pricing plan prior to deployment.
|
||||
|
||||
Node.js standard environment is still under beta, unknown or unexpected errors might be encountered during the deployment.
|
||||
|
||||
### Pull
|
||||
|
||||
Execute `git clone https://github.com/DIYgod/RSSHub.git` to pull the latest code
|
||||
|
||||
### app.yaml Settings
|
||||
|
||||
#### Deploy to Flexible Environment
|
||||
|
||||
Under RSSHub's root directory, create a file `app.yaml` with the following content:
|
||||
|
||||
```yaml
|
||||
# [START app_yaml]
|
||||
runtime: custom
|
||||
env: flex
|
||||
|
||||
# This sample incurs costs to run on the App Engine flexible environment.
|
||||
# The settings below are to reduce costs during testing and are not appropriate
|
||||
# for production use. For more information, see:
|
||||
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
|
||||
manual_scaling:
|
||||
instances: 1
|
||||
# app engine resources, adjust to suit your needs, the required disk space is 10 GB
|
||||
resources:
|
||||
cpu: 1
|
||||
memory_gb: 0.5
|
||||
disk_size_gb: 10
|
||||
network:
|
||||
forwarded_ports:
|
||||
- 80:1200
|
||||
- 443:1200
|
||||
# environment variables section, refer to Settings
|
||||
env_variables:
|
||||
CACHE_EXPIRE: '300'
|
||||
# [END app_yaml]
|
||||
```
|
||||
|
||||
#### Deploy to standard environment
|
||||
|
||||
Under RSSHub's root directory, create a file `app.yaml` with the following content:
|
||||
|
||||
```yaml
|
||||
# [START app_yaml]
|
||||
runtime: nodejs8
|
||||
|
||||
network:
|
||||
forwarded_ports:
|
||||
- 80:1200
|
||||
- 443:1200
|
||||
# environment variables section, refer to Settings
|
||||
env_variables:
|
||||
CACHE_EXPIRE: '300'
|
||||
# [END app_yaml]
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
||||
Under RSSHub's root directory, execute the following commands to launch RSSHub
|
||||
|
||||
```bash
|
||||
gcloud app deploy
|
||||
```
|
||||
|
||||
For changing the deployment project id or version id, please refer to `Deploying a service` section [here](https://cloud.google.com/appengine/docs/flexible/nodejs/testing-and-deploying-your-app).
|
||||
|
||||
You can access your `Google App Engine URL` to check the deployment status
|
||||
|
||||
## Setting
|
||||
|
||||
### Application Settings
|
||||
|
||||
`RSSHub` reads its configurations from `config.js` or environment variables.
|
||||
|
||||
::: tip 提示
|
||||
|
||||
Use environment variables is recommended to avoid conflicts during upgrade.
|
||||
|
||||
:::
|
||||
|
||||
`PORT`: listening port, default to `1200`
|
||||
|
||||
`SOCKET`: listening Unix Socket, default to `null`
|
||||
|
||||
`CACHE_TYPE`: cache type, `memory` or `redis`, empty this value will disable caching, default to `memory`
|
||||
|
||||
`CACHE_EXPIRE`: cache expiry time in seconds, default to `300`
|
||||
|
||||
`LISTEN_INADDR_ANY`: open up for external access, default to `1`
|
||||
|
||||
`REDIS_URL`: Redis target address(invalid when `CACHE_TYPE` is set to memory), default to `redis://localhost:6379/`
|
||||
|
||||
`REDIS_PASSWORD`: Redis password(invalid when `CACHE_TYPE` is set to memory)
|
||||
|
||||
### 部分 RSS 模块配置
|
||||
|
||||
- `pixiv`: [registration](https://accounts.pixiv.net/signup)
|
||||
|
||||
- `PIXIV_USERNAME`: Pixiv username
|
||||
|
||||
- `PIXIV_PASSWORD`: Pixiv password
|
||||
|
||||
- `disqus`: [API Key application](https://disqus.com/api/applications/)
|
||||
|
||||
- `DISQUS_API_KEY`: Disqus API
|
||||
|
||||
- `twitter`: [application creation](https://apps.twitter.com)
|
||||
|
||||
- `TWITTER_CONSUMER_KEY`: Twitter Consumer Key
|
||||
|
||||
- `TWITTER_CONSUMER_SECRET`: Twitter Consumer Secret
|
||||
|
||||
- `TWITTER_ACCESS_TOKEN`: Twitter Access Token
|
||||
|
||||
- `TWITTER_ACCESS_TOKEN_SECRET`: Twitter Access Token Secret
|
||||
|
||||
- `youtube`: [API Key application](https://console.developers.google.com/)
|
||||
|
||||
- `YOUTUBE_KEY`: YouTube API Key
|
||||
|
||||
- `telegram`: [Bot application](https://telegram.org/blog/bot-revolution)
|
||||
|
||||
- `TELEGRAM_TOKEN`: Telegram bot token
|
||||
|
||||
- `github`: [Access Token application](https://github.com/settings/tokens)
|
||||
|
||||
- `GITHUB_ACCESS_TOKEN`: GitHub Access Token
|
||||
|
||||
### Access Control
|
||||
|
||||
Access control includes a whitelist and a blacklist, which is configured via `middleware/access-control.js` or environment variables.
|
||||
|
||||
Support `IP` and `Route`, use `,` as the delimiter to separate multiple values. When both are defined, values in `BLACKLIST` will be disregarded.
|
||||
|
||||
- `BLACKLIST`: the blacklist
|
||||
|
||||
- `WHITELIST`: the blacklist. When set, values in `BLACKLIST` are disregarded.
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Join Us
|
||||
|
||||
We welcome all pull requests. Suggestions or feedbacks are also welcomed [here](https://github.com/DIYgod/RSSHub/issues).
|
||||
|
||||
## Submit new RSS source
|
||||
|
||||
1. Add a new route in [/router.js](https://github.com/DIYgod/RSSHub/blob/master/router.js)
|
||||
|
||||
1. Add the script to the corresponding directory [/routes/](https://github.com/DIYgod/RSSHub/tree/master/routes)
|
||||
|
||||
1. Update [README (/en/README.md) ](https://github.com/DIYgod/RSSHub/blob/master/en/README.md) and [Documentation (/docs/en/README.md) ](https://github.com/DIYgod/RSSHub/blob/master/docs/en/README.md), preview the docs via `npm run docs:dev`
|
||||
|
||||
1. Execute `npm run format` to lint the code before you commit and open a pull request
|
||||
|
||||
## Write the script
|
||||
|
||||
### Access the target data source API
|
||||
|
||||
Use [axios](https://github.com/axios/axios) to access the target data source API, assign the acquired title, link, description and datetime to ctx.state.data(refer to Data for the list of parameters), typically it looks like this: [/routes/bilibili/bangumi.js](https://github.com/DIYgod/RSSHub/blob/master/routes/bilibili/bangumi.js)
|
||||
|
||||
### Acquire data from HTML
|
||||
|
||||
If an API is not provided, data need to be scraped from HTML. Use [axios](https://github.com/axios/axios) to acquire the HTML and then use [cheerio](https://github.com/cheeriojs/cheerio) for scraping the relevant data and assign them to ctx.state.data, typically it looks like this: [/routes/jianshu/home.js](https://github.com/DIYgod/RSSHub/blob/master/routes/jianshu/home.js)
|
||||
|
||||
### 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.
|
||||
|
||||
Add to cache:
|
||||
|
||||
```js
|
||||
ctx.cache.set((key: string), (value: string), (time: number)); // time: the cache expiry time in seconds
|
||||
```
|
||||
|
||||
Access the cache:
|
||||
|
||||
```js
|
||||
const value = await ctx.cache.get((key: string));
|
||||
```
|
||||
|
||||
In this example: [/routes/zhihu/daily.js](https://github.com/DIYgod/RSSHub/blob/master/routes/zhihu/daily.js), the full text of each article is required resulting in many requests being sent. The update frequency for this source is known (daily), we can safely set the cache to a day to avoid wasting resources.
|
||||
|
||||
### Data
|
||||
|
||||
Assign the acquired data to ctx.state.data, the middleware [template.js](https://github.com/DIYgod/RSSHub/blob/master/middleware/template.js) will then process the data and render the RSS output [/views/rss.art](https://github.com/DIYgod/RSSHub/blob/master/views/rss.art), the list of parameters:
|
||||
|
||||
```js
|
||||
ctx.state.data = {
|
||||
title: '', // The feed title
|
||||
link: '', // The feed link
|
||||
description: '', // The feed description
|
||||
item: [
|
||||
// An article of the feed
|
||||
{
|
||||
title: '', // The article title
|
||||
description: '', // The article content
|
||||
pubDate: '', // The article publishing datetime
|
||||
guid: '', // The article unique identifier, optional, default to the article link below
|
||||
link: '', // The article link
|
||||
},
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
## Join the discussion
|
||||
|
||||
1. [Telegram Group](https://t.me/rsshub)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Support RSSHub
|
||||
|
||||
RSSHub is open source and completely free under the MIT license. However, just like any other open source project, as the project grows, the hosting, development and maintenance requires funding support.
|
||||
|
||||
You can support RSSHub via donations.
|
||||
|
||||
## One-time Donation
|
||||
|
||||
We accept donations via the following ways:
|
||||
|
||||
- [WeChat Pay](https://i.imgur.com/aq6PtWa.png)
|
||||
- [Alipay](https://i.imgur.com/wv1Pj2k.png)
|
||||
- [Paypal](https://www.paypal.me/DIYgod)
|
||||
- Bitcoin: 13CwQLHzPYm2tewNMSJBeArbbRM5NSmCD1
|
||||
|
||||
## Recurring Donation
|
||||
|
||||
Recurring donors will be rewarded via express issue response, or even have your name displayed on our GitHub page and website.
|
||||
|
||||
- Become a Backer or a Sponser on [Patreon](https://www.patreon.com/DIYgod)
|
||||
- Contact us directly: i#html.love
|
||||
Loading…
Reference in New Issue