Loading CHANGES.md +5 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,11 @@ Version 0.5.2 To be released. - 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 ------------- Loading federation/middleware.ts +10 −1 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ export class Federation<TContextData> { #kv: KvStore; #kvPrefixes: FederationKvPrefixes; #queue?: MessageQueue; #queueStarted: boolean; #router: Router; #nodeInfoDispatcher?: NodeInfoDispatcher<TContextData>; #actorCallbacks?: ActorCallbacks<TContextData>; Loading Loading @@ -155,6 +156,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"); Loading @@ -175,8 +177,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> { Loading Loading @@ -681,6 +688,7 @@ export class Federation<TContextData> { activity: Activity, { preferSharedInbox, immediate }: SendActivityOptions = {}, ): Promise<void> { this.#startQueue(); if (activity.id == null) { activity = activity.clone({ id: new URL(`urn:uuid:${crypto.randomUUID()}`), Loading Loading @@ -741,6 +749,7 @@ export class Federation<TContextData> { contextData, }: FederationHandlerParameters<TContextData>, ): Promise<Response> { this.#startQueue(); onNotFound ??= notFound; onNotAcceptable ??= notAcceptable; const url = new URL(request.url); Loading Loading
CHANGES.md +5 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,11 @@ Version 0.5.2 To be released. - 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 ------------- Loading
federation/middleware.ts +10 −1 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ export class Federation<TContextData> { #kv: KvStore; #kvPrefixes: FederationKvPrefixes; #queue?: MessageQueue; #queueStarted: boolean; #router: Router; #nodeInfoDispatcher?: NodeInfoDispatcher<TContextData>; #actorCallbacks?: ActorCallbacks<TContextData>; Loading Loading @@ -155,6 +156,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"); Loading @@ -175,8 +177,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> { Loading Loading @@ -681,6 +688,7 @@ export class Federation<TContextData> { activity: Activity, { preferSharedInbox, immediate }: SendActivityOptions = {}, ): Promise<void> { this.#startQueue(); if (activity.id == null) { activity = activity.clone({ id: new URL(`urn:uuid:${crypto.randomUUID()}`), Loading Loading @@ -741,6 +749,7 @@ export class Federation<TContextData> { contextData, }: FederationHandlerParameters<TContextData>, ): Promise<Response> { this.#startQueue(); onNotFound ??= notFound; onNotAcceptable ??= notAcceptable; const url = new URL(request.url); Loading