diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-24 11:04:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d (patch) | |
tree | 1b2f8a578b2d35138ac326d65674a9c9d740e8c9 /server/helpers/webfinger.ts | |
parent | aa55a4da422330fe2816f1764b64f6607a0ca4aa (diff) | |
download | PeerTube-f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d.tar.gz PeerTube-f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d.tar.zst PeerTube-f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d.zip |
Search video channel handle/uri
Diffstat (limited to 'server/helpers/webfinger.ts')
-rw-r--r-- | server/helpers/webfinger.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts index 5c60de10c..10fcec462 100644 --- a/server/helpers/webfinger.ts +++ b/server/helpers/webfinger.ts | |||
@@ -3,6 +3,7 @@ import { WebFingerData } from '../../shared' | |||
3 | import { ActorModel } from '../models/activitypub/actor' | 3 | import { ActorModel } from '../models/activitypub/actor' |
4 | import { isTestInstance } from './core-utils' | 4 | import { isTestInstance } from './core-utils' |
5 | import { isActivityPubUrlValid } from './custom-validators/activitypub/misc' | 5 | import { isActivityPubUrlValid } from './custom-validators/activitypub/misc' |
6 | import { CONFIG } from '../initializers' | ||
6 | 7 | ||
7 | const webfinger = new WebFinger({ | 8 | const webfinger = new WebFinger({ |
8 | webfist_fallback: false, | 9 | webfist_fallback: false, |
@@ -13,8 +14,14 @@ const webfinger = new WebFinger({ | |||
13 | 14 | ||
14 | async function loadActorUrlOrGetFromWebfinger (uri: string) { | 15 | async function loadActorUrlOrGetFromWebfinger (uri: string) { |
15 | const [ name, host ] = uri.split('@') | 16 | const [ name, host ] = uri.split('@') |
17 | let actor: ActorModel | ||
18 | |||
19 | if (host === CONFIG.WEBSERVER.HOST) { | ||
20 | actor = await ActorModel.loadLocalByName(name) | ||
21 | } else { | ||
22 | actor = await ActorModel.loadByNameAndHost(name, host) | ||
23 | } | ||
16 | 24 | ||
17 | const actor = await ActorModel.loadByNameAndHost(name, host) | ||
18 | if (actor) return actor.url | 25 | if (actor) return actor.url |
19 | 26 | ||
20 | return getUrlFromWebfinger(uri) | 27 | return getUrlFromWebfinger(uri) |