From f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 24 Aug 2018 11:04:02 +0200 Subject: Search video channel handle/uri --- server/helpers/webfinger.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/helpers') 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' import { ActorModel } from '../models/activitypub/actor' import { isTestInstance } from './core-utils' import { isActivityPubUrlValid } from './custom-validators/activitypub/misc' +import { CONFIG } from '../initializers' const webfinger = new WebFinger({ webfist_fallback: false, @@ -13,8 +14,14 @@ const webfinger = new WebFinger({ async function loadActorUrlOrGetFromWebfinger (uri: string) { const [ name, host ] = uri.split('@') + let actor: ActorModel + + if (host === CONFIG.WEBSERVER.HOST) { + actor = await ActorModel.loadLocalByName(name) + } else { + actor = await ActorModel.loadByNameAndHost(name, host) + } - const actor = await ActorModel.loadByNameAndHost(name, host) if (actor) return actor.url return getUrlFromWebfinger(uri) -- cgit v1.2.3