From 6b24b91f00badaeb76b6c674cb7a8707c87ea15c Mon Sep 17 00:00:00 2001 From: cnkmmk <22782790+cnkmmk@users.noreply.github.com> Date: Tue, 20 Feb 2024 00:28:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E5=85=8D=E8=B2=BB?= =?UTF-8?q?=E8=B3=87=E6=BA=90=E7=B6=B2=E8=B7=AF=E7=A4=BE=E7=BE=A4=20(#1449?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 增加 免費資源網路社群 * style: auto format * 更新 rss.js 使用 wordpress 的 api 来获取数据 * 更新 rss.js * 更新 rss.js * 更新 rss.js --------- Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- lib/v2/free/maintainer.js | 3 +++ lib/v2/free/radar.js | 13 +++++++++++++ lib/v2/free/router.js | 3 +++ lib/v2/free/rss.js | 19 +++++++++++++++++++ website/docs/routes/blog.mdx | 6 ++++++ 5 files changed, 44 insertions(+) create mode 100644 lib/v2/free/maintainer.js create mode 100644 lib/v2/free/radar.js create mode 100644 lib/v2/free/router.js create mode 100644 lib/v2/free/rss.js diff --git a/lib/v2/free/maintainer.js b/lib/v2/free/maintainer.js new file mode 100644 index 000000000..387d961bf --- /dev/null +++ b/lib/v2/free/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['cnkmmk'], +}; diff --git a/lib/v2/free/radar.js b/lib/v2/free/radar.js new file mode 100644 index 000000000..ab4059623 --- /dev/null +++ b/lib/v2/free/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'free.com.tw': { + _name: '免費資源網路社群', + '.': [ + { + title: '博客', + docs: 'https://docs.rsshub.app/routes/blog#mian-fei-zi-yuan-wang-lu-she-qun', + source: ['/'], + target: '/free', + }, + ], + }, +}; diff --git a/lib/v2/free/router.js b/lib/v2/free/router.js new file mode 100644 index 000000000..574929e02 --- /dev/null +++ b/lib/v2/free/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/', require('./rss')); +}; diff --git a/lib/v2/free/rss.js b/lib/v2/free/rss.js new file mode 100644 index 000000000..3818d7a5d --- /dev/null +++ b/lib/v2/free/rss.js @@ -0,0 +1,19 @@ +const { parseDate } = require('@/utils/parse-date'); +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const url = 'https://free.com.tw/'; + const response = await got(`${url}/wp-json/wp/v2/posts`); + const list = response.data; + ctx.state.data = { + title: '免費資源網路社群', + link: url, + description: '免費資源網路社群 - 全部文章', + item: list.map((item) => ({ + title: item.title.rendered, + link: item.link, + pubDate: parseDate(item.date_gmt), + description: item.content.rendered, + })), + }; +}; diff --git a/website/docs/routes/blog.mdx b/website/docs/routes/blog.mdx index a0508e8f8..89f06df19 100644 --- a/website/docs/routes/blog.mdx +++ b/website/docs/routes/blog.mdx @@ -396,6 +396,12 @@ +## 免費資源網路社群 {#mian-fei-zi-yuan-wang-lu-she-qun} + +### 博客 {#mian-fei-zi-yuan-wang-lu-she-qun-bo-ke} + + + ## 十年之约 {#shi-nian-zhi-yue} ### 专题展示 - 文章 {#shi-nian-zhi-yue-zhuan-ti-zhan-shi-wen-zhang}