From d43e81e2682d9f509d633523d6f057696f7337d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sun, 22 Jun 2025 13:45:29 +0200 Subject: [PATCH 1/2] Implement /v1/accounts/search Mastodon API endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../server/api/mastodon/endpoints/account.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index 6a1af62be7..0d22ac8ab5 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -153,6 +153,25 @@ export class ApiAccountMastodon { return reply.send(response); }); + fastify.get<{ Querystring: { q: string; limit?: string; offset?: string; resolve?: string; following?: string; } }>('/v1/accounts/search', async (request, reply) => { + if (!request.query.q) return reply.code(400).send({ error: 'BAD_REQUEST', error_description: 'Missing required property "q"' }); + + const client = this.clientService.getClient(request); + + const limit = request.query.limit ? parseInt(request.query.limit) : 40; + + const options = { + following: toBoolean(request.query.following), + limit, + resolve: toBoolean(request.query.resolve), + }; + + const data = await client.searchAccount(request.query.q, options); + const response = await Promise.all(data.data.map(async (account) => await this.mastoConverters.convertAccount(account))); + + return reply.send(response); + }); + fastify.get<{ Params: { id?: string } }>('/v1/accounts/:id', async (_request, reply) => { if (!_request.params.id) return reply.code(400).send({ error: 'BAD_REQUEST', error_description: 'Missing required parameter "id"' }); From e6deeaedd47e36cf9116444e3d98ccffaa1225c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sun, 22 Jun 2025 13:57:52 +0200 Subject: [PATCH 2/2] ? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/megalodon/src/misskey.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index bc38e27ce5..f0aabec136 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -623,7 +623,7 @@ export default class Misskey implements MegalodonInterface { max_id?: string since_id?: string } - ): Promise> | any> { + ): Promise>> { let params = { query: q, detail: true