This commit is contained in:
Henry Wang 2018-08-14 07:26:44 +01:00 committed by DIYgod
parent e676b0892e
commit dad0ae3ac6
3 changed files with 11 additions and 10 deletions

View File

@ -1233,7 +1233,7 @@ since时间跨度可在 [Trending 页](https://github.com/trending/javascr
language语言可在 [Trending 页](https://github.com/trending/javascript?since=monthly) URL 中找到
### Issue <Author uid="HenryQWi"/>
### Issue <Author uid="HenryQW"/>
举例: [https://rsshub.app/github/issue/DIYgod/RSSHub](https://rsshub.app/github/issue/DIYgod/RSSHub)

View File

@ -52,6 +52,7 @@
"koa-favicon": "2.0.1",
"koa-router": "7.4.0",
"lru-cache": "4.1.3",
"markdown-it": "^8.4.2",
"path-to-regexp": "2.2.1",
"readall": "1.0.0",
"redis": "2.8.0",

View File

@ -1,11 +1,12 @@
const axios = require('../../utils/axios');
const config = require('../../config');
const md = require('markdown-it')();
module.exports = async (ctx) => {
const user = ctx.params.user;
const repo = ctx.params.repo;
const host = `https://github.com/repos/${user}/${repo}/issues`;
const host = `https://github.com/${user}/${repo}/issues`;
const url = `https://api.github.com/repos/${user}/${repo}/issues`;
const response = await axios({
@ -20,16 +21,15 @@ module.exports = async (ctx) => {
},
});
const data = response.data;
ctx.state.data = {
title: `${user}/${repo} Issues`,
link: host,
item:
data &&
data.map((item) => ({
title: item.title,
description: item.body || 'No description',
pubDate: new Date(item.created_at),
link: `${host}/${item.number}`,
})),
item: data.filter((item) => item.pull_request === undefined).map((item) => ({
title: item.title,
description: md.render(item.body) || 'No description',
pubDate: new Date(item.created_at),
link: `${host}/${item.number}`,
})),
};
};