Skip to content

Commit 9d980d7

Browse files
committed
feat: v3 migration - 16/n
1 parent 300d450 commit 9d980d7

File tree

18 files changed

+49
-41
lines changed

18 files changed

+49
-41
lines changed

lib/v2/aqara/region.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = (ctx) => {
2+
const types = {
3+
news: 'press-release',
4+
blog: 'article',
5+
};
6+
7+
const { region = 'en', type = 'news' } = ctx.req.param();
8+
const redirectTo = `/aqara/${region}/category/${types[type]}`;
9+
ctx.redirect(redirectTo);
10+
};

lib/v2/aqara/router.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
module.exports = function (router) {
22
router.get('/cn/news', './news');
33
router.get('/community/:id?/:keyword?', './community');
4-
router.get('/:region/:type?', (ctx) => {
5-
const types = {
6-
news: 'press-release',
7-
blog: 'article',
8-
};
9-
10-
const { region = 'en', type = 'news' } = ctx.req.param();
11-
const redirectTo = `/aqara/${region}/category/${types[type]}`;
12-
ctx.redirect(redirectTo);
13-
});
4+
router.get('/:region/:type?', './region');
145
router.get('*', './post');
156
};

lib/v2/buaa/sme.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = async (ctx) => {
1616
// 源链接
1717
link: url,
1818
// 源文章
19-
item: await getItems(ctx, list),
19+
item: await getItems(list),
2020
});
2121
};
2222

@@ -46,7 +46,7 @@ async function getList(url) {
4646
};
4747
}
4848

49-
function getItems(ctx, list) {
49+
function getItems(list) {
5050
return Promise.all(
5151
list.map((item) =>
5252
cache.tryGet(item.link, async () => {

lib/v2/dongqiudi/daily.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = (ctx) => {
2+
ctx.redirect('/dongqiudi/special/48');
3+
};

lib/v2/dongqiudi/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = (router) => {
2-
router.get('/daily', (c) => c.redirect('/dongqiudi/special/48'));
2+
router.get('/daily', './daily');
33
router.get('/player_news/:id', './player-news');
44
router.get('/result/:team', './result');
55
router.get('/special/:id', './special');

lib/v2/getitfree/router.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
module.exports = (router) => {
2-
router.get('/:filter*', (ctx) => {
3-
const { filter } = ctx.req.param();
4-
5-
if (filter && !filter.includes('/') && !filter.includes(',')) {
6-
ctx.redirect(`/getitfree/category/${filter}`);
7-
} else {
8-
return './'(ctx);
9-
}
10-
});
2+
router.get('/:filter*', './index');
113
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = (ctx) => {
2+
ctx.redirect('/hostmonit/cloudflareyes/v6');
3+
};

lib/v2/hostmonit/router.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
const redirectToV6 = (ctx) => ctx.redirect('/hostmonit/cloudflareyes/v6');
2-
31
module.exports = (router) => {
42
router.get('/cloudflareyes/:type?', './cloudflareyes');
5-
router.get('/cloudflareyesv6', (ctx) => redirectToV6(ctx));
6-
router.get('/CloudFlareYes/:type?', './cloudflareyes');
7-
router.get('/CloudFlareYesv6', (ctx) => redirectToV6(ctx));
3+
router.get('/cloudflareyesv6', './cloudflareyesv6');
84
};

lib/v2/jiemian/list.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = (ctx) => {
2+
const id = ctx.req.param('id');
3+
4+
const redirectTo = `/jiemian${id ? `/lists/${id}` : ''}`;
5+
ctx.redirect(redirectTo);
6+
};

lib/v2/jiemian/router.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
module.exports = function (router) {
2-
router.get('/list/:id', (ctx) => {
3-
const id = ctx.req.param('id');
4-
5-
const redirectTo = `/jiemian${id ? `/lists/${id}` : ''}`;
6-
ctx.redirect(redirectTo);
7-
});
2+
router.get('/list/:id', './list');
83
router.get('/:category*', './lists');
94
};

0 commit comments

Comments
 (0)