aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/activitypub.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/activitypub.ts')
-rw-r--r--server/helpers/activitypub.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index c710117cd..338698652 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -3,6 +3,7 @@ import * as request from 'request'
3import * as Sequelize from 'sequelize' 3import * as Sequelize from 'sequelize'
4import * as url from 'url' 4import * as url from 'url'
5import { ActivityIconObject } from '../../shared/index' 5import { ActivityIconObject } from '../../shared/index'
6import { Activity } from '../../shared/models/activitypub/activity'
6import { ActivityPubActor } from '../../shared/models/activitypub/activitypub-actor' 7import { ActivityPubActor } from '../../shared/models/activitypub/activitypub-actor'
7import { VideoChannelObject } from '../../shared/models/activitypub/objects/video-channel-object' 8import { VideoChannelObject } from '../../shared/models/activitypub/objects/video-channel-object'
8import { ResultList } from '../../shared/models/result-list.model' 9import { ResultList } from '../../shared/models/result-list.model'
@@ -17,6 +18,7 @@ import { VideoInstance } from '../models/video/video-interface'
17import { isRemoteAccountValid } from './custom-validators' 18import { isRemoteAccountValid } from './custom-validators'
18import { isVideoChannelObjectValid } from './custom-validators/activitypub/videos' 19import { isVideoChannelObjectValid } from './custom-validators/activitypub/videos'
19import { logger } from './logger' 20import { logger } from './logger'
21import { signObject } from './peertube-crypto'
20import { doRequest, doRequestAndSaveToFile } from './requests' 22import { doRequest, doRequestAndSaveToFile } from './requests'
21import { getServerAccount } from './utils' 23import { getServerAccount } from './utils'
22 24
@@ -239,6 +241,12 @@ function activityPubCollectionPagination (url: string, page: number, result: Res
239 return activityPubContextify(obj) 241 return activityPubContextify(obj)
240} 242}
241 243
244function buildSignedActivity (byAccount: AccountInstance, data: Object) {
245 const activity = activityPubContextify(data)
246
247 return signObject(byAccount, activity) as Promise<Activity>
248}
249
242// --------------------------------------------------------------------------- 250// ---------------------------------------------------------------------------
243 251
244export { 252export {
@@ -252,7 +260,8 @@ export {
252 fetchRemoteVideoDescription, 260 fetchRemoteVideoDescription,
253 shareVideoChannelByServer, 261 shareVideoChannelByServer,
254 shareVideoByServer, 262 shareVideoByServer,
255 getOrCreateVideoChannel 263 getOrCreateVideoChannel,
264 buildSignedActivity
256} 265}
257 266
258// --------------------------------------------------------------------------- 267// ---------------------------------------------------------------------------