Fix type errors
This commit is contained in:
parent
0ae4c21876
commit
4b2b658685
|
@ -1,7 +1,7 @@
|
||||||
import { findUser } from '@/db/users.ts';
|
|
||||||
import { getAuthor } from '@/queries.ts';
|
import { getAuthor } from '@/queries.ts';
|
||||||
import { activityJson } from '@/utils/api.ts';
|
import { activityJson } from '@/utils/api.ts';
|
||||||
import { renderActor } from '@/views/activitypub/actor.ts';
|
import { renderActor } from '@/views/activitypub/actor.ts';
|
||||||
|
import { localNip05Lookup } from '@/utils/nip05.ts';
|
||||||
|
|
||||||
import type { AppContext, AppController } from '@/app.ts';
|
import type { AppContext, AppController } from '@/app.ts';
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@ const actorController: AppController = async (c) => {
|
||||||
const username = c.req.param('username');
|
const username = c.req.param('username');
|
||||||
const { signal } = c.req.raw;
|
const { signal } = c.req.raw;
|
||||||
|
|
||||||
const user = await findUser({ username }, signal);
|
const pointer = await localNip05Lookup(username);
|
||||||
if (!user) return notFound(c);
|
if (!pointer) return notFound(c);
|
||||||
|
|
||||||
const event = await getAuthor(user.pubkey, { signal });
|
const event = await getAuthor(pointer.pubkey, { signal });
|
||||||
if (!event) return notFound(c);
|
if (!event) return notFound(c);
|
||||||
|
|
||||||
const actor = await renderActor(event, user.username);
|
const actor = await renderActor(event, username);
|
||||||
if (!actor) return notFound(c);
|
if (!actor) return notFound(c);
|
||||||
|
|
||||||
return activityJson(c, actor);
|
return activityJson(c, actor);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Conf } from '@/config.ts';
|
import { Conf } from '@/config.ts';
|
||||||
import { findUser } from '@/db/users.ts';
|
|
||||||
import { nip19, z } from '@/deps.ts';
|
import { nip19, z } from '@/deps.ts';
|
||||||
|
import { localNip05Lookup } from '@/utils/nip05.ts';
|
||||||
|
|
||||||
import type { AppContext, AppController } from '@/app.ts';
|
import type { AppContext, AppController } from '@/app.ts';
|
||||||
import type { Webfinger } from '@/schemas/webfinger.ts';
|
import type { Webfinger } from '@/schemas/webfinger.ts';
|
||||||
|
@ -43,15 +43,15 @@ async function handleAcct(c: AppContext, resource: URL): Promise<Response> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const [username, host] = result.data;
|
const [username, host] = result.data;
|
||||||
const user = await findUser({ username });
|
const pointer = await localNip05Lookup(username);
|
||||||
|
|
||||||
if (!user) {
|
if (!pointer) {
|
||||||
return c.json({ error: 'Not found' }, 404);
|
return c.json({ error: 'Not found' }, 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = renderWebfinger({
|
const json = renderWebfinger({
|
||||||
pubkey: user.pubkey,
|
pubkey: pointer.pubkey,
|
||||||
username: user.username,
|
username,
|
||||||
subject: `acct:${username}@${host}`,
|
subject: `acct:${username}@${host}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue