diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-22 18:40:33 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-22 18:40:56 +0100 |
commit | 6be84cbcea99518e8eca58c76259effd0dd992fd (patch) | |
tree | c2b4b22c8b60528025b172013d72c12f8ba06192 /server/helpers/activitypub.ts | |
parent | 9e841674da612b68bf84a427a8710a44347083f5 (diff) | |
download | PeerTube-6be84cbcea99518e8eca58c76259effd0dd992fd.tar.gz PeerTube-6be84cbcea99518e8eca58c76259effd0dd992fd.tar.zst PeerTube-6be84cbcea99518e8eca58c76259effd0dd992fd.zip |
Improve activity pub actors implementation
Diffstat (limited to 'server/helpers/activitypub.ts')
-rw-r--r-- | server/helpers/activitypub.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index d64a6dd78..1934fa0f0 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { ResultList } from '../../shared/models' | 1 | import { ResultList } from '../../shared/models' |
2 | import { Activity } from '../../shared/models/activitypub' | 2 | import { Activity, ActivityPubActor } from '../../shared/models/activitypub' |
3 | import { ACTIVITY_PUB } from '../initializers' | 3 | import { ACTIVITY_PUB } from '../initializers' |
4 | import { ActorModel } from '../models/activitypub/actor' | 4 | import { ActorModel } from '../models/activitypub/actor' |
5 | import { signObject } from './peertube-crypto' | 5 | import { signObject } from './peertube-crypto' |
@@ -98,9 +98,16 @@ function buildSignedActivity (byActor: ActorModel, data: Object) { | |||
98 | return signObject(byActor, activity) as Promise<Activity> | 98 | return signObject(byActor, activity) as Promise<Activity> |
99 | } | 99 | } |
100 | 100 | ||
101 | function getActorUrl (activityActor: string | ActivityPubActor) { | ||
102 | if (typeof activityActor === 'string') return activityActor | ||
103 | |||
104 | return activityActor.id | ||
105 | } | ||
106 | |||
101 | // --------------------------------------------------------------------------- | 107 | // --------------------------------------------------------------------------- |
102 | 108 | ||
103 | export { | 109 | export { |
110 | getActorUrl, | ||
104 | activityPubContextify, | 111 | activityPubContextify, |
105 | activityPubCollectionPagination, | 112 | activityPubCollectionPagination, |
106 | activityPubCollection, | 113 | activityPubCollection, |