]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/webfinger.ts
Fix caption upload on Mac OS
[github/Chocobozzz/PeerTube.git] / server / helpers / webfinger.ts
index 76444fbe305e77e2eec5efb1650fdaa9636efd40..688bf2bab8106ed1f2983e4f511799e5d062d2d3 100644 (file)
@@ -2,7 +2,7 @@ import * as WebFinger from 'webfinger.js'
 import { WebFingerData } from '../../shared'
 import { ActorModel } from '../models/activitypub/actor'
 import { isTestInstance } from './core-utils'
-import { isActivityPubUrlValid } from './custom-validators/activitypub'
+import { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
 
 const webfinger = new WebFinger({
   webfist_fallback: false,
@@ -15,6 +15,10 @@ async function loadActorUrlOrGetFromWebfinger (name: string, host: string) {
   const actor = await ActorModel.loadByNameAndHost(name, host)
   if (actor) return actor.url
 
+  return getUrlFromWebfinger(name, host)
+}
+
+async function getUrlFromWebfinger (name: string, host: string) {
   const webfingerData: WebFingerData = await webfingerLookup(name + '@' + host)
   return getLinkOrThrow(webfingerData)
 }
@@ -22,6 +26,7 @@ async function loadActorUrlOrGetFromWebfinger (name: string, host: string) {
 // ---------------------------------------------------------------------------
 
 export {
+  getUrlFromWebfinger,
   loadActorUrlOrGetFromWebfinger
 }