From f15b7fb2503db0fc635e37bbec71cf08e9855fcb Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 25 Sep 2023 12:21:10 +0200 Subject: [PATCH] fix: fetching remote users on elk via megalodon --- packages/megalodon/src/misskey.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index 0ea66cb49a..2f2cf3b9c9 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -2035,6 +2035,27 @@ export default class Misskey implements MegalodonInterface { }) } } + const match = q.match(/^@?(?[a-zA-Z0-9_]+)(?:@(?[a-zA-Z0-9-.]+\.[a-zA-Z0-9-]+)|)$/); + if (match) { + const lookupQuery = { + username: match.groups?.user, + host: match.groups?.host, + }; + + return await this.client.post('/api/users/show', lookupQuery).then((res) => ({ + ...res, + data: { + accounts: [ + MisskeyAPI.Converter.userDetail( + res.data, + this.baseUrl, + ), + ], + statuses: [], + hashtags: [], + }, + })); + } return this.client.post>('/api/users/search', params).then(res => ({ ...res, data: {