feat: v3 migration - 3/n

This commit is contained in:
DIYgod
2024-02-28 16:33:13 +08:00
parent 185b5d1441
commit fdf3fcac57
611 changed files with 3540 additions and 3528 deletions
+5 -5
View File
@@ -1,12 +1,12 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
import got from '@/utils/got';
import { parseDate } from '@/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;
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : defaultLimit;
let appList = data.applist;
appList = appList.map((app) => {
@@ -19,7 +19,7 @@ module.exports = async (ctx) => {
appList.sort((a, b) => b._pubDate - a._pubDate);
const returnedAppList = appList.slice(0, limit);
ctx.state.data = {
ctx.set('data', {
title: 'Unraid Community Apps',
link: 'https://unraid.net/community/apps',
image: 'https://craftassets.unraid.net/static/favicon/favicon.ico?v=1.0',
@@ -31,5 +31,5 @@ module.exports = async (ctx) => {
category: app.CategoryList,
upvotes: app.stars,
})),
};
});
};