From c1d9e23171eff1eebd9e916dab5ed7a2be93e3cd Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 29 Mar 2023 17:22:34 +0900 Subject: [PATCH] =?UTF-8?q?enhance(client):=20=E6=A4=9C=E7=B4=A2=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=A7URL=E3=82=92=E5=85=A5=E5=8A=9B?= =?UTF-8?q?=E3=81=97=E3=81=9F=E9=9A=9B=E3=81=AB=E7=85=A7=E4=BC=9A=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=A8=E5=90=8C=E7=AD=89=E3=81=AE?= =?UTF-8?q?=E6=8C=99=E5=8B=95=E3=82=92=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 11 +++++++++++ packages/frontend/src/pages/search.vue | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8fa82ad2..84e332151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,17 @@ --> +## 13.x.x (unreleased) + +### General +- + +### Client +- 検索ページでURLを入力した際に照会したときと同等の挙動をするように + +### Server +- + ## 13.10.3 ### Changes diff --git a/packages/frontend/src/pages/search.vue b/packages/frontend/src/pages/search.vue index cc6f8cc0c..5523d5cf4 100644 --- a/packages/frontend/src/pages/search.vue +++ b/packages/frontend/src/pages/search.vue @@ -56,6 +56,9 @@ import MkFoldableSection from '@/components/MkFoldableSection.vue'; import { $i } from '@/account'; import { instance } from '@/instance'; import MkInfo from '@/components/MkInfo.vue'; +import { useRouter } from '@/router'; + +const router = useRouter(); const props = defineProps<{ query: string; @@ -84,6 +87,24 @@ async function search() { if (query == null || query === '') return; + if (query.startsWith('https://')) { + const promise = os.api('ap/show', { + uri: query, + }); + + os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject); + + const res = await promise; + + if (res.type === 'User') { + router.push(`/@${res.object.username}@${res.object.host}`); + } else if (res.type === 'Note') { + router.push(`/notes/${res.object.id}`); + } + + return; + } + if (tab === 'note') { notePagination = { endpoint: 'notes/search',