From 551f2f57e8c3ecb1b2fbd159211d9ed09224deee Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 8 Mar 2024 16:42:00 -0300 Subject: [PATCH] fix: make getActor sync --- src/server/announcements.ts | 8 ++++---- src/server/api/announcements.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/announcements.ts b/src/server/announcements.ts index 95f6f0f..b2baa39 100644 --- a/src/server/announcements.ts +++ b/src/server/announcements.ts @@ -27,13 +27,13 @@ export class Announcements { return url.hostname } - async getActor (): Promise { + getActor (): ActorStore { return this.apsystem.store.forActor(this.mention) } async init (): Promise { const actorUrl = this.actorUrl - const actor = await this.getActor() + const actor = this.getActor() try { const prev = await actor.getInfo() @@ -73,13 +73,13 @@ export class Announcements { // TODO: add a template in config content: `a wild site appears! ${actor}` } - await (await this.getActor()).outbox.add(activity) + await this.getActor().outbox.add(activity) await this.apsystem.notifyFollowers(this.mention, activity) } } async getOutbox (): Promise { - const actor = await this.getActor() + const actor = this.getActor() const activities = await actor.outbox.list() const orderedItems = activities // XXX: maybe `new Date()` doesn't correctly parse possible dates? diff --git a/src/server/api/announcements.ts b/src/server/api/announcements.ts index 63370f9..c3f93cc 100644 --- a/src/server/api/announcements.ts +++ b/src/server/api/announcements.ts @@ -28,7 +28,7 @@ export const announcementsRoutes = (cfg: APIConfig, store: Store, apsystem: Acti tags: ['ActivityPub'] } }, async (request, reply) => { - const actor = await apsystem.announcements.getActor() + const actor = apsystem.announcements.getActor() const actorInfo = await actor.getInfo() return await reply.send({ @@ -89,7 +89,7 @@ export const announcementsRoutes = (cfg: APIConfig, store: Store, apsystem: Acti tags: ['ActivityPub'] } }, async (request, reply) => { - const actor = await apsystem.announcements.getActor() + const actor = apsystem.announcements.getActor() const actorInfo = await actor.getInfo() const activity = await actor.outbox.get(`${actorInfo.actorUrl}outbox/${request.params.id}`) return await reply.send(activity)