diff options
Diffstat (limited to 'server/helpers/activitypub.ts')
-rw-r--r-- | server/helpers/activitypub.ts | 11 |
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' | |||
3 | import * as Sequelize from 'sequelize' | 3 | import * as Sequelize from 'sequelize' |
4 | import * as url from 'url' | 4 | import * as url from 'url' |
5 | import { ActivityIconObject } from '../../shared/index' | 5 | import { ActivityIconObject } from '../../shared/index' |
6 | import { Activity } from '../../shared/models/activitypub/activity' | ||
6 | import { ActivityPubActor } from '../../shared/models/activitypub/activitypub-actor' | 7 | import { ActivityPubActor } from '../../shared/models/activitypub/activitypub-actor' |
7 | import { VideoChannelObject } from '../../shared/models/activitypub/objects/video-channel-object' | 8 | import { VideoChannelObject } from '../../shared/models/activitypub/objects/video-channel-object' |
8 | import { ResultList } from '../../shared/models/result-list.model' | 9 | import { ResultList } from '../../shared/models/result-list.model' |
@@ -17,6 +18,7 @@ import { VideoInstance } from '../models/video/video-interface' | |||
17 | import { isRemoteAccountValid } from './custom-validators' | 18 | import { isRemoteAccountValid } from './custom-validators' |
18 | import { isVideoChannelObjectValid } from './custom-validators/activitypub/videos' | 19 | import { isVideoChannelObjectValid } from './custom-validators/activitypub/videos' |
19 | import { logger } from './logger' | 20 | import { logger } from './logger' |
21 | import { signObject } from './peertube-crypto' | ||
20 | import { doRequest, doRequestAndSaveToFile } from './requests' | 22 | import { doRequest, doRequestAndSaveToFile } from './requests' |
21 | import { getServerAccount } from './utils' | 23 | import { 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 | ||
244 | function 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 | ||
244 | export { | 252 | export { |
@@ -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 | // --------------------------------------------------------------------------- |