getVideoLikesActivityPubUrl,
getVideoSharesActivityPubUrl
} from '../../lib/activitypub'
+import { isArray } from '../../helpers/custom-validators/misc'
export type VideoFormattingJSONOptions = {
+ completeDescription?: boolean
additionalAttributes: {
state?: boolean,
waitTranscoding?: boolean,
const formattedAccount = video.VideoChannel.Account.toFormattedJSON()
const formattedVideoChannel = video.VideoChannel.toFormattedJSON()
+ const userHistory = isArray(video.UserVideoHistories) ? video.UserVideoHistories[0] : undefined
+
const videoObject: Video = {
id: video.id,
uuid: video.uuid,
label: VideoModel.getPrivacyLabel(video.privacy)
},
nsfw: video.nsfw,
- description: video.getTruncatedDescription(),
+ description: options && options.completeDescription === true ? video.description : video.getTruncatedDescription(),
isLocal: video.isOwned(),
duration: video.duration,
views: video.views,
url: formattedVideoChannel.url,
host: formattedVideoChannel.host,
avatar: formattedVideoChannel.avatar
- }
+ },
+
+ userHistory: userHistory ? {
+ currentTime: userHistory.currentTime
+ } : undefined
}
if (options) {
}
})
+ const tags = video.Tags ? video.Tags.map(t => t.name) : []
const detailsJson = {
support: video.support,
- descriptionPath: video.getDescriptionPath(),
+ descriptionPath: video.getDescriptionAPIPath(),
channel: video.VideoChannel.toFormattedJSON(),
account: video.VideoChannel.Account.toFormattedJSON(),
- tags: video.Tags.map(t => t.name),
+ tags,
commentsEnabled: video.commentsEnabled,
waitTranscoding: video.waitTranscoding,
state: {