Fix video file storage attribute
This commit is contained in:
parent
27bf92235f
commit
1870626af5
|
@ -190,6 +190,8 @@ export async function completeCheckHlsPlaylist (options: {
|
|||
|
||||
for (const server of options.servers) {
|
||||
const videoDetails = await server.videos.getWithToken({ id: videoUUID })
|
||||
const isOrigin = videoDetails.account.host === server.host
|
||||
|
||||
const requiresAuth = videoDetails.privacy.id === VideoPrivacy.PRIVATE || videoDetails.privacy.id === VideoPrivacy.INTERNAL
|
||||
|
||||
const privatePath = requiresAuth
|
||||
|
@ -221,25 +223,27 @@ export async function completeCheckHlsPlaylist (options: {
|
|||
expect(file.resolution.label).to.equal('Audio only')
|
||||
expect(file.hasAudio).to.be.true
|
||||
expect(file.hasVideo).to.be.false
|
||||
|
||||
expect(file.height).to.equal(0)
|
||||
expect(file.width).to.equal(0)
|
||||
} else {
|
||||
expect(file.resolution.label).to.equal(resolution + 'p')
|
||||
|
||||
expect(file.hasVideo).to.be.true
|
||||
expect(file.hasAudio).to.equal(hasAudio && !splittedAudio)
|
||||
}
|
||||
|
||||
if (resolution === 0) {
|
||||
expect(file.height).to.equal(0)
|
||||
expect(file.width).to.equal(0)
|
||||
} else {
|
||||
expect(Math.min(file.height, file.width)).to.equal(resolution)
|
||||
expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution)
|
||||
}
|
||||
|
||||
if (objectStorageBaseUrl) {
|
||||
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
||||
if (isOrigin) {
|
||||
if (objectStorageBaseUrl) {
|
||||
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
||||
} else {
|
||||
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
||||
}
|
||||
} else {
|
||||
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
||||
expect(file.storage).to.be.null
|
||||
}
|
||||
|
||||
expect(file.magnetUri).to.have.lengthOf.above(2)
|
||||
|
|
|
@ -64,10 +64,14 @@ export async function completeWebVideoFilesCheck (options: {
|
|||
expect(file.id).to.exist
|
||||
expect(file.magnetUri).to.have.lengthOf.above(2)
|
||||
|
||||
if (objectStorageBaseUrl) {
|
||||
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
||||
if (server.internalServerNumber === originServer.internalServerNumber) {
|
||||
if (objectStorageBaseUrl) {
|
||||
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
||||
} else {
|
||||
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
||||
}
|
||||
} else {
|
||||
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
||||
expect(file.storage).to.be.null
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { getResolutionLabel } from '@peertube/peertube-core-utils'
|
||||
import {
|
||||
Video,
|
||||
VideoAdditionalAttributes,
|
||||
|
@ -25,7 +26,6 @@ import {
|
|||
import { MServer, MStreamingPlaylistRedundanciesOpt, MVideoFormattable, MVideoFormattableDetails } from '../../../types/models/index.js'
|
||||
import { MVideoFileRedundanciesOpt } from '../../../types/models/video/video-file.js'
|
||||
import { sortByResolutionDesc } from './shared/index.js'
|
||||
import { getResolutionLabel } from '@peertube/peertube-core-utils'
|
||||
|
||||
export type VideoFormattingJSONOptions = {
|
||||
completeDescription?: boolean
|
||||
|
@ -260,7 +260,9 @@ export function videoFilesModelToFormattedJSON (
|
|||
hasAudio: videoFile.hasAudio(),
|
||||
hasVideo: videoFile.hasVideo(),
|
||||
|
||||
storage: videoFile.storage
|
||||
storage: video.remote
|
||||
? null
|
||||
: videoFile.storage
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue