import validator from 'validator'
import { ContextType } from '@shared/models/activitypub/context'
import { ResultList } from '../../shared/models'
-import { Activity } from '../../shared/models/activitypub'
import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants'
import { MActor, MVideoWithHost } from '../types/models'
import { pageToStartAndCount } from './core-utils'
}
-function buildSignedActivity (byActor: MActor, data: Object, contextType?: ContextType) {
+function buildSignedActivity <T> (byActor: MActor, data: T, contextType?: ContextType) {
const activity = activityPubContextify(data, contextType)
- return signJsonLDObject(byActor, activity) as Promise<Activity>
+ return signJsonLDObject(byActor, activity)
}
function getAPId (activity: string | { id: string }) {
return idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase()
}
-function buildRemoteVideoBaseUrl (video: MVideoWithHost, path: string) {
+function buildRemoteVideoBaseUrl (video: MVideoWithHost, path: string, scheme?: string) {
+ if (!scheme) scheme = REMOTE_SCHEME.HTTP
+
const host = video.VideoChannel.Actor.Server.host
- return REMOTE_SCHEME.HTTP + '://' + host + path
+ return scheme + '://' + host + path
}
// ---------------------------------------------------------------------------