mirror of
https://github.com/versia-pub/api.git
synced 2025-12-06 08:28:19 +01:00
fix(federation): 🐛 Re-add ability to query WebFinger on a different server than the queries resources's hostname
This commit is contained in:
parent
97826e18a9
commit
9b4ce7183a
|
|
@ -67,6 +67,7 @@ export class FederationRequester {
|
||||||
* @param username The username to get the profile link for.
|
* @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 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 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.
|
* @returns The user's profile link.
|
||||||
* @throws If the request fails or the response is invalid.
|
* @throws If the request fails or the response is invalid.
|
||||||
* @example
|
* @example
|
||||||
|
|
@ -79,13 +80,14 @@ export class FederationRequester {
|
||||||
username: string,
|
username: string,
|
||||||
hostname: string,
|
hostname: string,
|
||||||
contentType = "application/json",
|
contentType = "application/json",
|
||||||
|
serverUrl = `https://${hostname}`,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const result = await this.get<User>(
|
const result = await this.get<User>(
|
||||||
new URL(
|
new URL(
|
||||||
`/.well-known/webfinger?${new URLSearchParams({
|
`/.well-known/webfinger?${new URLSearchParams({
|
||||||
resource: `acct:${username}@${hostname}`,
|
resource: `acct:${username}@${hostname}`,
|
||||||
})}`,
|
})}`,
|
||||||
`https://${hostname}`,
|
serverUrl,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue