diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-16 15:25:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | 06a05d5f4784a7cbb27aa1188385b5679845dad8 (patch) | |
tree | ac197f3ed0768529456225ad76c912f22bc55e29 /server/helpers/webfinger.ts | |
parent | 4bda2e47bbc937c401ddcf14c1be53c70481a294 (diff) | |
download | PeerTube-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.ts | 10 |
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 | ||
14 | async function loadActorUrlOrGetFromWebfinger (name: string, host: string) { | 14 | async 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 | ||
21 | async function getUrlFromWebfinger (name: string, host: string) { | 23 | async 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 | ||