feat(route): keepass (#14301)
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/': ['TonyRL'],
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://keepass.info/news/news_all.html';
|
||||
const { data: response } = await got(baseUrl);
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
const list = $('p > a')
|
||||
.toArray()
|
||||
.map((elem) => {
|
||||
elem = $(elem);
|
||||
return {
|
||||
title: elem.find('b').text(),
|
||||
link: new URL(elem.attr('href'), baseUrl).href,
|
||||
pubDate: parseDate(elem.next().next('small').text().split('.')[0]),
|
||||
};
|
||||
})
|
||||
.slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 10);
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
if (!item.link.startsWith('https://keepass.info/')) {
|
||||
return item;
|
||||
}
|
||||
|
||||
const { data } = await got(item.link);
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
$('.sectionheader').remove();
|
||||
$('.laytablews > tbody> tr:nth-child(1) > td:nth-child(2) > p').first().remove();
|
||||
|
||||
item.description = $('.laytablews > tbody> tr:nth-child(1) > td:nth-child(2)').html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').attr('content'),
|
||||
link: baseUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'keepass.info': {
|
||||
_name: 'KeePass',
|
||||
'.': [
|
||||
{
|
||||
title: 'News',
|
||||
docs: 'https://docs.rsshub.app/routes/program-update.html#keepass',
|
||||
source: ['/news/news_all.html', '/'],
|
||||
target: '/keepass/news',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/', require('./news'));
|
||||
};
|
||||
@@ -329,6 +329,12 @@ Need to configure `CIVITAI_COOKIE` to obtain image information of NSFW models.
|
||||
|
||||
<Route author="Jeason0228" example="/ipsw/index/ipsws/iPhone11,8" path="/ipsw/index/:ptype/:pname/" paramsDesc={['Fill in ipsws or otas to get different versions of firmware','Product name, `http://rsshub.app/ipsw/index/ipsws/iPod`, if you fill in the iPad, follow the entire iPad series(ptype default to ipsws).`http://rsshub.app/ipsw/index/ipsws/iPhone11,8`, if you fill in the specific iPhone11,8, submit to the ipsws firmware information of this model']} />
|
||||
|
||||
## KeePass {#keepass}
|
||||
|
||||
### News {#keepass-news}
|
||||
|
||||
<Route author="TonyRL" example="/keepass" path="/keepass" radar="1" />
|
||||
|
||||
## Logseq {#logseq}
|
||||
|
||||
:::warning
|
||||
|
||||
Reference in New Issue
Block a user