summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/gen-search-query.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/scripts/gen-search-query.ts')
-rw-r--r--packages/frontend/src/scripts/gen-search-query.ts35
1 files changed, 0 insertions, 35 deletions
diff --git a/packages/frontend/src/scripts/gen-search-query.ts b/packages/frontend/src/scripts/gen-search-query.ts
deleted file mode 100644
index a85ee01e26..0000000000
--- a/packages/frontend/src/scripts/gen-search-query.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SPDX-FileCopyrightText: syuilo and misskey-project
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-
-import * as Misskey from 'misskey-js';
-import { host as localHost } from '@@/js/config.js';
-
-export async function genSearchQuery(v: any, q: string) {
- let host: string;
- let userId: string;
- if (q.split(' ').some(x => x.startsWith('@'))) {
- for (const at of q.split(' ').filter(x => x.startsWith('@')).map(x => x.substring(1))) {
- if (at.includes('.')) {
- if (at === localHost || at === '.') {
- host = null;
- } else {
- host = at;
- }
- } else {
- const user = await v.api('users/show', Misskey.acct.parse(at)).catch(x => null);
- if (user) {
- userId = user.id;
- } else {
- // todo: show error
- }
- }
- }
- }
- return {
- query: q.split(' ').filter(x => !x.startsWith('/') && !x.startsWith('@')).join(' '),
- host: host,
- userId: userId,
- };
-}