Moar federation

This commit is contained in:
Tim Zöller 2025-12-03 08:05:17 +01:00
parent ef276128c6
commit 0732774986

View file

@ -27,8 +27,13 @@ public class WebFingerResponse {
/** /**
* Creates a WebFinger response for a user. * Creates a WebFinger response for a user.
*
* @param username the username
* @param domain the domain
* @param actorUrl the ActivityPub actor URL (e.g., https://domain/users/username)
* @param profilePageUrl the human-readable profile page URL (e.g., https://domain/users/username for HTML)
*/ */
public static WebFingerResponse forUser(String username, String domain, String actorUrl) { public static WebFingerResponse forUser(String username, String domain, String actorUrl, String profilePageUrl) {
String acctUri = String.format("acct:%s@%s", username, domain); String acctUri = String.format("acct:%s@%s", username, domain);
return WebFingerResponse.builder() return WebFingerResponse.builder()
@ -43,12 +48,20 @@ public class WebFingerResponse {
Link.builder() Link.builder()
.rel("http://webfinger.net/rel/profile-page") .rel("http://webfinger.net/rel/profile-page")
.type("text/html") .type("text/html")
.href(actorUrl) .href(profilePageUrl)
.build() .build()
)) ))
.build(); .build();
} }
/**
* Creates a WebFinger response for a user (legacy method for backward compatibility).
* Uses actorUrl for both ActivityPub and profile page.
*/
public static WebFingerResponse forUser(String username, String domain, String actorUrl) {
return forUser(username, domain, actorUrl, actorUrl);
}
/** /**
* WebFinger link object. * WebFinger link object.
*/ */