feat(route): add 安全内参 (#8096)
Co-authored-by: DIYgod <diy.d.god@gmail.com>
This commit is contained in:
parent
d24db95f06
commit
c626a9cc7c
|
|
@ -450,6 +450,16 @@ GitHub 官方也提供了一些 RSS:
|
|||
|
||||
</Route>
|
||||
|
||||
## 安全内参
|
||||
|
||||
### 分类
|
||||
|
||||
<Route author="XinRoom" example="/secrss/category/产业趋势" path="/secrss/category/:category"/>
|
||||
|
||||
### 作者
|
||||
|
||||
<Route author="XinRoom" example="/secrss/author/网络安全威胁和漏洞信息共享平台" path="/secrss/author/:author"/>
|
||||
|
||||
## 安全文摘
|
||||
|
||||
### 首页
|
||||
|
|
|
|||
|
|
@ -4259,4 +4259,8 @@ router.get('/fashionnetwork/news/:sectors?/:categories?/:language?', lazyloadRou
|
|||
// dykszx
|
||||
router.get('/dykszx/news/:type?', lazyloadRouteHandler('./routes/dykszx/news'));
|
||||
|
||||
// 安全内参
|
||||
router.get('/secrss/category/:category?', lazyloadRouteHandler('./routes/secrss/category'));
|
||||
router.get('/secrss/author/:author?', lazyloadRouteHandler('./routes/secrss/author'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const api = 'https://www.secrss.com/api/articles/group?author=';
|
||||
const author = ctx.params.author;
|
||||
const host = 'https://www.secrss.com';
|
||||
const res = await got.get(`${api}${author}`);
|
||||
const dataArray = res.data.data.list;
|
||||
|
||||
const items = dataArray.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.summary,
|
||||
pubDate: new Date(item.original_timestamp * 1000).toUTCString(),
|
||||
link: `${host}${item.url}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `安全内参-${author}`,
|
||||
link: 'https://www.secrss.com',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const api = 'https://www.secrss.com/api/articles?tag=';
|
||||
let type = ctx.params.category;
|
||||
if (type === undefined) {
|
||||
type = "";
|
||||
}
|
||||
const host = 'https://www.secrss.com';
|
||||
const res = await got.get(`${api}${type}`);
|
||||
const dataArray = res.data.data;
|
||||
|
||||
const items = dataArray.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.summary,
|
||||
pubDate: new Date(item.published_at + " GMT").toUTCString(),
|
||||
link: `${host}/articles/${item.id}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `安全内参-${type}`,
|
||||
link: 'https://www.secrss.com',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue