aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/webfinger.ts
diff options
context:
space:
mode:
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)