mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-04 19:59:54 +08:00
* feat(route): 增加Issue Hunt订阅 * feat(route): 增加英文文档和Markdown解析 * Update lib/v2/issuehunt/maintainer.js * Update docs/en/programming.md * Update lib/v2/issuehunt/radar.js * Update docs/programming.md * Update lib/v2/issuehunt/radar.js * Update docs/programming.md ---------
29 lines
940 B
JavaScript
29 lines
940 B
JavaScript
const got = require('@/utils/got');
|
|
const MarkdownIt = require('markdown-it');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { username, repo } = ctx.params;
|
|
const response = await got(`https://issuehunt.io/apis/pages/repos/show?repositoryOwnerName=${username}&repositoryName=${repo}`);
|
|
|
|
const { issues } = response.data;
|
|
if (issues === undefined) {
|
|
throw new Error('没有获取到数据');
|
|
}
|
|
|
|
const md = MarkdownIt({
|
|
html: true,
|
|
});
|
|
ctx.state.data = {
|
|
title: `Issue Hunt 的悬赏 -- ${username}/${repo}`,
|
|
link: `https://issuehunt.io/r/${username}/${repo}`,
|
|
description: ``,
|
|
item: issues.map((item) => ({
|
|
title: item.title,
|
|
description: md.render(item.body),
|
|
pubDate: item.fundedAt,
|
|
link: `https://issuehunt.io/r/${username}/${repo}/issues/${item.number}`,
|
|
author: item.userName,
|
|
})),
|
|
};
|
|
};
|