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.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index 239d8291d..9f9e8fba7 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -2,11 +2,11 @@ import * as Bluebird from 'bluebird'
2import validator from 'validator' 2import validator from 'validator'
3import { ResultList } from '../../shared/models' 3import { ResultList } from '../../shared/models'
4import { Activity } from '../../shared/models/activitypub' 4import { Activity } from '../../shared/models/activitypub'
5import { ACTIVITY_PUB } from '../initializers/constants' 5import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants'
6import { signJsonLDObject } from './peertube-crypto' 6import { signJsonLDObject } from './peertube-crypto'
7import { pageToStartAndCount } from './core-utils' 7import { pageToStartAndCount } from './core-utils'
8import { parse } from 'url' 8import { parse } from 'url'
9import { MActor } from '../typings/models' 9import { MActor, MVideoAccountLight } from '../typings/models'
10 10
11function activityPubContextify <T> (data: T) { 11function activityPubContextify <T> (data: T) {
12 return Object.assign(data, { 12 return Object.assign(data, {
@@ -167,6 +167,12 @@ function checkUrlsSameHost (url1: string, url2: string) {
167 return idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase() 167 return idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase()
168} 168}
169 169
170function buildRemoteVideoBaseUrl (video: MVideoAccountLight, path: string) {
171 const host = video.VideoChannel.Account.Actor.Server.host
172
173 return REMOTE_SCHEME.HTTP + '://' + host + path
174}
175
170// --------------------------------------------------------------------------- 176// ---------------------------------------------------------------------------
171 177
172export { 178export {
@@ -174,5 +180,6 @@ export {
174 getAPId, 180 getAPId,
175 activityPubContextify, 181 activityPubContextify,
176 activityPubCollectionPagination, 182 activityPubCollectionPagination,
177 buildSignedActivity 183 buildSignedActivity,
184 buildRemoteVideoBaseUrl
178} 185}