From d258789c34d2a67f51f8bc5feedf0d9c2860febc Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 14 Sep 2023 20:30:24 +0200 Subject: [PATCH] [mastodon-client] GET /accounts/:id --- .../src/server/api/mastodon/endpoints/account.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index 3ff282a9b..3a7f5db2c 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -12,6 +12,8 @@ import { convertRelationship, convertStatus, } from "../converters.js"; +import { getNote, getUser } from "@/server/api/common/getters.js"; +import { convertUser } from "@/server/api/mastodon/converters/user.js"; const relationshipModel = { id: "", @@ -131,13 +133,10 @@ export function apiAccountMastodon(router: Router): void { } }); router.get<{ Params: { id: string } }>("/v1/accounts/:id", async (ctx) => { - const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; - const accessTokens = ctx.headers.authorization; - const client = getClient(BASE_URL, accessTokens); try { - const calcId = convertId(ctx.params.id, IdType.IceshrimpId); - const data = await client.getAccount(calcId); - ctx.body = convertAccount(data.data); + const userId = convertId(ctx.params.id, IdType.IceshrimpId); + const account = await convertUser(await getUser(userId)); + ctx.body = convertAccount(account); } catch (e: any) { console.error(e); console.error(e.response.data);