Skip to content

Commit

Permalink
fix(federation): 🐛 Re-add ability to query WebFinger on a different s…
Browse files Browse the repository at this point in the history
…erver than the queries resources's hostname
  • Loading branch information
CPlusPatch committed Jul 26, 2024
1 parent 97826e1 commit 9b4ce71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion federation/requester/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class FederationRequester {
* @param username The username to get the profile link for.
* @param hostname The hostname to get the profile link for (defaults to the server's hostname).
* @param contentType The content type of the link to get (defaults to "application/json").
* @param serverUrl The URL of the server to query for WebFinger. Useful for bridges. Defaults to hostname.
* @returns The user's profile link.
* @throws If the request fails or the response is invalid.
* @example
Expand All @@ -79,13 +80,14 @@ export class FederationRequester {
username: string,
hostname: string,
contentType = "application/json",
serverUrl = `https://${hostname}`,
): Promise<string> {
const result = await this.get<User>(
new URL(
`/.well-known/webfinger?${new URLSearchParams({
resource: `acct:${username}@${hostname}`,
})}`,
`https://${hostname}`,
serverUrl,
),
);

Expand Down

0 comments on commit 9b4ce71

Please sign in to comment.