From f4c0b564ab550f87917275248bcf7863b26f1abc Mon Sep 17 00:00:00 2001 From: Michael Barrett Date: Thu, 16 Jan 2025 17:18:58 +0000 Subject: [PATCH] Updated account response (#263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no refs Updated account response - `postsCount` → `postCount` - `url` now returns the correct URL --- src/http/api/accounts.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/http/api/accounts.ts b/src/http/api/accounts.ts index b6d9071..c21ee1f 100644 --- a/src/http/api/accounts.ts +++ b/src/http/api/accounts.ts @@ -54,11 +54,11 @@ interface Account { */ url: string; /** - * URL pointing to the avatar of the account + * URL of the avatar of the account */ avatarUrl: string; /** - * URL pointing to the banner image of the account + * URL of the banner image of the account */ bannerImageUrl: string | null; /** @@ -68,7 +68,7 @@ interface Account { /** * Number of posts created by the account */ - postsCount: number; + postCount: number; /** * Number of liked posts by the account */ @@ -111,7 +111,7 @@ function getHandle(host?: string, username?: string) { * * @param db Database instance */ -async function getPostsCount(db: KvStore) { +async function getPostCount(db: KvStore) { const posts = await db.get(['outbox']); return posts?.length || 0; @@ -192,7 +192,7 @@ export async function handleGetAccount(ctx: AppContext) { accountData.preferredUsername, ), bio: sanitizeHtml(accountData.summary), - url: accountData.id, + url: accountData.url, avatarUrl: accountData.icon, /** * At the moment we don't support banner images for Ghost accounts @@ -202,7 +202,7 @@ export async function handleGetAccount(ctx: AppContext) { * At the moment we don't support custom fields for Ghost accounts */ customFields: {}, - postsCount: await getPostsCount(db), + postCount: await getPostCount(db), likedCount: await getLikedCount(db), followingCount: await getFollowingCount(db), followerCount: await getFollowerCount(db),