diff --git a/src/client.ts b/src/client.ts index 287fbca..8d5e5d7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -38,6 +38,7 @@ const fetchFollows = (pubkey: string): Promise | null> => { function fetchFeed(event3: Event<3>): Promise[]> { const authors = event3.tags.filter((tag) => tag[0] === 'p').map((tag) => tag[1]); const results: SignedEvent<1>[] = []; + authors.push(event3.pubkey); // see own events in feed return new Promise((resolve) => { pool.subscribe( diff --git a/src/deps.ts b/src/deps.ts index 23acd59..8385391 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -3,5 +3,5 @@ export { Hono, validator }; export { cors } from 'https://deno.land/x/hono@v3.0.2/middleware.ts'; export { z } from 'https://deno.land/x/zod@v3.20.5/mod.ts'; export { Author, RelayPool } from 'https://dev.jspm.io/nostr-relaypool@0.5.3'; -export { getEventHash, getPublicKey, signEvent } from 'https://dev.jspm.io/nostr-tools@1.6.0'; +export { getEventHash, getPublicKey, nip19, signEvent } from 'npm:nostr-tools@^1.7.4'; export type { Context }; diff --git a/src/transmute.ts b/src/transmute.ts index 4cba0c9..83f2d77 100644 --- a/src/transmute.ts +++ b/src/transmute.ts @@ -1,3 +1,5 @@ +import { nip19 } from '@/deps.ts'; + import { LOCAL_DOMAIN } from './config.ts'; import { fetchUser } from './client.ts'; import { jsonSchema, MetaContent, metaContentSchema } from './schema.ts'; @@ -16,10 +18,11 @@ function toAccount(event: Event<0>) { const { pubkey } = event; const content: MetaContent = parseContent(event); const { host, origin } = new URL(LOCAL_DOMAIN); + const npub = nip19.npubEncode(pubkey); return { id: pubkey, - acct: content.nip05 || pubkey, + acct: content.nip05 || npub, avatar: content.picture || DEFAULT_AVATAR, avatar_static: content.picture || DEFAULT_AVATAR, bot: false, @@ -35,9 +38,9 @@ function toAccount(event: Event<0>) { header_static: content.banner, locked: false, note: content.about, - fqn: content.nip05 || `${pubkey}@${host}`, + fqn: content.nip05 || `${npub}@${host}`, url: `${origin}/users/${pubkey}`, - username: content.nip05 || pubkey, + username: content.nip05 || npub, }; }