X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Ffollow.ts;h=741b54df51be336ab0c988bd72d6d3dfcab4f23d;hb=1da843eeac58ccad4fd5bc68606551004d7dbb7a;hp=c1bd667e04e1def55d048eeca0b5cf4b5aa16a5f;hpb=eae0365b5c5468e51e9795b0e894815ebda86b4a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/follow.ts b/server/lib/activitypub/follow.ts index c1bd667e0..741b54df5 100644 --- a/server/lib/activitypub/follow.ts +++ b/server/lib/activitypub/follow.ts @@ -31,6 +31,21 @@ async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors, transact } } +// If we only have an host, use a default account handle +function getRemoteNameAndHost (handleOrHost: string) { + let name = SERVER_ACTOR_NAME + let host = handleOrHost + + const splitted = handleOrHost.split('@') + if (splitted.length === 2) { + name = splitted[0] + host = splitted[1] + } + + return { name, host } +} + export { - autoFollowBackIfNeeded + autoFollowBackIfNeeded, + getRemoteNameAndHost }