diff options
Diffstat (limited to 'server/helpers/activitypub.ts')
-rw-r--r-- | server/helpers/activitypub.ts | 13 |
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' | |||
2 | import validator from 'validator' | 2 | import validator from 'validator' |
3 | import { ResultList } from '../../shared/models' | 3 | import { ResultList } from '../../shared/models' |
4 | import { Activity } from '../../shared/models/activitypub' | 4 | import { Activity } from '../../shared/models/activitypub' |
5 | import { ACTIVITY_PUB } from '../initializers/constants' | 5 | import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants' |
6 | import { signJsonLDObject } from './peertube-crypto' | 6 | import { signJsonLDObject } from './peertube-crypto' |
7 | import { pageToStartAndCount } from './core-utils' | 7 | import { pageToStartAndCount } from './core-utils' |
8 | import { parse } from 'url' | 8 | import { parse } from 'url' |
9 | import { MActor } from '../typings/models' | 9 | import { MActor, MVideoAccountLight } from '../typings/models' |
10 | 10 | ||
11 | function activityPubContextify <T> (data: T) { | 11 | function 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 | ||
170 | function 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 | ||
172 | export { | 178 | export { |
@@ -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 | } |