isVideoLanguageValid,
isVideoLicenceValid,
isVideoNameValid,
- isVideoPrivacyValid, isVideoSupportValid
+ isVideoPrivacyValid,
+ isVideoSupportValid
} from '../../helpers/custom-validators/videos'
import { generateImageFromVideoFile, getVideoFileResolution, transcode } from '../../helpers/ffmpeg-utils'
import { logger } from '../../helpers/logger'
required: true,
include: [
{
- attributes: [ 'serverId' ],
+ attributes: [ 'preferredUsername', 'url', 'serverId' ],
model: ActorModel.unscoped(),
required: true,
include: [
{
attributes: [ 'host' ],
- model: ServerModel.unscoped()
+ model: ServerModel.unscoped(),
+ required: false
+ },
+ {
+ model: AvatarModel.unscoped(),
+ required: false
}
]
}
}
toFormattedJSON (): Video {
- let serverHost
-
- if (this.VideoChannel.Account.Actor.Server) {
- serverHost = this.VideoChannel.Account.Actor.Server.host
- } else {
- // It means it's our video
- serverHost = CONFIG.WEBSERVER.HOST
- }
+ const formattedAccount = this.VideoChannel.Account.toFormattedJSON()
return {
id: this.id,
languageLabel: this.getLanguageLabel(),
nsfw: this.nsfw,
description: this.getTruncatedDescription(),
- serverHost,
isLocal: this.isOwned(),
- accountName: this.VideoChannel.Account.name,
duration: this.duration,
views: this.views,
likes: this.likes,
previewPath: this.getPreviewPath(),
embedPath: this.getEmbedPath(),
createdAt: this.createdAt,
- updatedAt: this.updatedAt
+ updatedAt: this.updatedAt,
+ account: {
+ name: formattedAccount.name,
+ displayName: formattedAccount.displayName,
+ url: formattedAccount.url,
+ host: formattedAccount.host,
+ avatar: formattedAccount.avatar
+ }
}
}