From 354949eb608ce01505cbeb8052ad0352a57a171e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jul 2023 22:21:06 +0000 Subject: [PATCH 1/2] chore(deps): bump pinyin-pro from 3.16.0 to 3.16.1 in /docs (#12890) Bumps [pinyin-pro](https://github.com/zh-lx/pinyin-pro) from 3.16.0 to 3.16.1. - [Release notes](https://github.com/zh-lx/pinyin-pro/releases) - [Changelog](https://github.com/zh-lx/pinyin-pro/blob/main/CHANGELOG.md) - [Commits](https://github.com/zh-lx/pinyin-pro/compare/3.16.0...3.16.1) --- updated-dependencies: - dependency-name: pinyin-pro dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docs/package.json | 2 +- docs/pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/package.json b/docs/package.json index 6998938d88493d..deda3d15676eef 100644 --- a/docs/package.json +++ b/docs/package.json @@ -23,7 +23,7 @@ "@vuepress/plugin-pwa": "1.9.9", "@vuepress/shared-utils": "1.9.9", "markdown-it": "13.0.1", - "pinyin-pro": "3.16.0", + "pinyin-pro": "3.16.1", "remark": "13.0.0", "remark-frontmatter": "3.0.0", "remark-gfm": "1.0.0", diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index 837b78ea250e59..f409ced68e8e1d 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -21,8 +21,8 @@ dependencies: specifier: 13.0.1 version: 13.0.1 pinyin-pro: - specifier: 3.16.0 - version: 3.16.0 + specifier: 3.16.1 + version: 3.16.1 remark: specifier: 13.0.0 version: 13.0.0 @@ -7223,8 +7223,8 @@ packages: engines: {node: '>=0.10.0'} dev: false - /pinyin-pro@3.16.0: - resolution: {integrity: sha512-U4pMQ/KSMM5JmSb+ZcReCIbgzGl/JaglaHqWjCli0hpA0rDdjRbAO67e6fOa3ZFcJzbqfe6bJkaMMmpiWmkXgQ==} + /pinyin-pro@3.16.1: + resolution: {integrity: sha512-Pm5vKjAO7EZ1w39Xw9/yzynNDbqFVWkvgCSPyHvvCCrhWrkeOK//2FvX2uoWb2yUzGTsruUqrAaKySG8TQV/0Q==} dev: false /pkg-dir@3.0.0: From 6c07fc6d862fee77ad90afe5d7a3fc96dd28324c Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Fri, 28 Jul 2023 04:21:31 +0200 Subject: [PATCH 2/2] feat(route): add route for bluesky post search ("keyword") (#12893) * add route for bluesky post search ("keyword") * try and fix up routes * Apply suggestions from code review --------- --- docs/en/social-media.md | 6 ++++++ docs/social-media.md | 6 ++++++ lib/v2/bsky/keyword.js | 22 ++++++++++++++++++++++ lib/v2/bsky/maintainer.js | 3 +++ lib/v2/bsky/radar.js | 13 +++++++++++++ lib/v2/bsky/router.js | 3 +++ 6 files changed, 53 insertions(+) create mode 100644 lib/v2/bsky/keyword.js create mode 100644 lib/v2/bsky/maintainer.js create mode 100644 lib/v2/bsky/radar.js create mode 100644 lib/v2/bsky/router.js diff --git a/docs/en/social-media.md b/docs/en/social-media.md index ea83ae471882db..75ecd271676dd9 100644 --- a/docs/en/social-media.md +++ b/docs/en/social-media.md @@ -4,6 +4,12 @@ pageClass: routes # Social Media +## Bluesky (bsky) + +### Keywords + + + ## Crossbell ### Notes diff --git a/docs/social-media.md b/docs/social-media.md index 308cb5eb889867..b1aff0100a4279 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -24,6 +24,12 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性 ::: +## Bluesky (bsky) + +### 关键词 + + + ### 番剧 diff --git a/lib/v2/bsky/keyword.js b/lib/v2/bsky/keyword.js new file mode 100644 index 00000000000000..7c1b04bfaa2548 --- /dev/null +++ b/lib/v2/bsky/keyword.js @@ -0,0 +1,22 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const { keyword } = ctx.params; + const apiLink = `https://search.bsky.social/search/posts?q=${encodeURIComponent(keyword)}`; + + const { data } = await got(apiLink); + + const items = data.map((item) => ({ + title: item.post.text, + link: `https://bsky.app/profile/${item.user.handle}/post/${item.tid.split('/')[1]}`, + description: item.post.text, + pubDate: new Date(item.post.createdAt / 1000000), + author: item.user.handle, + })); + + ctx.state.data = { + title: `Bluesky Keyword - ${keyword}`, + link: `https://bsky.app/search?q=${encodeURIComponent(keyword)}`, + item: items, + }; +}; diff --git a/lib/v2/bsky/maintainer.js b/lib/v2/bsky/maintainer.js new file mode 100644 index 00000000000000..61f792cbb44c2d --- /dev/null +++ b/lib/v2/bsky/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/keyword/:keyword': ['untitaker'], +}; diff --git a/lib/v2/bsky/radar.js b/lib/v2/bsky/radar.js new file mode 100644 index 00000000000000..d0ec0e60b3e46f --- /dev/null +++ b/lib/v2/bsky/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'bsky.app': { + _name: 'Bluesky', + '.': [ + { + title: '关键词', + docs: 'https://docs.rsshub.app/social-media.html#bluesky-bsky', + source: '/search', + target: (params, url) => `/bsky/keyword/${new URL(url).searchParams.get('q')}`, + }, + ], + }, +}; diff --git a/lib/v2/bsky/router.js b/lib/v2/bsky/router.js new file mode 100644 index 00000000000000..3d4d1c62da6d8d --- /dev/null +++ b/lib/v2/bsky/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/keyword/:keyword', require('./keyword')); +};