From ca6d36227a9273f616a462d3aad6a721ab5dd627 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Jan 2020 11:53:38 +0100 Subject: Add url field in caption and use it for thumbnails --- server/helpers/activitypub.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'server/helpers/activitypub.ts') 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' import validator from 'validator' import { ResultList } from '../../shared/models' import { Activity } from '../../shared/models/activitypub' -import { ACTIVITY_PUB } from '../initializers/constants' +import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants' import { signJsonLDObject } from './peertube-crypto' import { pageToStartAndCount } from './core-utils' import { parse } from 'url' -import { MActor } from '../typings/models' +import { MActor, MVideoAccountLight } from '../typings/models' function activityPubContextify (data: T) { return Object.assign(data, { @@ -167,6 +167,12 @@ function checkUrlsSameHost (url1: string, url2: string) { return idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase() } +function buildRemoteVideoBaseUrl (video: MVideoAccountLight, path: string) { + const host = video.VideoChannel.Account.Actor.Server.host + + return REMOTE_SCHEME.HTTP + '://' + host + path +} + // --------------------------------------------------------------------------- export { @@ -174,5 +180,6 @@ export { getAPId, activityPubContextify, activityPubCollectionPagination, - buildSignedActivity + buildSignedActivity, + buildRemoteVideoBaseUrl } -- cgit v1.2.3