feat(route): add fish shell release notes (#12139)

* feat(route): add fish shell release notes

* fix(route): fish shell release notes

* fix(route): fish shell release notes
---------
This commit is contained in:
x2cf
2023-03-20 23:48:43 +08:00
committed by GitHub
parent 3d6d8eb107
commit c22b0c12ec
6 changed files with 58 additions and 0 deletions
+6
View File
@@ -238,6 +238,12 @@ Language
<RouteEn author="DIYgod" example="/firefox/addons/rsshub-radar" path="/firefox/addons/:id" :paramsDesc="['Add-ons id, can be found in add-ons url']"/>
## fish shell
### Release Notes
<RouteEn author="x2cf" example="/fishshell" path="/fishshell" radar="1" />
## FossHub
### Software Update
+6
View File
@@ -270,6 +270,12 @@ pageClass: routes
<Route author="DIYgod" example="/firefox/addons/rsshub-radar" path="/firefox/addons/:id" :paramsDesc="['附加组件 id, 可在应用页 URL 中找到']" />
## fish shell
### Release Notes
<Route author="x2cf" example="/fishshell" path="/fishshell" radar="1" />
## FossHub
### Software Update
+27
View File
@@ -0,0 +1,27 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
const config = require('@/config').value;
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const link = 'https://fishshell.com/docs/current/relnotes.html';
const data = await ctx.cache.tryGet(link, async () => (await got(link)).data, config.cache.contentExpire, false);
const $ = cheerio.load(data);
ctx.state.data = {
link,
title: 'Release notes — fish-shell',
language: 'en',
item: $('#release-notes > section')
.map((_, item) => {
const title = $(item).find('h2').contents().first().text();
const date = title.match(/\(released (.+?)\)/)?.[1];
return {
title,
link: new URL($(item).find('a').attr('href'), link).href,
pubDate: date ? parseDate(date, 'MMMM D, YYYY') : undefined,
description: $(item).html(),
};
})
.get(),
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/': ['x2cf'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'fishshell.com': {
_name: 'fish shell',
'.': [
{
title: 'Release Notes',
docs: 'https://docs.rsshub.app/program-update.html#fish-shell',
source: ['/'],
target: '/fishshell',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/', require('./index'));
};