aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/webfinger.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-16 15:25:20 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 09:41:54 +0200
commit06a05d5f4784a7cbb27aa1188385b5679845dad8 (patch)
treeac197f3ed0768529456225ad76c912f22bc55e29 /server/helpers/webfinger.ts
parent4bda2e47bbc937c401ddcf14c1be53c70481a294 (diff)
downloadPeerTube-06a05d5f4784a7cbb27aa1188385b5679845dad8.tar.gz
PeerTube-06a05d5f4784a7cbb27aa1188385b5679845dad8.tar.zst
PeerTube-06a05d5f4784a7cbb27aa1188385b5679845dad8.zip
Add subscriptions endpoints to REST API
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