Skip to content

Commit

Permalink
fix: make getActor sync
Browse files Browse the repository at this point in the history
  • Loading branch information
catdevnull committed Mar 8, 2024
1 parent 7aa12c5 commit 551f2f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/server/announcements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export class Announcements {
return url.hostname
}

async getActor (): Promise<ActorStore> {
getActor (): ActorStore {
return this.apsystem.store.forActor(this.mention)
}

async init (): Promise<void> {
const actorUrl = this.actorUrl
const actor = await this.getActor()
const actor = this.getActor()

try {
const prev = await actor.getInfo()
Expand Down Expand Up @@ -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<APOrderedCollection> {
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?
Expand Down
4 changes: 2 additions & 2 deletions src/server/api/announcements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 551f2f5

Please sign in to comment.