diff --git a/docs/program-update.md b/docs/program-update.md index 5cddf1086a..a2dafca86a 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -433,3 +433,9 @@ pageClass: routes | | -commentCount | -createdAt | createdAt | + +## simpread + +### 消息通知 + + diff --git a/lib/router.js b/lib/router.js index 5bb0f656c3..e9f57e3871 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3780,4 +3780,7 @@ router.get('/nace/blog/:sort?', require('./routes/nace/blog')); // Caixin Latest router.get('/caixin/latest', require('./routes/caixin/latest')); +// SimpRead +router.get('/simpread/notice', require('./routes/simpread/notice')); + module.exports = router; diff --git a/lib/routes/simpread/notice.js b/lib/routes/simpread/notice.js new file mode 100644 index 0000000000..a6ef1a11dd --- /dev/null +++ b/lib/routes/simpread/notice.js @@ -0,0 +1,20 @@ +const got = require('@/utils/got'); +const md = require('markdown-it')(); + +module.exports = async (ctx) => { + const url = 'https://static.simp.red/notice'; + const response = await got.get(url); + const data = response.data.notice; + ctx.state.data = { + title: 'SimpRead 消息通知', + link: url, + description: 'SimpRead 消息通知', + item: data.map((item) => ({ + description: md.render(item.content), + link: url, + pubDate: item.date, + title: `${item.category.name}-${item.title}`, + author: 'SimpRead', + })), + }; +};