Loading packages/fedify/src/federation/builder.ts +6 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import type { ObjectAuthorizePredicate, ObjectDispatcher, SharedInboxKeyDispatcher, WebFingerLinkDispatcher, WebFingerLinksDispatcher, } from "./callback.ts"; import type { Context, RequestContext } from "./context.ts"; import type { Loading @@ -49,7 +49,7 @@ export class FederationBuilderImpl<TContextData> router: Router; actorCallbacks?: ActorCallbacks<TContextData>; nodeInfoDispatcher?: NodeInfoDispatcher<TContextData>; webFingerDispatcher?: WebFingerLinkDispatcher<TContextData>; webFingerLinksDispatcher?: WebFingerLinksDispatcher<TContextData>; objectCallbacks: Record<string, ObjectCallbacks<TContextData, string>>; objectTypeIds: Record< string, Loading Loading @@ -150,7 +150,7 @@ export class FederationBuilderImpl<TContextData> ? undefined : { ...this.actorCallbacks }; f.nodeInfoDispatcher = this.nodeInfoDispatcher; f.webFingerDispatcher = this.webFingerDispatcher; f.webFingerLinksDispatcher = this.webFingerLinksDispatcher; f.objectCallbacks = { ...this.objectCallbacks }; f.objectTypeIds = { ...this.objectTypeIds }; f.inboxPath = this.inboxPath; Loading Loading @@ -494,10 +494,10 @@ export class FederationBuilderImpl<TContextData> this.nodeInfoDispatcher = dispatcher; } setWebFingerLinkDispatcher( dispatcher: WebFingerLinkDispatcher<TContextData>, setWebFingerLinksDispatcher( dispatcher: WebFingerLinksDispatcher<TContextData>, ): void { this.webFingerDispatcher = dispatcher; this.webFingerLinksDispatcher = dispatcher; } setObjectDispatcher<TObject extends Object, TParam extends string>( Loading packages/fedify/src/federation/callback.ts +3 −2 Original line number Diff line number Diff line Loading @@ -21,9 +21,10 @@ export type NodeInfoDispatcher<TContextData> = ( * * @template TContextData The context data to pass to the {@link Context}. */ export type WebFingerLinkDispatcher<TContextData> = ( export type WebFingerLinksDispatcher<TContextData> = ( context: RequestContext<TContextData>, ) => Link[] | Promise<Link[]>; resource: URL, ) => readonly Link[] | Promise<readonly Link[]>; /** * A callback that dispatches an {@link Actor} object. Loading packages/fedify/src/federation/federation.ts +3 −3 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import type { ObjectDispatcher, OutboxErrorHandler, SharedInboxKeyDispatcher, WebFingerLinkDispatcher, WebFingerLinksDispatcher, } from "./callback.ts"; import type { Context, RequestContext } from "./context.ts"; import type { KvStore } from "./kv.ts"; Loading Loading @@ -84,8 +84,8 @@ export interface Federatable<TContextData> { * Registers a links dispatcher to WebFinger * @param dispatcher A links dispatcher callback to register. */ setWebFingerLinkDispatcher( dispatcher: WebFingerLinkDispatcher<TContextData>, setWebFingerLinksDispatcher( dispatcher: WebFingerLinksDispatcher<TContextData>, ): void; /** Loading packages/fedify/src/federation/middleware.ts +2 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ import { ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL, } from "@opentelemetry/semantic-conventions"; import metadata from "../../deno.json" with { type: "json" }; import { getDefaultActivityTransformers } from "../compat/transformers.ts"; import type { ActivityTransformer } from "../compat/types.ts"; import metadata from "../../deno.json" with { type: "json" }; import { getNodeInfo, type GetNodeInfoOptions } from "../nodeinfo/client.ts"; import { handleNodeInfo, handleNodeInfoJrd } from "../nodeinfo/handler.ts"; import type { JsonValue, NodeInfo } from "../nodeinfo/types.ts"; Loading Loading @@ -1280,7 +1280,7 @@ export class FederationImpl<TContextData> actorDispatcher: this.actorCallbacks?.dispatcher, actorHandleMapper: this.actorCallbacks?.handleMapper, actorAliasMapper: this.actorCallbacks?.aliasMapper, webFingerLinkDispatcher: this.webFingerDispatcher, webFingerLinksDispatcher: this.webFingerLinksDispatcher, onNotFound, tracer, }); Loading packages/fedify/src/webfinger/handler.test.ts +4 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import type { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, WebFingerLinkDispatcher, WebFingerLinksDispatcher, } from "../federation/callback.ts"; import type { RequestContext } from "../federation/context.ts"; import { MemoryKvStore } from "../federation/kv.ts"; Loading Loading @@ -540,8 +540,8 @@ test("handleWebFinger()", async (t) => { assertEquals(await response.json(), expectedForHostnameWithPort); }); await t.step("webFingerLinkDispatcher", async () => { const webFingerLinkDispatcher: WebFingerLinkDispatcher<void> = (_ctx) => { await t.step("webFingerLinksDispatcher", async () => { const webFingerLinksDispatcher: WebFingerLinksDispatcher<void> = (_ctx) => { return [ { rel: "http://ostatus.org/schema/1.0/subscribe", Loading @@ -557,7 +557,7 @@ test("handleWebFinger()", async (t) => { const response = await handleWebFinger(request, { context, actorDispatcher, webFingerLinkDispatcher, webFingerLinksDispatcher, onNotFound, }); Loading Loading
packages/fedify/src/federation/builder.ts +6 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import type { ObjectAuthorizePredicate, ObjectDispatcher, SharedInboxKeyDispatcher, WebFingerLinkDispatcher, WebFingerLinksDispatcher, } from "./callback.ts"; import type { Context, RequestContext } from "./context.ts"; import type { Loading @@ -49,7 +49,7 @@ export class FederationBuilderImpl<TContextData> router: Router; actorCallbacks?: ActorCallbacks<TContextData>; nodeInfoDispatcher?: NodeInfoDispatcher<TContextData>; webFingerDispatcher?: WebFingerLinkDispatcher<TContextData>; webFingerLinksDispatcher?: WebFingerLinksDispatcher<TContextData>; objectCallbacks: Record<string, ObjectCallbacks<TContextData, string>>; objectTypeIds: Record< string, Loading Loading @@ -150,7 +150,7 @@ export class FederationBuilderImpl<TContextData> ? undefined : { ...this.actorCallbacks }; f.nodeInfoDispatcher = this.nodeInfoDispatcher; f.webFingerDispatcher = this.webFingerDispatcher; f.webFingerLinksDispatcher = this.webFingerLinksDispatcher; f.objectCallbacks = { ...this.objectCallbacks }; f.objectTypeIds = { ...this.objectTypeIds }; f.inboxPath = this.inboxPath; Loading Loading @@ -494,10 +494,10 @@ export class FederationBuilderImpl<TContextData> this.nodeInfoDispatcher = dispatcher; } setWebFingerLinkDispatcher( dispatcher: WebFingerLinkDispatcher<TContextData>, setWebFingerLinksDispatcher( dispatcher: WebFingerLinksDispatcher<TContextData>, ): void { this.webFingerDispatcher = dispatcher; this.webFingerLinksDispatcher = dispatcher; } setObjectDispatcher<TObject extends Object, TParam extends string>( Loading
packages/fedify/src/federation/callback.ts +3 −2 Original line number Diff line number Diff line Loading @@ -21,9 +21,10 @@ export type NodeInfoDispatcher<TContextData> = ( * * @template TContextData The context data to pass to the {@link Context}. */ export type WebFingerLinkDispatcher<TContextData> = ( export type WebFingerLinksDispatcher<TContextData> = ( context: RequestContext<TContextData>, ) => Link[] | Promise<Link[]>; resource: URL, ) => readonly Link[] | Promise<readonly Link[]>; /** * A callback that dispatches an {@link Actor} object. Loading
packages/fedify/src/federation/federation.ts +3 −3 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import type { ObjectDispatcher, OutboxErrorHandler, SharedInboxKeyDispatcher, WebFingerLinkDispatcher, WebFingerLinksDispatcher, } from "./callback.ts"; import type { Context, RequestContext } from "./context.ts"; import type { KvStore } from "./kv.ts"; Loading Loading @@ -84,8 +84,8 @@ export interface Federatable<TContextData> { * Registers a links dispatcher to WebFinger * @param dispatcher A links dispatcher callback to register. */ setWebFingerLinkDispatcher( dispatcher: WebFingerLinkDispatcher<TContextData>, setWebFingerLinksDispatcher( dispatcher: WebFingerLinksDispatcher<TContextData>, ): void; /** Loading
packages/fedify/src/federation/middleware.ts +2 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ import { ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL, } from "@opentelemetry/semantic-conventions"; import metadata from "../../deno.json" with { type: "json" }; import { getDefaultActivityTransformers } from "../compat/transformers.ts"; import type { ActivityTransformer } from "../compat/types.ts"; import metadata from "../../deno.json" with { type: "json" }; import { getNodeInfo, type GetNodeInfoOptions } from "../nodeinfo/client.ts"; import { handleNodeInfo, handleNodeInfoJrd } from "../nodeinfo/handler.ts"; import type { JsonValue, NodeInfo } from "../nodeinfo/types.ts"; Loading Loading @@ -1280,7 +1280,7 @@ export class FederationImpl<TContextData> actorDispatcher: this.actorCallbacks?.dispatcher, actorHandleMapper: this.actorCallbacks?.handleMapper, actorAliasMapper: this.actorCallbacks?.aliasMapper, webFingerLinkDispatcher: this.webFingerDispatcher, webFingerLinksDispatcher: this.webFingerLinksDispatcher, onNotFound, tracer, }); Loading
packages/fedify/src/webfinger/handler.test.ts +4 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import type { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, WebFingerLinkDispatcher, WebFingerLinksDispatcher, } from "../federation/callback.ts"; import type { RequestContext } from "../federation/context.ts"; import { MemoryKvStore } from "../federation/kv.ts"; Loading Loading @@ -540,8 +540,8 @@ test("handleWebFinger()", async (t) => { assertEquals(await response.json(), expectedForHostnameWithPort); }); await t.step("webFingerLinkDispatcher", async () => { const webFingerLinkDispatcher: WebFingerLinkDispatcher<void> = (_ctx) => { await t.step("webFingerLinksDispatcher", async () => { const webFingerLinksDispatcher: WebFingerLinksDispatcher<void> = (_ctx) => { return [ { rel: "http://ostatus.org/schema/1.0/subscribe", Loading @@ -557,7 +557,7 @@ test("handleWebFinger()", async (t) => { const response = await handleWebFinger(request, { context, actorDispatcher, webFingerLinkDispatcher, webFingerLinksDispatcher, onNotFound, }); Loading