Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/dependabot-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
on: pull_request

jobs:
dependabot-fork:
runs-on: ubuntu-latest
name: Ignore dependabot on forks
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Comment Dependabot PR
if: github.repository_owner != 'DIYgod' && github.actor == 'dependabot[bot]'
uses: thollander/actions-comment-pull-request@v1
with:
message: '@dependabot ignore this dependency'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 28 additions & 16 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,44 @@ on:
- '.github/workflows/**'
- 'Dockerfile'
- 'package.json'
- 'yarn.lock'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build dockerfile (with push)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
docker buildx build \
--platform=linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=true" \
--file ./Dockerfile . \
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/rsshub:latest \
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/rsshub:$(date +%Y)-$(date +%m)-$(date +%d)
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ secrets.DOCKER_USERNAME }}/rsshub
tags: |
type=raw,value=latest,enable=true
type=raw,value={{date 'YYYY-MM-DD'}},enable=true
flavor: latest=false

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm/v7,linux/arm64
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
26 changes: 22 additions & 4 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- 'lib/**'
- 'Dockerfile'
- 'package.json'
- 'yarn.lock'

# Please, always create a pull request instead of push to master.
jobs:
Expand All @@ -16,14 +17,31 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build dockerfile and Run (without push)

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: rsshub
flavor: latest=true

- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}

- name: Run dockerfile
run: |
docker build \
--tag rsshub:latest \
--file ./Dockerfile .
chmod +x scripts/docker/test-docker.sh
scripts/docker/test-docker.sh
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ ARG USE_CHINA_NPM_REGISTRY=0;
ARG PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1;

RUN ln -sf /bin/bash /bin/sh

RUN apt-get update && apt-get install -yq libgconf-2-4 apt-transport-https git dumb-init python3 build-essential --no-install-recommends

WORKDIR /app

COPY ./yarn.lock /app
COPY ./package.json /app


RUN if [ "$USE_CHINA_NPM_REGISTRY" = 1 ]; then \
echo 'use npm mirror'; npm config set registry https://registry.npm.taobao.org; \
fi;
Expand All @@ -27,12 +25,11 @@ RUN if [ "$PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" = 0 ]; then \
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ;\
fi;

RUN yarn --network-timeout 1000000

RUN yarn --frozen-lockfile --network-timeout 1000000
COPY . /app

RUN node scripts/docker/minify-docker.js


FROM node:14-slim as app

ENV NODE_ENV production
Expand Down
2 changes: 1 addition & 1 deletion docs/bbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pageClass: routes

### 分类

<Route author="Fatpandac" exmaple="/423down/index/all" path="/423down/:category/:type" :paramsDesc="['类型', '分类']" radar="1">
<Route author="Fatpandac" example="/423down/index/all" path="/423down/:category/:type" :paramsDesc="['类型', '分类']" radar="1">

| category | 全部 |
| :------: | :--: |
Expand Down
2 changes: 1 addition & 1 deletion docs/en/game.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Sorting types, default to `date`:

### CurseForge Mod Update

<RouteEn author="Indexyz" example="/curseforge/files/jei" path="/curseforge/files/:project" :paramsDesc="['Progect shortname or `Project ID`. The short name of the project can be found in the address bar, for exmaple `https://minecraft.curseforge.com/projects/non-update` to `non-update`. `Project ID` can be found in `About This Project` in `Overview`']"/>
<RouteEn author="Indexyz" example="/curseforge/files/jei" path="/curseforge/files/:project" :paramsDesc="['Progect shortname or `Project ID`. The short name of the project can be found in the address bar, for example `https://minecraft.curseforge.com/projects/non-update` to `non-update`. `Project ID` can be found in `About This Project` in `Overview`']"/>

### Feed The Beast Modpack Updates

Expand Down
4 changes: 2 additions & 2 deletions docs/en/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ git clone https://github.com/DIYgod/RSSHub.git ~/RSSHub
cd ~/RSSHub/scripts/ansible
sudo ansible-playbook rsshub.yaml
# When prompt to enter a domain name, enter the domain name that this machine/VM will use
# For example, if your users use https://rsshub.exmaple.com to access your RSSHub instance, enter rsshub.exmaple.com (remove the https://)
# For example, if your users use https://rsshub.example.com to access your RSSHub instance, enter rsshub.example.com (remove the https://)
```

### Update
Expand All @@ -149,7 +149,7 @@ sudo ansible-playbook rsshub.yaml
cd ~/RSSHub/scripts/ansible
sudo ansible-playbook rsshub.yaml
# When prompt to enter a domain name, enter the domain name that this machine/VM will use
# For example, if your users use https://rsshub.exmaple.com to access your RSSHub instance, enter rsshub.exmaple.com (remove the https://)
# For example, if your users use https://rsshub.example.com to access your RSSHub instance, enter rsshub.example.com (remove the https://)
```

