mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(federation): ♻️ Correctly handle bridge requests and instance signatures in user inboxes
This commit is contained in:
parent
afc5a74a40
commit
ace6921447
8 changed files with 2310 additions and 36 deletions
|
|
@ -319,6 +319,18 @@ export class Instance extends BaseInterface<typeof Instances> {
|
|||
}
|
||||
}
|
||||
|
||||
public static resolveFromHost(host: string): Promise<Instance> {
|
||||
if (host.startsWith("http")) {
|
||||
const url = new URL(host).host;
|
||||
|
||||
return Instance.resolve(url);
|
||||
}
|
||||
|
||||
const url = new URL(`https://${host}`);
|
||||
|
||||
return Instance.resolve(url.origin);
|
||||
}
|
||||
|
||||
public static async resolve(url: string): Promise<Instance> {
|
||||
const logger = getLogger("federation");
|
||||
const host = new URL(url).host;
|
||||
|
|
@ -346,6 +358,7 @@ export class Instance extends BaseInterface<typeof Instances> {
|
|||
version: metadata.software.version,
|
||||
logo: metadata.logo,
|
||||
protocol,
|
||||
publicKey: metadata.public_key,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue