From 22ce676cf94cc6d6c19febbe841592aef6bc3e6a Mon Sep 17 00:00:00 2001 From: CutestNekoAqua Date: Sat, 18 Feb 2023 17:14:16 +0100 Subject: [PATCH] make relationshiops work --- .../backend/src/server/api/mastodon/endpoints/account.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index f395c5a9c5..a93b1f5962 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -98,7 +98,7 @@ export function apiAccountMastodon(router: Router): void { ctx.body = e.response.data; } }); - router.get<{ Params: { id: string } }>("/v1/accounts/:id", async (ctx) => { + router.get<{ Params: { id: string } }>("/v1/accounts/:id(^.*\\d.*$)", async (ctx) => { const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); @@ -304,11 +304,12 @@ export function apiAccountMastodon(router: Router): void { const client = getClient(BASE_URL, accessTokens); let users; try { - const idsRaw = ctx.request.body ? ["id[]"] : null; + // TODO: this should be body + const idsRaw = ctx.request.query ? ["id[]"] : null; const ids = typeof idsRaw === "string" ? [idsRaw] : idsRaw; users = ids; relationshopModel.id = idsRaw?.toString() || "1"; - if (!(idsRaw && ids)) { + if (!idsRaw) { ctx.body = [relationshopModel]; return; }