chore(routes/*): fix unreachable code (#15192)

This is a regression introduced in #14718.

Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
Rongrong
2024-04-12 00:19:38 +08:00
committed by GitHub
parent a8813a6311
commit ef8b061ea2
27 changed files with 103 additions and 154 deletions
+4 -4
View File
@@ -157,14 +157,14 @@ async function handler(ctx) {
};
});
ctx.set('json', {
houses,
});
return {
title: '591 租屋 - 自訂查詢',
link: queryUrl,
description: `591 租屋 - 自訂查詢, query: ${query}`,
item: items,
};
ctx.set('json', {
houses,
});
}
+4 -4
View File
@@ -117,6 +117,10 @@ async function handler(ctx) {
const icon = new URL('favicon.ico', rootUrl).href;
ctx.set('json', {
appData,
});
return {
item: items,
title: `${title} - Apple App Stroe`,
@@ -130,8 +134,4 @@ async function handler(ctx) {
author: artistName,
allowEmpty: true,
};
ctx.set('json', {
appData,
});
}
+6 -6
View File
@@ -52,6 +52,12 @@ async function handler(ctx) {
comments: post.replyCount,
}));
ctx.set('json', {
DID,
profile,
authorFeed,
});
return {
title: `${profile.displayName} (@${profile.handle}) — Bluesky`,
description: profile.description?.replaceAll('\n', ' '),
@@ -61,10 +67,4 @@ async function handler(ctx) {
logo: profile.avatar,
item: items,
};
ctx.set('json', {
DID,
profile,
authorFeed,
});
}
+3 -4
View File
@@ -63,7 +63,7 @@ async function handler(ctx) {
})
.get();
return {
const ret = {
title: '中国光大银行',
description: '中国光大银行 外汇牌价',
link,
@@ -71,9 +71,8 @@ async function handler(ctx) {
};
ctx.set('json', {
title: '中国光大银行',
description: '中国光大银行 外汇牌价',
...ret,
pubDate: timezone(parseDate($('#t_id span').text().substring(5), 'YYYY-MM-DD HH:mm', true), 0),
item: items,
});
return ret;
}
+4 -7
View File
@@ -65,16 +65,13 @@ async function handler(ctx) {
})
.get();
items.pop();
return {
const ret = {
title: '中国光大银行',
description: `中国光大银行 外汇牌价 ${TYPE[type].name}`,
link: `https://www.cebbank.com/site/ygzx/whpj/rmbwhpjlspj/index.html?currcode=${TYPE[type].id}`,
item: items,
};
ctx.set('json', {
title: '中国光大银行',
description: `中国光大银行 外汇牌价 ${TYPE[type].name}`,
item: items,
});
ctx.set('json', ret);
return ret;
}
+1 -1
View File
@@ -38,6 +38,7 @@ async function handler(ctx) {
const data = response.data;
ctx.set('json', response.data);
return {
title: `CnGal - ${data.name} 的动态`,
link: `https://www.cngal.org/entries/index/${entryId}`,
@@ -48,5 +49,4 @@ async function handler(ctx) {
link: item.link,
})),
};
ctx.set('json', response.data);
}
+3 -7
View File
@@ -72,7 +72,7 @@ async function handler(ctx) {
)
);
return {
const ret = {
title: '大河财立方',
link: parseUrl(type),
description: `大河财立方 ${TYPE[type].name}`,
@@ -80,10 +80,6 @@ async function handler(ctx) {
item: items,
};
ctx.set('json', {
title: '大河财立方',
link: parseUrl(type),
description: `大河财立方 ${TYPE[type].name}`,
items,
});
ctx.set('json', ret);
return ret;
}
+3 -9
View File
@@ -108,7 +108,7 @@ async function handler(ctx) {
)
);
return {
const ret = {
title: feed.title,
link: feed.link,
description: feed.description,
@@ -117,12 +117,6 @@ async function handler(ctx) {
language: feed.language,
};
ctx.set('json', {
title: feed.title,
link: feed.link,
description: feed.description,
item: items,
image: feed.image.url,
language: feed.language,
});
ctx.set('json', ret);
return ret;
}
+3 -6
View File
@@ -65,15 +65,12 @@ async function handler(ctx) {
)
);
return {
const ret = {
title: $('title').text(),
link: rootUrl,
item: items,
};
ctx.set('json', {
title: $('title').text(),
link: rootUrl,
item: items,
});
ctx.set('json', ret);
return ret;
}
+13 -15
View File
@@ -95,18 +95,17 @@ async function allIssues(ctx, user, repo, limit, headers) {
// used: Number.parseInt(response.headers['x-ratelimit-used']),
// };
ctx.set('json', {
title: `${user}/${repo}: Issue & Pull request comments`,
link: `${rootUrl}/${user}/${repo}`,
item: items,
// rateLimit,
});
return {
const ret = {
title: `${user}/${repo}: Issue & Pull request comments`,
link: `${rootUrl}/${user}/${repo}`,
item: items,
};
ctx.set('json', {
...ret,
// rateLimit,
});
return ret;
}
async function singleIssue(ctx, user, repo, number, limit, headers) {
@@ -187,10 +186,14 @@ async function singleIssue(ctx, user, repo, number, limit, headers) {
}
}
ctx.set('json', {
const ret = {
title: `${user}/${repo}: ${typeDict[type].title} #${number} - ${issue.title}`,
link: issue.html_url,
item: items,
};
ctx.set('json', {
...ret,
// rateLimit: {
// limit: Number.parseInt(response.headers['x-ratelimit-limit']),
// remaining: Number.parseInt(response.headers['x-ratelimit-remaining']),
@@ -199,10 +202,5 @@ async function singleIssue(ctx, user, repo, number, limit, headers) {
// used: Number.parseInt(response.headers['x-ratelimit-used']),
// },
});
return {
title: `${user}/${repo}: ${typeDict[type].title} #${number} - ${issue.title}`,
link: issue.html_url,
item: items,
};
return ret;
}
+6 -6
View File
@@ -64,12 +64,6 @@ async function handler(ctx) {
};
});
return {
title: 'Github Notifications',
link: 'https://github.com/notifications',
item: items,
};
ctx.set('json', {
title: 'Github Notifications',
item: notifications,
@@ -81,4 +75,10 @@ async function handler(ctx) {
used: Number.parseInt(response.headers['X-RateLimit-Used']),
},
});
return {
title: 'Github Notifications',
link: 'https://github.com/notifications',
item: items,
};
}
+3 -8
View File
@@ -71,7 +71,7 @@ async function handler(ctx) {
)
);
return {
const ret = {
title: $('title').text(),
link: rootUrl + '/blog',
description: $('meta[name="description"]').attr('content'),
@@ -79,11 +79,6 @@ async function handler(ctx) {
item: items,
};
ctx.set('json', {
title: $('title').text(),
link: rootUrl + '/blog',
description: $('meta[name="description"]').attr('content'),
language: 'en-US',
item: items,
});
ctx.set('json', ret);
return ret;
}
+3 -6
View File
@@ -167,7 +167,7 @@ async function handler(ctx) {
)
);
return {
const ret = {
title: `信報網站 - ${cat.title} - 信報網站 hkej.com`,
link: baseUrl + cat.link,
description: `信報網站(www.hkej.com)即時新聞${cat.name},提供${cat.description}`,
@@ -176,11 +176,8 @@ async function handler(ctx) {
};
ctx.set('json', {
title: `信報網站 - ${cat.title} - 信報網站 hkej.com`,
link: baseUrl + cat.link,
description: `信報網站(www.hkej.com)即時新聞${cat.name},提供${cat.description}`,
item: items,
language: 'zh-hk',
...ret,
cookieJar,
});
return ret;
}
+3 -8
View File
@@ -208,7 +208,7 @@ async function handler(ctx) {
)
);
return {
const ret = {
title: $('head meta[name=title]').attr('content').trim(),
link: baseUrl + '/' + category,
description: $('head meta[name=description]').attr('content').trim(),
@@ -216,11 +216,6 @@ async function handler(ctx) {
language: 'zh-hk',
};
ctx.set('json', {
title: $('head meta[name=title]').attr('content').trim(),
link: baseUrl + '/' + category,
description: $('head meta[name=description]').attr('content').trim(),
item: items,
language: 'zh-hk',
});
ctx.set('json', ret);
return ret;
}
+4 -4
View File
@@ -51,6 +51,10 @@ async function handler(ctx) {
author: appData.developer.name,
};
ctx.set('json', {
pageProps: nextData.props.initialProps.pageProps,
});
return {
title: appData.title,
description: appData.description,
@@ -60,8 +64,4 @@ async function handler(ctx) {
item: [item],
language: 'en',
};
ctx.set('json', {
pageProps: nextData.props.initialProps.pageProps,
});
}
+3 -3
View File
@@ -57,12 +57,12 @@ async function handler(ctx) {
)
);
ctx.set('json', {
items,
});
return {
title: 'Nature siteindex',
link: response.url,
item: items,
};
ctx.set('json', {
items,
});
}
+1 -1
View File
@@ -35,6 +35,7 @@ async function handler(ctx) {
});
const data = response.data.hits;
ctx.set('json', response.data);
return {
title: `Nintendo eShop(美服)新游戏`,
link: `https://www.nintendo.com/store/games/`,
@@ -45,5 +46,4 @@ async function handler(ctx) {
link: `https://www.nintendo.com${item.url}`,
})),
};
ctx.set('json', response.data);
}
+5 -5
View File
@@ -34,6 +34,11 @@ async function handler(ctx) {
const casts = castData.results.map((item) => renderCast(item));
ctx.set('json', {
userInfo,
castData,
});
return {
title: `${userInfo.name} (@${userInfo.username}) - 音声投稿 | OTOBANANA`,
description: userInfo.bio.replaceAll('\n', ' '),
@@ -46,9 +51,4 @@ async function handler(ctx) {
itunes_author: userInfo.name,
item: casts,
};
ctx.set('json', {
userInfo,
castData,
});
}
+5 -5
View File
@@ -34,6 +34,11 @@ async function handler(ctx) {
const casts = liveData.results.map((item) => renderLive(item));
ctx.set('json', {
userInfo,
liveData,
});
return {
title: `${userInfo.name} (@${userInfo.username}) - ライブ配信 | OTOBANANA`,
description: userInfo.bio.replaceAll('\n', ' '),
@@ -46,9 +51,4 @@ async function handler(ctx) {
itunes_author: userInfo.name,
item: casts,
};
ctx.set('json', {
userInfo,
liveData,
});
}
+5 -5
View File
@@ -34,6 +34,11 @@ async function handler(ctx) {
const posts = postData.results.map((item) => renderPost(item));
ctx.set('json', {
userInfo,
postData,
});
return {
title: `${userInfo.name} (@${userInfo.username}) - タイムライン | OTOBANANA`,
description: userInfo.bio.replaceAll('\n', ' '),
@@ -46,9 +51,4 @@ async function handler(ctx) {
itunes_author: userInfo.name,
item: posts,
};
ctx.set('json', {
userInfo,
postData,
});
}
+3 -6
View File
@@ -71,15 +71,12 @@ async function handler(ctx) {
};
});
return {
const ret = {
title: 'qBittorrent News',
link: `${baseUrl}/news.php`,
item,
};
ctx.set('json', {
title: 'qBittorrent News',
link: `${baseUrl}/news.php`,
item,
});
ctx.set('json', ret);
return ret;
}
+3 -7
View File
@@ -154,17 +154,13 @@ async function handler(ctx) {
const items = is_intl ? await fetchIntlItems(ctx.params) : await fetchMainlandItems(ctx.params);
return {
const ret = {
title: `TapTap 评价 ${app_name} - ${(is_intl ? intlSortMap : sortMap)[order][lang]}排序`,
link: `${getRootUrl(is_intl)}/app/${id}/review?${makeSortParam(is_intl, order)}`,
image: app_img,
item: items,
};
ctx.set('json', {
title: `TapTap 评价 ${app_name} - ${(is_intl ? intlSortMap : sortMap)[order][lang]}排序`,
link: `${getRootUrl(is_intl)}/app/${id}/review?${makeSortParam(is_intl, order)}`,
image: app_img,
item: items,
});
ctx.set('json', ret);
return ret;
}
+3 -5
View File
@@ -99,7 +99,7 @@ async function handler(ctx) {
})
);
return {
const ret = {
title: `${app_name} - ${typeMap[type][lang]} - TapTap 论坛`,
link: `${getRootUrl(false)}/app/${appId}/topic?type=${type}&sort=${sort}`,
image: app_img,
@@ -107,12 +107,10 @@ async function handler(ctx) {
};
ctx.set('json', {
title: `${app_name} - ${typeMap[type][lang]} - TapTap 论坛`,
link: `${getRootUrl(false)}/app/${appId}/topic?type=${type}&sort=${sort}`,
image: app_img,
item: out.filter((item) => item !== ''),
...ret,
appId,
groupId,
topics_list,
});
return ret;
}
+3 -2
View File
@@ -27,8 +27,9 @@ const extractTokens = async (user, ctx) => {
const userId = data.match(/{"user_id":"(\d+)"},/)?.[1];
ctx.set('json', { lsd, userId });
return { lsd, userId };
const ret = { lsd, userId };
ctx.set('json', ret);
return ret;
};
const makeHeader = (user, lsd) => ({
+3 -7
View File
@@ -115,17 +115,13 @@ async function handler(ctx) {
)
);
return {
const ret = {
title: '时刻新闻',
link: url,
description: `时刻新闻 ${PATH_LIST[type].name}`,
item: items,
};
ctx.set('json', {
title: '时刻新闻',
link: url,
description: `时刻新闻 ${PATH_LIST[type].name}`,
item: items,
});
ctx.set('json', ret);
return ret;
}
+3 -9
View File
@@ -30,20 +30,14 @@ const handler = async (ctx) => {
items = await Promise.all(items.map((item) => finishArticleItem(item)));
ctx.set('json', {
title: response.data.title,
link: response.data.feed_url,
image: 'https://mp.weixin.qq.com/favicon.ico',
description: response.data.title,
item: items,
});
return {
const ret = {
title: response.data.title,
link: response.data.feed_url,
description: response.data.title,
item: items,
allowEmpty: true,
};
ctx.set('json', ret);
return ret;
};
export default handler;
+3 -4
View File
@@ -80,17 +80,16 @@ async function handler(ctx) {
};
});
return {
const ret = {
title: 'Subscriptions - YouTube',
description: 'YouTube Subscriptions',
item: items,
};
ctx.set('json', {
title: 'Subscriptions - YouTube',
description: 'YouTube Subscriptions',
...ret,
channelIds,
playlistIds,
item: items,
});
return ret;
}