aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/webfinger.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/webfinger.ts')
-rw-r--r--server/helpers/webfinger.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts
index 688bf2bab..5c60de10c 100644
--- a/server/helpers/webfinger.ts
+++ b/server/helpers/webfinger.ts
@@ -11,15 +11,17 @@ const webfinger = new WebFinger({
11 request_timeout: 3000 11 request_timeout: 3000
12}) 12})
13 13
14async function loadActorUrlOrGetFromWebfinger (name: string, host: string) { 14async function loadActorUrlOrGetFromWebfinger (uri: string) {
15 const [ name, host ] = uri.split('@')
16
15 const actor = await ActorModel.loadByNameAndHost(name, host) 17 const actor = await ActorModel.loadByNameAndHost(name, host)
16 if (actor) return actor.url 18 if (actor) return actor.url
17 19
18 return getUrlFromWebfinger(name, host) 20 return getUrlFromWebfinger(uri)
19} 21}
20 22
21async function getUrlFromWebfinger (name: string, host: string) { 23async function getUrlFromWebfinger (uri: string) {
22 const webfingerData: WebFingerData = await webfingerLookup(name + '@' + host) 24 const webfingerData: WebFingerData = await webfingerLookup(uri)
23 return getLinkOrThrow(webfingerData) 25 return getLinkOrThrow(webfingerData)
24} 26}
25 27