## Manual Deployment
Expand Down
2 changes: 1 addition & 1 deletion docs/government.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pageClass: routes

### 最新消息

<Route author="Fatpandac" exmaple="/ssm/news" path="/ssm/news"/>
<Route author="Fatpandac" example="/ssm/news" path="/ssm/news"/>

## 北京市科学技术委员会、中关村科技园区管理委员会

Expand Down
4 changes: 2 additions & 2 deletions docs/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ git clone https://github.com/DIYgod/RSSHub.git ~/RSSHub
cd ~/RSSHub/scripts/ansible
sudo ansible-playbook rsshub.yaml
# 当提示输入 domain name 的时候,输入该主机所使用的域名
# 举例:如果您的 RSSHub 用户使用 https://rsshub.exmaple.com 访问您的 RSSHub 实例,输入 rsshub.exmaple.com(去掉 https://)
# 举例:如果您的 RSSHub 用户使用 https://rsshub.example.com 访问您的 RSSHub 实例,输入 rsshub.example.com(去掉 https://)
```

### 更新
Expand All @@ -149,7 +149,7 @@ sudo ansible-playbook rsshub.yaml
cd ~/RSSHub/scripts/ansible
sudo ansible-playbook rsshub.yaml
# 当提示输入 domain name 的时候,输入该主机所使用的域名
# 举例:如果您的 RSSHub 用户使用 https://rsshub.exmaple.com 访问您的 RSSHub 实例,输入 rsshub.exmaple.com(去掉 https://)
# 举例:如果您的 RSSHub 用户使用 https://rsshub.example.com 访问您的 RSSHub 实例,输入 rsshub.example.com(去掉 https://)
```

## 手动部署
Expand Down
2 changes: 1 addition & 1 deletion docs/social-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性

### 用户关注专栏

<Route author="woshiluo" example="/bilibili/followings/article/99800931" path="/bilibili/followings/article/:uid" :paramsdesc="['用户 id']" selfhost="1">
<Route author="woshiluo" example="/bilibili/followings/article/99800931" path="/bilibili/followings/article/:uid" :paramsDesc="['用户 id']" selfhost="1">
::: warning 注意

用户动态需要 b 站登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
Expand Down
10 changes: 10 additions & 0 deletions docs/travel.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,13 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运
| announcement | news | media | exhibition | specials |

</Route>

## 走进日本

<Route author="laampui" example="/nippon/Politics" path="/nippon/:category?" :paramsDesc="['默认政治,可选如下']">

| 政治 | 经济 | 社会 | 展览预告 | 焦点专题 | 深度报道 | 话题 | 日本信息库 | 日本一蹩 | 人物访谈 | 编辑部通告 |
| -------- | ------- | ------- | -------- | ------------------ | -------- | ------------ | ---------- | ------------- | -------- | ------------- |
| Politics | Economy | Society | Culture | Science,Technology | In-depth | japan-topics | japan-data | japan-glances | People | Announcements |

</Route>
31 changes: 31 additions & 0 deletions lib/v2/nippon/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const category = ctx.params.category ?? 'Politics';
const path = category === 'Science,Technology' ? 'condition4' : 'category_code';
const res = await got.get(`https://www.nippon.com/api/search/cn/${path}/20/1/${category}?t=${Date.now()}`);

const list = res.data.body.dataList.map((item) => ({
title: item.title,
link: `https://www.nippon.com/${item.pub_url}`,
pubDate: item.pub_date,
}));

const item = await Promise.all(
list.slice(0, 10).map((item) =>
ctx.cache.tryGet(item.link, async () => {
const res = await got.get(item.link);
const $ = cheerio.load(res.data);
item.description = $('.editArea').html();
return item;
})
)
);

ctx.state.data = {
title: `走进日本 - ${category}`,
link: 'https://www.nippon.com/cn/economy/',
item,
};
};
3 changes: 3 additions & 0 deletions lib/v2/nippon/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/:category?': ['laampui'],
};
13 changes: 13 additions & 0 deletions lib/v2/nippon/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'nippon.com': {
_name: '走进日本',
www: [
{
title: '政治外交',
docs: 'https://docs.rsshub.app/travel.html#zou-jin-ri-ben',
source: ['/nippon/:category?', '/cn'],
target: '/nippon/:category?',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/nippon/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/:category?', require('./index'));
};