Skip to content

Commit

Permalink
Merge tag '0.6.1'
Browse files Browse the repository at this point in the history
Fedify 0.6.1
  • Loading branch information
dahlia committed Apr 17, 2024
2 parents 6d57d19 + 9e66924 commit a490041
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
20 changes: 20 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ To be released.
[authorized fetch]: https://swicg.github.io/activitypub-http-signature/#authorized-fetch


Version 0.6.1
-------------

Released on April 17, 2024.

- Fixed a bug of `new Federation()` constructor that if it is once called
the process will never exit. [[#39]]


Version 0.6.0
-------------

Expand Down Expand Up @@ -73,6 +82,17 @@ Released on April 9, 2024.
[#27]: https://github.com/dahlia/fedify/issues/27


Version 0.5.2
-------------

Released on April 17, 2024.

- Fixed a bug of `new Federation()` constructor that if it is once called
the process will never exit. [[#39]]

[#39]: https://github.com/dahlia/fedify/issues/39


Version 0.5.1
-------------

Expand Down
11 changes: 10 additions & 1 deletion federation/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export class Federation<TContextData> {
#kv: KvStore;
#kvPrefixes: FederationKvPrefixes;
#queue?: MessageQueue;
#queueStarted: boolean;
#router: Router;
#nodeInfoDispatcher?: NodeInfoDispatcher<TContextData>;
#actorCallbacks?: ActorCallbacks<TContextData>;
Expand Down Expand Up @@ -172,6 +173,7 @@ export class Federation<TContextData> {
...(kvPrefixes ?? {}),
};
this.#queue = queue;
this.#queueStarted = false;
this.#router = new Router();
this.#router.add("/.well-known/webfinger", "webfinger");
this.#router.add("/.well-known/nodeinfo", "nodeInfoJrd");
Expand All @@ -193,8 +195,13 @@ export class Federation<TContextData> {
15 * 60_000,
60 * 60_000,
].map((ms) => Temporal.Duration.from({ milliseconds: ms }));
}

queue?.listen(this.#listenQueue.bind(this));
#startQueue() {
if (this.#queue != null && !this.#queueStarted) {
this.#queue?.listen(this.#listenQueue.bind(this));
this.#queueStarted = true;
}
}

async #listenQueue(message: OutboxMessage): Promise<void> {
Expand Down Expand Up @@ -743,6 +750,7 @@ export class Federation<TContextData> {
"The activity to send must have at least one actor property.",
);
}
this.#startQueue();
if (activity.id == null) {
activity = activity.clone({
id: new URL(`urn:uuid:${crypto.randomUUID()}`),
Expand Down Expand Up @@ -827,6 +835,7 @@ export class Federation<TContextData> {
contextData,
}: FederationFetchOptions<TContextData>,
): Promise<Response> {
this.#startQueue();
onNotFound ??= notFound;
onNotAcceptable ??= notAcceptable;
onUnauthorized ??= unauthorized;
Expand Down

0 comments on commit a490041

Please sign in to comment.