Update videos api list for account
This commit is contained in:
parent
416c359cb5
commit
b64c950a1c
|
@ -1,10 +1,10 @@
|
||||||
import { Account } from '@app/shared/account/account.model'
|
import { Account } from '@app/shared/account/account.model'
|
||||||
import { User } from '../'
|
import { User } from '../'
|
||||||
import { Video as VideoServerModel } from '../../../../../shared'
|
import { Video as VideoServerModel } from '../../../../../shared'
|
||||||
|
import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
|
||||||
import { getAbsoluteAPIUrl } from '../misc/utils'
|
import { getAbsoluteAPIUrl } from '../misc/utils'
|
||||||
|
|
||||||
export class Video implements VideoServerModel {
|
export class Video implements VideoServerModel {
|
||||||
accountName: string
|
|
||||||
by: string
|
by: string
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
updatedAt: Date
|
updatedAt: Date
|
||||||
|
@ -32,7 +32,14 @@ export class Video implements VideoServerModel {
|
||||||
likes: number
|
likes: number
|
||||||
dislikes: number
|
dislikes: number
|
||||||
nsfw: boolean
|
nsfw: boolean
|
||||||
account: Account
|
|
||||||
|
account: {
|
||||||
|
name: string
|
||||||
|
displayName: string
|
||||||
|
url: string
|
||||||
|
host: string
|
||||||
|
avatar: Avatar
|
||||||
|
}
|
||||||
|
|
||||||
private static createDurationString (duration: number) {
|
private static createDurationString (duration: number) {
|
||||||
const minutes = Math.floor(duration / 60)
|
const minutes = Math.floor(duration / 60)
|
||||||
|
@ -46,7 +53,6 @@ export class Video implements VideoServerModel {
|
||||||
constructor (hash: VideoServerModel) {
|
constructor (hash: VideoServerModel) {
|
||||||
const absoluteAPIUrl = getAbsoluteAPIUrl()
|
const absoluteAPIUrl = getAbsoluteAPIUrl()
|
||||||
|
|
||||||
this.accountName = hash.accountName
|
|
||||||
this.createdAt = new Date(hash.createdAt.toString())
|
this.createdAt = new Date(hash.createdAt.toString())
|
||||||
this.categoryLabel = hash.categoryLabel
|
this.categoryLabel = hash.categoryLabel
|
||||||
this.category = hash.category
|
this.category = hash.category
|
||||||
|
@ -61,7 +67,6 @@ export class Video implements VideoServerModel {
|
||||||
this.uuid = hash.uuid
|
this.uuid = hash.uuid
|
||||||
this.isLocal = hash.isLocal
|
this.isLocal = hash.isLocal
|
||||||
this.name = hash.name
|
this.name = hash.name
|
||||||
this.serverHost = hash.serverHost
|
|
||||||
this.thumbnailPath = hash.thumbnailPath
|
this.thumbnailPath = hash.thumbnailPath
|
||||||
this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath
|
this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath
|
||||||
this.previewPath = hash.previewPath
|
this.previewPath = hash.previewPath
|
||||||
|
@ -72,8 +77,9 @@ export class Video implements VideoServerModel {
|
||||||
this.likes = hash.likes
|
this.likes = hash.likes
|
||||||
this.dislikes = hash.dislikes
|
this.dislikes = hash.dislikes
|
||||||
this.nsfw = hash.nsfw
|
this.nsfw = hash.nsfw
|
||||||
|
this.account = hash.account
|
||||||
|
|
||||||
this.by = Account.CREATE_BY_STRING(hash.accountName, hash.serverHost)
|
this.by = Account.CREATE_BY_STRING(hash.account.name, hash.account.host)
|
||||||
}
|
}
|
||||||
|
|
||||||
isVideoNSFWForUser (user: User) {
|
isVideoNSFWForUser (user: User) {
|
||||||
|
|
|
@ -40,7 +40,8 @@ import {
|
||||||
isVideoLanguageValid,
|
isVideoLanguageValid,
|
||||||
isVideoLicenceValid,
|
isVideoLicenceValid,
|
||||||
isVideoNameValid,
|
isVideoNameValid,
|
||||||
isVideoPrivacyValid, isVideoSupportValid
|
isVideoPrivacyValid,
|
||||||
|
isVideoSupportValid
|
||||||
} from '../../helpers/custom-validators/videos'
|
} from '../../helpers/custom-validators/videos'
|
||||||
import { generateImageFromVideoFile, getVideoFileResolution, transcode } from '../../helpers/ffmpeg-utils'
|
import { generateImageFromVideoFile, getVideoFileResolution, transcode } from '../../helpers/ffmpeg-utils'
|
||||||
import { logger } from '../../helpers/logger'
|
import { logger } from '../../helpers/logger'
|
||||||
|
@ -125,13 +126,18 @@ enum ScopeNames {
|
||||||
required: true,
|
required: true,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
attributes: [ 'serverId' ],
|
attributes: [ 'preferredUsername', 'url', 'serverId' ],
|
||||||
model: ActorModel.unscoped(),
|
model: ActorModel.unscoped(),
|
||||||
required: true,
|
required: true,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
attributes: [ 'host' ],
|
attributes: [ 'host' ],
|
||||||
model: ServerModel.unscoped()
|
model: ServerModel.unscoped(),
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
model: AvatarModel.unscoped(),
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -872,14 +878,7 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
toFormattedJSON (): Video {
|
toFormattedJSON (): Video {
|
||||||
let serverHost
|
const formattedAccount = this.VideoChannel.Account.toFormattedJSON()
|
||||||
|
|
||||||
if (this.VideoChannel.Account.Actor.Server) {
|
|
||||||
serverHost = this.VideoChannel.Account.Actor.Server.host
|
|
||||||
} else {
|
|
||||||
// It means it's our video
|
|
||||||
serverHost = CONFIG.WEBSERVER.HOST
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
|
@ -893,9 +892,7 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
languageLabel: this.getLanguageLabel(),
|
languageLabel: this.getLanguageLabel(),
|
||||||
nsfw: this.nsfw,
|
nsfw: this.nsfw,
|
||||||
description: this.getTruncatedDescription(),
|
description: this.getTruncatedDescription(),
|
||||||
serverHost,
|
|
||||||
isLocal: this.isOwned(),
|
isLocal: this.isOwned(),
|
||||||
accountName: this.VideoChannel.Account.name,
|
|
||||||
duration: this.duration,
|
duration: this.duration,
|
||||||
views: this.views,
|
views: this.views,
|
||||||
likes: this.likes,
|
likes: this.likes,
|
||||||
|
@ -904,7 +901,14 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
previewPath: this.getPreviewPath(),
|
previewPath: this.getPreviewPath(),
|
||||||
embedPath: this.getEmbedPath(),
|
embedPath: this.getEmbedPath(),
|
||||||
createdAt: this.createdAt,
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,8 +281,10 @@ describe('Test follows', function () {
|
||||||
nsfw: true,
|
nsfw: true,
|
||||||
description: 'my super description',
|
description: 'my super description',
|
||||||
support: 'my super support text',
|
support: 'my super support text',
|
||||||
host: 'localhost:9003',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9003'
|
||||||
|
},
|
||||||
isLocal,
|
isLocal,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
|
|
|
@ -53,8 +53,10 @@ describe('Test handle downs', function () {
|
||||||
nsfw: true,
|
nsfw: true,
|
||||||
description: 'my super description for server 1',
|
description: 'my super description for server 1',
|
||||||
support: 'my super support text for server 1',
|
support: 'my super support text for server 1',
|
||||||
host: 'localhost:9001',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9001'
|
||||||
|
},
|
||||||
isLocal: false,
|
isLocal: false,
|
||||||
duration: 10,
|
duration: 10,
|
||||||
tags: [ 'tag1p1', 'tag2p1' ],
|
tags: [ 'tag1p1', 'tag2p1' ],
|
||||||
|
|
|
@ -94,7 +94,7 @@ describe('Test users', function () {
|
||||||
const res = await getVideosList(server.url)
|
const res = await getVideosList(server.url)
|
||||||
const video = res.body.data[ 0 ]
|
const video = res.body.data[ 0 ]
|
||||||
|
|
||||||
expect(video.accountName).to.equal('root')
|
expect(video.account.name).to.equal('root')
|
||||||
videoId = video.id
|
videoId = video.id
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ describe('Test users', function () {
|
||||||
expect(res.body.total).to.equal(1)
|
expect(res.body.total).to.equal(1)
|
||||||
|
|
||||||
const video = res.body.data[ 0 ]
|
const video = res.body.data[ 0 ]
|
||||||
expect(video.accountName).to.equal('root')
|
expect(video.account.name).to.equal('root')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should register a new user', async function () {
|
it('Should register a new user', async function () {
|
||||||
|
|
|
@ -8,13 +8,35 @@ import { VideoPrivacy } from '../../../../shared/models/videos'
|
||||||
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addVideoChannel, checkVideoFilesWereRemoved, completeVideoCheck, createUser, dateIsValid, doubleFollow, flushAndRunMultipleServers,
|
addVideoChannel,
|
||||||
flushTests, getVideo,
|
checkVideoFilesWereRemoved,
|
||||||
getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testImage,
|
completeVideoCheck,
|
||||||
updateVideo, uploadVideo, userLogin, viewVideo, wait, webtorrentAdd
|
createUser,
|
||||||
|
dateIsValid,
|
||||||
|
doubleFollow,
|
||||||
|
flushAndRunMultipleServers,
|
||||||
|
flushTests,
|
||||||
|
getVideo,
|
||||||
|
getVideoChannelsList,
|
||||||
|
getVideosList,
|
||||||
|
killallServers,
|
||||||
|
rateVideo,
|
||||||
|
removeVideo,
|
||||||
|
ServerInfo,
|
||||||
|
setAccessTokensToServers,
|
||||||
|
testImage,
|
||||||
|
updateVideo,
|
||||||
|
uploadVideo,
|
||||||
|
userLogin,
|
||||||
|
viewVideo,
|
||||||
|
wait,
|
||||||
|
webtorrentAdd
|
||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
import {
|
import {
|
||||||
addVideoCommentReply, addVideoCommentThread, deleteVideoComment, getVideoCommentThreads,
|
addVideoCommentReply,
|
||||||
|
addVideoCommentThread,
|
||||||
|
deleteVideoComment,
|
||||||
|
getVideoCommentThreads,
|
||||||
getVideoThreadComments
|
getVideoThreadComments
|
||||||
} from '../../utils/videos/video-comments'
|
} from '../../utils/videos/video-comments'
|
||||||
|
|
||||||
|
@ -90,8 +112,10 @@ describe('Test multiple servers', function () {
|
||||||
nsfw: true,
|
nsfw: true,
|
||||||
description: 'my super description for server 1',
|
description: 'my super description for server 1',
|
||||||
support: 'my super support text for server 1',
|
support: 'my super support text for server 1',
|
||||||
host: 'localhost:9001',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9001'
|
||||||
|
},
|
||||||
isLocal,
|
isLocal,
|
||||||
duration: 10,
|
duration: 10,
|
||||||
tags: [ 'tag1p1', 'tag2p1' ],
|
tags: [ 'tag1p1', 'tag2p1' ],
|
||||||
|
@ -160,8 +184,10 @@ describe('Test multiple servers', function () {
|
||||||
nsfw: true,
|
nsfw: true,
|
||||||
description: 'my super description for server 2',
|
description: 'my super description for server 2',
|
||||||
support: 'my super support text for server 2',
|
support: 'my super support text for server 2',
|
||||||
host: 'localhost:9002',
|
account: {
|
||||||
account: 'user1',
|
name: 'user1',
|
||||||
|
host: 'localhost:9002'
|
||||||
|
},
|
||||||
isLocal,
|
isLocal,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
|
@ -264,8 +290,10 @@ describe('Test multiple servers', function () {
|
||||||
nsfw: true,
|
nsfw: true,
|
||||||
description: 'my super description for server 3',
|
description: 'my super description for server 3',
|
||||||
support: 'my super support text for server 3',
|
support: 'my super support text for server 3',
|
||||||
host: 'localhost:9003',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9003'
|
||||||
|
},
|
||||||
isLocal,
|
isLocal,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
|
@ -294,8 +322,10 @@ describe('Test multiple servers', function () {
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
description: 'my super description for server 3-2',
|
description: 'my super description for server 3-2',
|
||||||
support: 'my super support text for server 3-2',
|
support: 'my super support text for server 3-2',
|
||||||
host: 'localhost:9003',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9003'
|
||||||
|
},
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
isLocal,
|
isLocal,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
|
@ -570,8 +600,10 @@ describe('Test multiple servers', function () {
|
||||||
nsfw: true,
|
nsfw: true,
|
||||||
description: 'my super description updated',
|
description: 'my super description updated',
|
||||||
support: 'my super support text updated',
|
support: 'my super support text updated',
|
||||||
host: 'localhost:9003',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9003'
|
||||||
|
},
|
||||||
isLocal,
|
isLocal,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
|
@ -648,7 +680,10 @@ describe('Test multiple servers', function () {
|
||||||
expect(baseVideo.licence).to.equal(video.licence)
|
expect(baseVideo.licence).to.equal(video.licence)
|
||||||
expect(baseVideo.category).to.equal(video.category)
|
expect(baseVideo.category).to.equal(video.category)
|
||||||
expect(baseVideo.nsfw).to.equal(video.nsfw)
|
expect(baseVideo.nsfw).to.equal(video.nsfw)
|
||||||
expect(baseVideo.accountName).to.equal(video.accountName)
|
expect(baseVideo.account.name).to.equal(video.account.name)
|
||||||
|
expect(baseVideo.account.displayName).to.equal(video.account.displayName)
|
||||||
|
expect(baseVideo.account.url).to.equal(video.account.url)
|
||||||
|
expect(baseVideo.account.host).to.equal(video.account.host)
|
||||||
expect(baseVideo.tags).to.deep.equal(video.tags)
|
expect(baseVideo.tags).to.deep.equal(video.tags)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -859,8 +894,10 @@ describe('Test multiple servers', function () {
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
description: null,
|
description: null,
|
||||||
support: null,
|
support: null,
|
||||||
host: 'localhost:9002',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9002'
|
||||||
|
},
|
||||||
isLocal,
|
isLocal,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe('Test services', function () {
|
||||||
|
|
||||||
expect(res.body.html).to.equal(expectedHtml)
|
expect(res.body.html).to.equal(expectedHtml)
|
||||||
expect(res.body.title).to.equal(server.video.name)
|
expect(res.body.title).to.equal(server.video.name)
|
||||||
expect(res.body.author_name).to.equal(server.video.accountName)
|
expect(res.body.author_name).to.equal(server.video.account.name)
|
||||||
expect(res.body.width).to.equal(560)
|
expect(res.body.width).to.equal(560)
|
||||||
expect(res.body.height).to.equal(315)
|
expect(res.body.height).to.equal(315)
|
||||||
expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl)
|
expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl)
|
||||||
|
@ -58,7 +58,7 @@ describe('Test services', function () {
|
||||||
|
|
||||||
expect(res.body.html).to.equal(expectedHtml)
|
expect(res.body.html).to.equal(expectedHtml)
|
||||||
expect(res.body.title).to.equal(server.video.name)
|
expect(res.body.title).to.equal(server.video.name)
|
||||||
expect(res.body.author_name).to.equal(server.video.accountName)
|
expect(res.body.author_name).to.equal(server.video.account.name)
|
||||||
expect(res.body.height).to.equal(50)
|
expect(res.body.height).to.equal(50)
|
||||||
expect(res.body.width).to.equal(50)
|
expect(res.body.width).to.equal(50)
|
||||||
expect(res.body).to.not.have.property('thumbnail_url')
|
expect(res.body).to.not.have.property('thumbnail_url')
|
||||||
|
|
|
@ -27,8 +27,10 @@ describe('Test a single server', function () {
|
||||||
nsfw: true,
|
nsfw: true,
|
||||||
description: 'my super description',
|
description: 'my super description',
|
||||||
support: 'my super support text',
|
support: 'my super support text',
|
||||||
host: 'localhost:9001',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9001'
|
||||||
|
},
|
||||||
isLocal: true,
|
isLocal: true,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
tags: [ 'tag1', 'tag2', 'tag3' ],
|
tags: [ 'tag1', 'tag2', 'tag3' ],
|
||||||
|
@ -56,8 +58,10 @@ describe('Test a single server', function () {
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
description: 'my super description updated',
|
description: 'my super description updated',
|
||||||
support: 'my super support text updated',
|
support: 'my super support text updated',
|
||||||
host: 'localhost:9001',
|
account: {
|
||||||
account: 'root',
|
name: 'root',
|
||||||
|
host: 'localhost:9001'
|
||||||
|
},
|
||||||
isLocal: true,
|
isLocal: true,
|
||||||
tags: [ 'tagup1', 'tagup2' ],
|
tags: [ 'tagup1', 'tagup2' ],
|
||||||
privacy: VideoPrivacy.PUBLIC,
|
privacy: VideoPrivacy.PUBLIC,
|
||||||
|
@ -204,32 +208,6 @@ describe('Test a single server', function () {
|
||||||
await completeVideoCheck(server.url, video, getCheckAttributes)
|
await completeVideoCheck(server.url, video, getCheckAttributes)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Not implemented yet
|
|
||||||
// it('Should search the video by serverHost', async function () {
|
|
||||||
// const res = await videosUtils.searchVideo(server.url, '9001', 'host')
|
|
||||||
|
|
||||||
// expect(res.body.total).to.equal(1)
|
|
||||||
// expect(res.body.data).to.be.an('array')
|
|
||||||
// expect(res.body.data.length).to.equal(1)
|
|
||||||
|
|
||||||
// const video = res.body.data[0]
|
|
||||||
// expect(video.name).to.equal('my super name')
|
|
||||||
// expect(video.description).to.equal('my super description')
|
|
||||||
// expect(video.serverHost).to.equal('localhost:9001')
|
|
||||||
// expect(video.author).to.equal('root')
|
|
||||||
// expect(video.isLocal).to.be.true
|
|
||||||
// expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
|
|
||||||
// expect(dateIsValid(video.createdAt)).to.be.true
|
|
||||||
// expect(dateIsValid(video.updatedAt)).to.be.true
|
|
||||||
|
|
||||||
// const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
|
|
||||||
// expect(test).to.equal(true)
|
|
||||||
|
|
||||||
// done()
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
// Not implemented yet
|
// Not implemented yet
|
||||||
// it('Should search the video by tag', async function () {
|
// it('Should search the video by tag', async function () {
|
||||||
// const res = await searchVideo(server.url, 'tag1')
|
// const res = await searchVideo(server.url, 'tag1')
|
||||||
|
@ -248,8 +226,8 @@ describe('Test a single server', function () {
|
||||||
// expect(video.languageLabel).to.equal('Mandarin')
|
// expect(video.languageLabel).to.equal('Mandarin')
|
||||||
// expect(video.nsfw).to.be.ok
|
// expect(video.nsfw).to.be.ok
|
||||||
// expect(video.description).to.equal('my super description')
|
// expect(video.description).to.equal('my super description')
|
||||||
// expect(video.serverHost).to.equal('localhost:9001')
|
// expect(video.account.name).to.equal('root')
|
||||||
// expect(video.accountName).to.equal('root')
|
// expect(video.account.host).to.equal('localhost:9001')
|
||||||
// expect(video.isLocal).to.be.true
|
// expect(video.isLocal).to.be.true
|
||||||
// expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
|
// expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
|
||||||
// expect(dateIsValid(video.createdAt)).to.be.true
|
// expect(dateIsValid(video.createdAt)).to.be.true
|
||||||
|
|
|
@ -24,7 +24,9 @@ interface ServerInfo {
|
||||||
id: number
|
id: number
|
||||||
uuid: string
|
uuid: string
|
||||||
name: string
|
name: string
|
||||||
accountName: string
|
account: {
|
||||||
|
name: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteVideo?: {
|
remoteVideo?: {
|
||||||
|
|
|
@ -368,8 +368,10 @@ async function completeVideoCheck (
|
||||||
commentsEnabled: boolean
|
commentsEnabled: boolean
|
||||||
description: string
|
description: string
|
||||||
support: string
|
support: string
|
||||||
|
account: {
|
||||||
|
name: string
|
||||||
host: string
|
host: string
|
||||||
account: string
|
}
|
||||||
isLocal: boolean,
|
isLocal: boolean,
|
||||||
tags: string[],
|
tags: string[],
|
||||||
privacy: number,
|
privacy: number,
|
||||||
|
@ -402,8 +404,8 @@ async function completeVideoCheck (
|
||||||
expect(video.languageLabel).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown')
|
expect(video.languageLabel).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown')
|
||||||
expect(video.nsfw).to.equal(attributes.nsfw)
|
expect(video.nsfw).to.equal(attributes.nsfw)
|
||||||
expect(video.description).to.equal(attributes.description)
|
expect(video.description).to.equal(attributes.description)
|
||||||
expect(video.serverHost).to.equal(attributes.host)
|
expect(video.account.host).to.equal(attributes.account.host)
|
||||||
expect(video.accountName).to.equal(attributes.account)
|
expect(video.account.name).to.equal(attributes.account.name)
|
||||||
expect(video.likes).to.equal(attributes.likes)
|
expect(video.likes).to.equal(attributes.likes)
|
||||||
expect(video.dislikes).to.equal(attributes.dislikes)
|
expect(video.dislikes).to.equal(attributes.dislikes)
|
||||||
expect(video.isLocal).to.equal(attributes.isLocal)
|
expect(video.isLocal).to.equal(attributes.isLocal)
|
||||||
|
@ -433,12 +435,12 @@ async function completeVideoCheck (
|
||||||
|
|
||||||
let extension = extname(attributes.fixture)
|
let extension = extname(attributes.fixture)
|
||||||
// Transcoding enabled on server 2, extension will always be .mp4
|
// Transcoding enabled on server 2, extension will always be .mp4
|
||||||
if (attributes.host === 'localhost:9002') extension = '.mp4'
|
if (attributes.account.host === 'localhost:9002') extension = '.mp4'
|
||||||
|
|
||||||
const magnetUri = file.magnetUri
|
const magnetUri = file.magnetUri
|
||||||
expect(file.magnetUri).to.have.lengthOf.above(2)
|
expect(file.magnetUri).to.have.lengthOf.above(2)
|
||||||
expect(file.torrentUrl).to.equal(`http://${attributes.host}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
|
expect(file.torrentUrl).to.equal(`http://${attributes.account.host}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
|
||||||
expect(file.fileUrl).to.equal(`http://${attributes.host}/static/webseed/${videoDetails.uuid}-${file.resolution}${extension}`)
|
expect(file.fileUrl).to.equal(`http://${attributes.account.host}/static/webseed/${videoDetails.uuid}-${file.resolution}${extension}`)
|
||||||
expect(file.resolution).to.equal(attributeFile.resolution)
|
expect(file.resolution).to.equal(attributeFile.resolution)
|
||||||
expect(file.resolutionLabel).to.equal(attributeFile.resolution + 'p')
|
expect(file.resolutionLabel).to.equal(attributeFile.resolution + 'p')
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Account } from '../actors'
|
import { Account } from '../actors'
|
||||||
|
import { Avatar } from '../avatars/avatar.model'
|
||||||
import { VideoChannel } from './video-channel.model'
|
import { VideoChannel } from './video-channel.model'
|
||||||
import { VideoPrivacy } from './video-privacy.enum'
|
import { VideoPrivacy } from './video-privacy.enum'
|
||||||
|
|
||||||
|
@ -14,7 +15,6 @@ export interface VideoFile {
|
||||||
export interface Video {
|
export interface Video {
|
||||||
id: number
|
id: number
|
||||||
uuid: string
|
uuid: string
|
||||||
accountName: string
|
|
||||||
createdAt: Date | string
|
createdAt: Date | string
|
||||||
updatedAt: Date | string
|
updatedAt: Date | string
|
||||||
categoryLabel: string
|
categoryLabel: string
|
||||||
|
@ -27,7 +27,6 @@ export interface Video {
|
||||||
duration: number
|
duration: number
|
||||||
isLocal: boolean
|
isLocal: boolean
|
||||||
name: string
|
name: string
|
||||||
serverHost: string
|
|
||||||
thumbnailPath: string
|
thumbnailPath: string
|
||||||
previewPath: string
|
previewPath: string
|
||||||
embedPath: string
|
embedPath: string
|
||||||
|
@ -35,6 +34,14 @@ export interface Video {
|
||||||
likes: number
|
likes: number
|
||||||
dislikes: number
|
dislikes: number
|
||||||
nsfw: boolean
|
nsfw: boolean
|
||||||
|
|
||||||
|
account: {
|
||||||
|
name: string
|
||||||
|
displayName: string
|
||||||
|
url: string
|
||||||
|
host: string
|
||||||
|
avatar: Avatar
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VideoDetails extends Video {
|
export interface VideoDetails extends Video {
|
||||||
|
|
|
@ -1043,8 +1043,6 @@ definitions:
|
||||||
type: number
|
type: number
|
||||||
uuid:
|
uuid:
|
||||||
type: string
|
type: string
|
||||||
accountName:
|
|
||||||
type: string
|
|
||||||
createdAt:
|
createdAt:
|
||||||
type: string
|
type: string
|
||||||
updatedAt:
|
updatedAt:
|
||||||
|
@ -1069,8 +1067,6 @@ definitions:
|
||||||
type: boolean
|
type: boolean
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
serverHost:
|
|
||||||
type: string
|
|
||||||
thumbnailPath:
|
thumbnailPath:
|
||||||
type: string
|
type: string
|
||||||
previewPath:
|
previewPath:
|
||||||
|
@ -1085,6 +1081,13 @@ definitions:
|
||||||
type: number
|
type: number
|
||||||
nsfw:
|
nsfw:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
account:
|
||||||
|
name: string
|
||||||
|
displayName: string
|
||||||
|
url: string
|
||||||
|
host: string
|
||||||
|
avatar:
|
||||||
|
$ref: "#/definitions/Avatar"
|
||||||
VideoAbuse:
|
VideoAbuse:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=PeerTube daemon
|
Description=PeerTube daemon
|
||||||
After=network.target
|
After=network.target postgresql.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
|
Loading…
Reference in New Issue