Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

685 B
Raw Blame
import { ActivityPubActorType } from '@peertube/peertube-models'
import { WEBSERVER } from '@server/initializers/constants.js'

export function handleToNameAndHost (handle: string) {
  let [ name, host ] = handle.split('@')
  if (host === WEBSERVER.HOST) host = null

  return { name, host, handle }
}

export function handlesToNameAndHost (handles: string[]) {
  return handles.map(h => handleToNameAndHost(h))
}

const accountType = new Set([ 'Person', 'Application', 'Service', 'Organization' ])
export function isAccountActor (type: ActivityPubActorType) {
  return accountType.has(type)
}

export function isChannelActor (type: ActivityPubActorType) {
  return type === 'Group'
}