ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix video file object storage detection
Chocobozzz27bf92235fef
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.tsindex 236113ba8b..eca0f43ca3 100644--- a/client/src/app/+admin/overview/videos/video-list.component.ts+++ b/client/src/app/+admin/overview/videos/video-list.component.ts@@ -2,7 +2,8 @@ import { DatePipe, NgClass, NgFor, NgIf } from '@angular/common'import { Component, OnInit, ViewChild } from '@angular/core'import { ActivatedRoute, Router, RouterLink } from '@angular/router'import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'-import { formatICU, getAbsoluteAPIUrl } from '@app/helpers'+import { formatICU } from '@app/helpers'+import { VideoCaptionService } from '@app/shared/shared-main/video-caption/video-caption.service'import { VideoDetails } from '@app/shared/shared-main/video/video-details.model'import { VideoFileTokenService } from '@app/shared/shared-main/video/video-file-token.service'import { Video } from '@app/shared/shared-main/video/video.model'@@ -11,7 +12,7 @@ import { VideoBlockComponent } from '@app/shared/shared-moderation/video-block.cimport { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'import { getAllFiles } from '@peertube/peertube-core-utils'-import { UserRight, VideoFile, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@peertube/peertube-models'+import { FileStorage, UserRight, VideoFile, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@peertube/peertube-models'import { videoRequiresFileToken } from '@root-helpers/video'import { SharedModule, SortMeta } from 'primeng/api'import { TableModule, TableRowExpandEvent } from 'primeng/table'@@ -30,7 +31,6 @@ import {VideoActionsDropdownComponent} from '../../../shared/shared-video-miniature/video-actions-dropdown.component'import { VideoAdminService } from './video-admin.service'-import { VideoCaptionService } from '@app/shared/shared-main/video-caption/video-caption.service'@Component({selector: 'my-video-list',@@ -230,7 +230,7 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {const files = getAllFiles(video)- return files.some(f => !f.fileUrl.startsWith(getAbsoluteAPIUrl()))+ return files.some(f => f.storage === FileStorage.OBJECT_STORAGE)}canRemoveOneFile (video: Video) {diff --git a/packages/models/src/videos/file/video-file.model.ts b/packages/models/src/videos/file/video-file.model.tsindex b78fd6503d..0e5bfaac3b 100644--- a/packages/models/src/videos/file/video-file.model.ts+++ b/packages/models/src/videos/file/video-file.model.ts@@ -1,3 +1,4 @@+import { FileStorageType } from '../../common/file-storage.enum.js'import { VideoConstant } from '../video-constant.model.js'import { VideoFileMetadata } from './video-file-metadata.model.js'@@ -25,4 +26,6 @@ export interface VideoFile {hasAudio: booleanhasVideo: boolean++ storage: FileStorageType}diff --git a/packages/tests/src/shared/streaming-playlists.ts b/packages/tests/src/shared/streaming-playlists.tsindex 5597300644..edc8697270 100644--- a/packages/tests/src/shared/streaming-playlists.ts+++ b/packages/tests/src/shared/streaming-playlists.ts@@ -2,6 +2,7 @@import { getHLS, removeFragmentedMP4Ext, uuidRegex } from '@peertube/peertube-core-utils'import {+ FileStorage,HttpStatusCode,VideoDetails,VideoPrivacy,@@ -235,6 +236,12 @@ export async function completeCheckHlsPlaylist (options: {expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution)}+ if (objectStorageBaseUrl) {+ expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)+ } else {+ expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)+ }+expect(file.magnetUri).to.have.lengthOf.above(2)await checkWebTorrentWorks(file.magnetUri)diff --git a/packages/tests/src/shared/videos.ts b/packages/tests/src/shared/videos.tsindex 8e62c4eba9..f707d79547 100644--- a/packages/tests/src/shared/videos.ts+++ b/packages/tests/src/shared/videos.ts@@ -3,6 +3,7 @@import { uuidRegex } from '@peertube/peertube-core-utils'import { ffprobePromise } from '@peertube/peertube-ffmpeg'import {+ FileStorage,HttpStatusCode,HttpStatusCodeType,VideoCaption,@@ -63,6 +64,12 @@ export async function completeWebVideoFilesCheck (options: {expect(file.id).to.existexpect(file.magnetUri).to.have.lengthOf.above(2)+ if (objectStorageBaseUrl) {+ expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)+ } else {+ expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)+ }+{const privatePath = requiresAuth? 'private/'diff --git a/server/core/models/video/formatter/video-api-format.ts b/server/core/models/video/formatter/video-api-format.tsindex 0c627a13e5..e12c2b0fe3 100644--- a/server/core/models/video/formatter/video-api-format.ts+++ b/server/core/models/video/formatter/video-api-format.ts@@ -258,7 +258,9 @@ export function videoFilesModelToFormattedJSON (metadataUrl: videoFile.metadataUrl ?? getLocalVideoFileMetadataUrl(video, videoFile),hasAudio: videoFile.hasAudio(),- hasVideo: videoFile.hasVideo()+ hasVideo: videoFile.hasVideo(),++ storage: videoFile.storage}})}diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yamlindex 54f97cd49d..28ce0bb067 100644--- a/support/doc/api/openapi.yaml+++ b/support/doc/api/openapi.yaml@@ -8188,6 +8188,15 @@ components:type: stringformat: urldescription: URL dereferencing the output of ffprobe on the file+ hasAudio:+ type: boolean+ description: "**PeerTube >= 6.2** The file container has an audio stream"+ hasVideo:+ type: boolean+ description: "**PeerTube >= 6.2** The file container has a video stream"+ storage:+ $ref: '#/components/schemas/FileStorage'+VideoStreamingPlaylists:allOf:- type: object@@ -11248,6 +11257,16 @@ components:items:$ref: "#/components/schemas/VideoPassword/properties/password"uniqueItems: true++ FileStorage:+ type: integer+ enum:+ - 0+ - 1+ description: >+ The file storage type:+ - `0` File system+ - `1` Object storagecallbacks:searchIndex:'https://search.example.org/api/v1/search/videos':