diff options
Diffstat (limited to 'packages/frontend/src/pages/search.note.vue')
| -rw-r--r-- | packages/frontend/src/pages/search.note.vue | 54 |
1 files changed, 42 insertions, 12 deletions
diff --git a/packages/frontend/src/pages/search.note.vue b/packages/frontend/src/pages/search.note.vue index 05dc77b94b..9cf7fbe8d8 100644 --- a/packages/frontend/src/pages/search.note.vue +++ b/packages/frontend/src/pages/search.note.vue @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only <template> <div class="_gaps"> <div class="_gaps"> - <MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter="search"> + <MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter.prevent="search"> <template #prefix><i class="ti ti-search"></i></template> </MkInput> <MkFoldableSection :expanded="true"> @@ -143,25 +143,55 @@ async function search() { if (query == null || query === '') return; //#region AP lookup - if (query.startsWith('https://')) { - const promise = misskeyApi('ap/show', { - uri: query, + if (query.startsWith('https://') && !query.includes(' ')) { + const confirm = await os.confirm({ + type: 'info', + text: i18n.ts.lookupConfirm, }); + if (!confirm.canceled) { + const promise = misskeyApi('ap/show', { + uri: query, + }); - os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject); + os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject); - const res = await promise; + 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}`); - } + if (res.type === 'User') { + router.push(`/@${res.object.username}@${res.object.host}`); + } else if (res.type === 'Note') { + router.push(`/notes/${res.object.id}`); + } - return; + return; + } } //#endregion + if (query.length > 1 && !query.includes(' ')) { + if (query.startsWith('@')) { + const confirm = await os.confirm({ + type: 'info', + text: i18n.ts.lookupConfirm, + }); + if (!confirm.canceled) { + router.push(`/${query}`); + return; + } + } + + if (query.startsWith('#')) { + const confirm = await os.confirm({ + type: 'info', + text: i18n.ts.openTagPageConfirm, + }); + if (!confirm.canceled) { + router.push(`/tags/${encodeURIComponent(query.substring(1))}`); + return; + } + } + } + notePagination.value = { endpoint: 'notes/search', limit: 10, |