diff options
Diffstat (limited to 'server/helpers')
-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) |