Unverified Commit c3a73aa9 authored by Hong Minhee's avatar Hong Minhee
Browse files

Fix a bug where WebFinger/NodeInfo are not routed

parent 1206cb01
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -67,6 +67,10 @@ test("FederationBuilder", async (t) => {

      const impl = federation as FederationImpl<string>;

      assertEquals(
        impl.router.route("/.well-known/webfinger")?.name,
        "webfinger",
      );
      assertEquals(impl.router.route("/users/test123")?.name, "actor");
      assertEquals(impl.router.route("/users/test123/inbox")?.name, "inbox");
      assertEquals(
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ export class FederationBuilderImpl<TContextData>
    const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
    f.router = this.router;
    f.router.trailingSlashInsensitive = trailingSlashInsensitiveValue;
    f._initializeRouter();

    f.actorCallbacks = this.actorCallbacks;
    f.nodeInfoDispatcher = this.nodeInfoDispatcher;
+6 −2
Original line number Diff line number Diff line
@@ -297,8 +297,7 @@ export class FederationImpl<TContextData>
    }
    this.router.trailingSlashInsensitive = options.trailingSlashInsensitive ??
      false;
    this.router.add("/.well-known/webfinger", "webfinger");
    this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
    this._initializeRouter();
    if (options.allowPrivateAddress || options.userAgent != null) {
      if (options.documentLoader != null) {
        throw new TypeError(
@@ -381,6 +380,11 @@ export class FederationImpl<TContextData>
    this.tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
  }

  _initializeRouter() {
    this.router.add("/.well-known/webfinger", "webfinger");
    this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
  }

  override _getTracer() {
    return this.tracerProvider.getTracer(metadata.name, metadata.version);
  }