@@ -491,6 +491,67 @@ The `url` property usually refers to the actor's profile page. It is
491491used as the ` links ` property of the WebFinger response, with the ` rel `
492492property set to < http://webfinger.net/rel/profile-page > .
493493
494+ > [ !TIP]
495+ > You probably want to implement [ actor aliases] ( #actor-aliases ) if you want
496+ > to give different URLs to the actor URI and its web profile URL.
497+
498+ If you want to provide links with other ` rel ` than
499+ < http://webfinger.net/rel/profile-page > , you can put ` Link ` objects in the
500+ ` url ` property:
501+
502+ ~~~~ typescript{8-16} twoslash
503+ import { type Federation, Person, Link } from "@fedify/fedify";
504+ const federation = null as unknown as Federation<void>;
505+ // ---cut-before---
506+ federation
507+ .setActorDispatcher("/users/{identifier}", async (ctx, identifier) => {
508+ return new Person({
509+ id: ctx.getActorUri(identifier),
510+ preferredUsername: identifier,
511+ urls: [
512+ new URL(`/@${identifier}`, ctx.origin),
513+ new Link({
514+ rel: "alternate",
515+ href: new URL(`/@${identifier}/atom.xml`, ctx.origin),
516+ mediaType: "application/atom+xml",
517+ }),
518+ new Link({
519+ rel: "http://openid.net/specs/connect/1.0/issuer",
520+ href: new URL("/openid", ctx.origin),
521+ }),
522+ ],
523+ // Omitted for brevity; see the previous example for details.
524+ });
525+ });
526+ ~~~~
527+
528+ With the above example, the WebFinger response will contain the following
529+ ` links ` property:
530+
531+ ~~~~ json
532+ {
533+ "subject" :
" acct:[email protected] " ,
534+ "aliases" : [
535+ " https://example.com/users/john_doe"
536+ ],
537+ "links" : [
538+ {
539+ "rel" : " http://webfinger.net/rel/profile-page" ,
540+ "href" : " https://example.com/@john_doe"
541+ },
542+ {
543+ "rel" : " alternate" ,
544+ "href" : " https://example.com/@john_doe/atom.xml" ,
545+ "type" : " application/atom+xml"
546+ },
547+ {
548+ "rel" : " http://openid.net/specs/connect/1.0/issuer" ,
549+ "href" : " https://example.com/openid"
550+ }
551+ ]
552+ }
553+ ~~~~
554+
494555### ` icon `
495556
496557* This API is available since Fedify 1.0.0.*
@@ -518,7 +579,7 @@ the corresponding actor's internal identifier or username, or `null` if there
518579is no corresponding actor:
519580
520581~~~~ typescript{15-25} twoslash
521- // @noErrors: 2339 2345 2391 7006
582+ // @noErrors: 2345 2391
522583import { type Federation } from "@fedify/fedify";
523584const federation = null as unknown as Federation<void>;
524585interface User { uuid: string; }
@@ -570,7 +631,7 @@ for the actor's profile URL with the corresponding actor URI.
570631> in the ` ~ActorCallbackSetters.mapAlias() ` method:
571632>
572633> ~~~~ typescript twoslash
573- > // @noErrors: 2339 2345 2391 7006
634+ > // @noErrors: 2345 7006
574635> import { type Federation } from " @fedify/fedify" ;
575636> const federation = null as unknown as Federation <void >;
576637> federation .setActorDispatcher (
0 commit comments