aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/webfinger.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-24 11:04:02 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 09:41:54 +0200
commitf5b0af50c85e2f8b6b2b054ac1f47123cacbe08d (patch)
tree1b2f8a578b2d35138ac326d65674a9c9d740e8c9 /server/helpers/webfinger.ts
parentaa55a4da422330fe2816f1764b64f6607a0ca4aa (diff)
downloadPeerTube-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.ts9
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'
3import { ActorModel } from '../models/activitypub/actor' 3import { ActorModel } from '../models/activitypub/actor'
4import { isTestInstance } from './core-utils' 4import { isTestInstance } from './core-utils'
5import { isActivityPubUrlValid } from './custom-validators/activitypub/misc' 5import { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
6import { CONFIG } from '../initializers'
6 7
7const webfinger = new WebFinger({ 8const webfinger = new WebFinger({
8 webfist_fallback: false, 9 webfist_fallback: false,
@@ -13,8 +14,14 @@ const webfinger = new WebFinger({
13 14
14async function loadActorUrlOrGetFromWebfinger (uri: string) { 15async 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)