Unverified Commit 14d841c5 authored by Hong Minhee's avatar Hong Minhee
Browse files

Docs: custom WebFinger links

parent 825fbb33
Loading
Loading
Loading
Loading
−73 B (221 KiB)

File changed.

No diff preview for this file type.

+57 −0
Original line number Diff line number Diff line
@@ -491,6 +491,63 @@ The `url` property usually refers to the actor's profile page. It is
used as the `links` property of the WebFinger response, with the `rel`
property set to <http://webfinger.net/rel/profile-page>.

If you want to provide links with other `rel` than
<http://webfinger.net/rel/profile-page>, you can put `Link` objects in the
`url` property:

~~~~ typescript{8-16} twoslash
import { type Federation, Person, Link } from "@fedify/fedify";
const federation = null as unknown as Federation<void>;
// ---cut-before---
federation
  .setActorDispatcher("/users/{identifier}", async (ctx, identifier) => {
    return new Person({
      id: ctx.getActorUri(identifier),
      preferredUsername: identifier,
      urls: [
        new URL(`/@${identifier}`, ctx.origin),
        new Link({
          rel: "alternate",
          href: new URL(`/@${identifier}/atom.xml`, ctx.origin),
          mediaType: "application/atom+xml",
        }),
        new Link({
          rel: "http://openid.net/specs/connect/1.0/issuer",
          href: new URL("/openid", ctx.origin),
        }),
      ],
      // Omitted for brevity; see the previous example for details.
    });
  });
~~~~

With the above example, the WebFinger response will contain the following
`links` property:

~~~~ json
{
  "subject": "acct:johndoe@example.com",
  "aliases": [
    "https://example.com/users/john_doe"
  ],
  "links": [
    {
      "rel": "http://webfinger.net/rel/profile-page",
      "href": "https://example.com/@john_doe"
    },
    {
      "rel": "alternate",
      "href": "https://example.com/@john_doe/atom.xml",
      "type": "application/atom+xml"
    },
    {
      "rel": "http://openid.net/specs/connect/1.0/issuer",
      "href": "https://example.com/openid"
    }
  ]
}
~~~~

### `icon`

*This API is available since Fedify 1.0.0.*
+4 −4
Original line number Diff line number Diff line
{
  "devDependencies": {
    "@braintree/sanitize-url": "^7.1.0",
    "@deno/kv": "^0.8.2",
    "@fedify/amqp": "0.1.0-dev.8",
    "@fedify/fedify": "^1.3.0-dev.578",
    "@braintree/sanitize-url": "^7.1.1",
    "@deno/kv": "^0.8.4",
    "@fedify/amqp": "0.1.0",
    "@fedify/fedify": "^1.3.2",
    "@fedify/postgres": "0.2.2",
    "@fedify/redis": "0.2.0-dev.10",
    "@hono/node-server": "^1.12.2",