feat(route): add unraid community apps (#14564)
* add unraid community apps feed * unraid ca support limit query parameter
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const appFeedUrl = 'https://raw.githubusercontent.com/Squidly271/AppFeed/master/applicationFeed.json';
|
||||
const defaultLimit = 20;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { data } = await got(appFeedUrl);
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : defaultLimit;
|
||||
|
||||
let appList = data.applist;
|
||||
appList = appList.map((app) => {
|
||||
const _pubDate = app.LastUpdate ?? app.FirstSeen ?? 0;
|
||||
return {
|
||||
...app,
|
||||
_pubDate,
|
||||
};
|
||||
});
|
||||
appList.sort((a, b) => b._pubDate - a._pubDate);
|
||||
const returnedAppList = appList.slice(0, limit);
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Unraid Community Apps',
|
||||
link: 'https://unraid.net/community/apps',
|
||||
image: 'https://craftassets.unraid.net/static/favicon/favicon.ico?v=1.0',
|
||||
item: returnedAppList.map((app) => ({
|
||||
title: `${app.Name} (${app.Repository ?? 'Unknown repository'})`,
|
||||
link: app.Registry ?? `https://unraid.net/community/apps?q=${app.Name}`,
|
||||
description: app.Overview.replaceAll('\r\n', '<br>').replaceAll('\n', '<br>').replaceAll('[br]', '<br>'),
|
||||
pubDate: parseDate(app._pubDate * 1000),
|
||||
category: app.CategoryList,
|
||||
upvotes: app.stars,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/community-apps': ['KTachibanaM'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'unraid.net': {
|
||||
_name: 'Unraid',
|
||||
'.': [
|
||||
{
|
||||
title: 'Community Apps',
|
||||
docs: 'https://docs.rsshub.app/routes/program-update#unraid',
|
||||
source: ['/community/apps'],
|
||||
target: '/unraid/community-apps',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/community-apps', require('./community-apps'));
|
||||
};
|
||||
@@ -643,6 +643,12 @@ Logseq 开发团队已经放弃了 [旧网站](https://logseq.com/blog)。
|
||||
|
||||
<Route author="nczitzk" example="/typora/changelog/dev" path="/typora/changelog/dev" radar="1" />
|
||||
|
||||
## Unraid {#unraid}
|
||||
|
||||
### Community Apps {#unraid-community-apps}
|
||||
|
||||
<Route author="KTachibanaM" example="/unraid/community-apps" path="/unraid/community-apps" radar="1" />
|
||||
|
||||
## Western Digital {#western-digital}
|
||||
|
||||
### Download {#western-digital-download}
|
||||
|
||||
Reference in New Issue
Block a user