Skip to content

Commit

Permalink
feat(route): Add 福利吧最近更新内容 (#13711)
Browse files Browse the repository at this point in the history
* fuliba added

* style: auto format

* doc refine for fuliba

* update per lint info

* fix some title and style

* update per SSRF concern comment

* update per SSRF concern during review

* Update lib/v2/fuliba/radar.js

Per comment on naming of title

* Update website/docs/routes/new-media.mdx

* turn to wordpress api

* Update website/docs/routes/new-media.mdx

---------

Co-authored-by: shinemoon <shinemoon@foxmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 7, 2023
1 parent 676e704 commit 04b47ef
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/v2/fuliba/latest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const { data: response } = await got(`https://fuliba2023.net/wp-json/wp/v2/posts`, {
searchParams: {
per_page: ctx.query.limit ?? 100,
_embed: 1,
},
});
const items = response.map((item) => ({
title: item.title.rendered,
link: item.link,
guid: item.guid.rendered,
description: item.content.rendered,
pubDate: parseDate(item.date_gmt),
author: item._embedded.author[0].name,
}));

ctx.state.data = {
title: '福利吧',
link: `https://fuliba2023.net`,
item: items,
};
};
3 changes: 3 additions & 0 deletions lib/v2/fuliba/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/latest': ['shinemoon'],
};
15 changes: 15 additions & 0 deletions lib/v2/fuliba/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const fuliba = {
_name: '福利吧',
'.': [
{
title: '最新',
docs: 'https://docs.rsshub.app/routes/new-media#fuliba',
source: '/',
target: '/fuliba/latest',
},
],
};

module.exports = {
'fuliba2023.net': fuliba,
};
3 changes: 3 additions & 0 deletions lib/v2/fuliba/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/latest', require('./latest'));
};
6 changes: 6 additions & 0 deletions website/docs/routes/new-media.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3293,6 +3293,12 @@ Type 栏目:

</Route>

## 福利吧 {#fu-li-ba}

### 最新 {#fu-li-ba-zui-xin}

<Route author="shinemoon" example="/fuliba/latest" path="/fuliba/latest"/>

## 福利年 {#fu-li-nian}

### 文章 {#fu-li-nian-wen-zhang}
Expand Down

0 comments on commit 04b47ef

Please sign in to comment.