From c55ab4f6b8ec8b8583059c40b6ec972753edc07e Mon Sep 17 00:00:00 2001 From: Ethan Shen <42264778+nczitzk@users.noreply.github.com> Date: Tue, 26 Jul 2022 00:38:18 +0800 Subject: [PATCH] feat(route): add Postman Release Notes (#10323) --- docs/en/program-update.md | 6 ++++++ docs/program-update.md | 6 ++++++ lib/v2/postman/maintainer.js | 3 +++ lib/v2/postman/radar.js | 13 +++++++++++++ lib/v2/postman/release-notes.js | 27 +++++++++++++++++++++++++++ lib/v2/postman/router.js | 3 +++ 6 files changed, 58 insertions(+) create mode 100644 lib/v2/postman/maintainer.js create mode 100644 lib/v2/postman/radar.js create mode 100644 lib/v2/postman/release-notes.js create mode 100644 lib/v2/postman/router.js diff --git a/docs/en/program-update.md b/docs/en/program-update.md index 484eb4c5f6..88ebcc1bb1 100644 --- a/docs/en/program-update.md +++ b/docs/en/program-update.md @@ -368,6 +368,12 @@ Refer to [#minecraft](/en/game.html#minecraft) 见 [#playstation](/game.html#playstation) +## Postman + +### Release Notes + + + ## Potplayer ### Version History diff --git a/docs/program-update.md b/docs/program-update.md index 15ab3cc3b3..f32f1ed34b 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -411,6 +411,12 @@ pageClass: routes 见 [#playstation](/game.html#playstation) +## Postman + +### Release Notes + + + ## Potplayer ### 版本历史 diff --git a/lib/v2/postman/maintainer.js b/lib/v2/postman/maintainer.js new file mode 100644 index 0000000000..9c029be506 --- /dev/null +++ b/lib/v2/postman/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/release-notes': ['nczitzk'], +}; diff --git a/lib/v2/postman/radar.js b/lib/v2/postman/radar.js new file mode 100644 index 0000000000..38c7c4b64a --- /dev/null +++ b/lib/v2/postman/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'postman.com': { + _name: 'Postman', + '.': [ + { + title: 'Release Notes', + docs: 'https://docs.rsshub.app/program-update.html#postman-release-notes', + source: ['/downloads/release-notes', '/'], + target: '/postman/release-notes', + }, + ], + }, +}; diff --git a/lib/v2/postman/release-notes.js b/lib/v2/postman/release-notes.js new file mode 100644 index 0000000000..8061f82faa --- /dev/null +++ b/lib/v2/postman/release-notes.js @@ -0,0 +1,27 @@ +const got = require('@/utils/got'); +const md = require('markdown-it')({ + html: true, +}); + +module.exports = async (ctx) => { + const rootUrl = 'https://www.postman.com'; + const apiUrl = `${rootUrl}/mkapi/release.json`; + const currentUrl = `${rootUrl}/downloads/release-notes`; + + const response = await got({ + method: 'get', + url: apiUrl, + }); + + const items = response.data.notes.map((item) => ({ + title: item.version, + link: `${currentUrl}#${item.version}`, + description: md.render(item.content), + })); + + ctx.state.data = { + title: 'Release Notes | Postman', + link: currentUrl, + item: items, + }; +}; diff --git a/lib/v2/postman/router.js b/lib/v2/postman/router.js new file mode 100644 index 0000000000..27872e915f --- /dev/null +++ b/lib/v2/postman/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/release-notes', require('./release-notes')); +};