search: fix lookupPubkey for account search endpoint

This commit is contained in:
Alex Gleason 2024-08-07 16:44:32 -05:00
parent 8f5ec50a25
commit fd90c199f5
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -10,7 +10,7 @@ import { Storages } from '@/storages.ts';
import { uploadFile } from '@/utils/upload.ts'; import { uploadFile } from '@/utils/upload.ts';
import { nostrNow } from '@/utils.ts'; import { nostrNow } from '@/utils.ts';
import { createEvent, paginated, parseBody, updateListEvent } from '@/utils/api.ts'; import { createEvent, paginated, parseBody, updateListEvent } from '@/utils/api.ts';
import { extractIdentifier, lookupAccount } from '@/utils/lookup.ts'; import { extractIdentifier, lookupAccount, lookupPubkey } from '@/utils/lookup.ts';
import { renderAccounts, renderEventAccounts, renderStatuses } from '@/views.ts'; import { renderAccounts, renderEventAccounts, renderStatuses } from '@/views.ts';
import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.ts'; import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.ts';
import { renderRelationship } from '@/views/mastodon/relationships.ts'; import { renderRelationship } from '@/views/mastodon/relationships.ts';
@ -129,7 +129,7 @@ const accountSearchController: AppController = async (c) => {
const event = await lookupAccount(lookup ?? query); const event = await lookupAccount(lookup ?? query);
if (!event && lookup) { if (!event && lookup) {
const pubkey = bech32ToPubkey(lookup); const pubkey = await lookupPubkey(lookup);
return c.json(pubkey ? [await accountFromPubkey(pubkey)] : []); return c.json(pubkey ? [await accountFromPubkey(pubkey)] : []);
} }