]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/webfinger.ts
Tests for totalRepliesFromVideoAuthor
[github/Chocobozzz/PeerTube.git] / server / helpers / webfinger.ts
index 156376943dafee006e73d8ff5d97dfd34681814c..5443a266b0087de6587659cdb30b493b1b6efa9b 100644 (file)
@@ -3,7 +3,8 @@ 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'
+import { WEBSERVER } from '../initializers/constants'
+import { MActorFull } from '../typings/models'
 
 const webfinger = new WebFinger({
   webfist_fallback: false,
@@ -17,9 +18,9 @@ async function loadActorUrlOrGetFromWebfinger (uriArg: string) {
   const uri = uriArg.startsWith('@') ? uriArg.slice(1) : uriArg
 
   const [ name, host ] = uri.split('@')
-  let actor: ActorModel
+  let actor: MActorFull
 
-  if (host === CONFIG.WEBSERVER.HOST) {
+  if (!host || host === WEBSERVER.HOST) {
     actor = await ActorModel.loadLocalByName(name)
   } else {
     actor = await ActorModel.loadByNameAndHost(name, host)