ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actors.ts 685 B

12345678910111213141516171819202122
  1. import { ActivityPubActorType } from '@peertube/peertube-models'
  2. import { WEBSERVER } from '@server/initializers/constants.js'
  3. export function handleToNameAndHost (handle: string) {
  4. let [ name, host ] = handle.split('@')
  5. if (host === WEBSERVER.HOST) host = null
  6. return { name, host, handle }
  7. }
  8. export function handlesToNameAndHost (handles: string[]) {
  9. return handles.map(h => handleToNameAndHost(h))
  10. }
  11. const accountType = new Set([ 'Person', 'Application', 'Service', 'Organization' ])
  12. export function isAccountActor (type: ActivityPubActorType) {
  13. return accountType.has(type)
  14. }
  15. export function isChannelActor (type: ActivityPubActorType) {
  16. return type === 'Group'
  17. }