diff --git a/packages/tests/src/shared/streaming-playlists.ts b/packages/tests/src/shared/streaming-playlists.ts index edc869727..35229db86 100644 --- a/packages/tests/src/shared/streaming-playlists.ts +++ b/packages/tests/src/shared/streaming-playlists.ts @@ -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) diff --git a/packages/tests/src/shared/videos.ts b/packages/tests/src/shared/videos.ts index f707d7954..723e169bd 100644 --- a/packages/tests/src/shared/videos.ts +++ b/packages/tests/src/shared/videos.ts @@ -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 } { diff --git a/server/core/models/video/formatter/video-api-format.ts b/server/core/models/video/formatter/video-api-format.ts index e12c2b0fe..b95b7565e 100644 --- a/server/core/models/video/formatter/video-api-format.ts +++ b/server/core/models/video/formatter/video-api-format.ts @@ -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 } }) }