Add downloadingEnabled property to video model
authorLucas Declercq <lucas.declercq@ineat-conseil.fr>
Sat, 6 Oct 2018 17:17:21 +0000 (19:17 +0200)
committerLucas Declercq <lucas.declercq@ineat-conseil.fr>
Sat, 6 Oct 2018 17:17:39 +0000 (19:17 +0200)
34 files changed:
client/src/app/shared/video-import/video-import.service.ts
client/src/app/shared/video/video-details.model.ts
client/src/app/shared/video/video-edit.model.ts
client/src/app/shared/video/video.service.ts
client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts
client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts
client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts
client/src/app/videos/+video-watch/video-watch.component.html
client/src/app/videos/+video-watch/video-watch.component.ts
server/controllers/api/videos/import.ts
server/controllers/api/videos/index.ts
server/helpers/activitypub.ts
server/helpers/audit-logger.ts
server/helpers/custom-validators/activitypub/videos.ts
server/initializers/migrations/0280-video-downloading-enabled.ts [new file with mode: 0644]
server/lib/activitypub/videos.ts
server/middlewares/validators/videos/videos.ts
server/models/video/video-format-utils.ts
server/models/video/video.ts
server/tests/api/check-params/video-imports.ts
server/tests/api/check-params/videos.ts
server/tests/api/server/follows.ts
server/tests/api/server/handle-down.ts
server/tests/api/videos/multiple-servers.ts
server/tests/api/videos/single-server.ts
server/tests/utils/videos/videos.ts
server/tools/peertube-import-videos.ts
server/tools/peertube-upload.ts
shared/models/activitypub/objects/video-torrent-object.ts
shared/models/videos/video-create.model.ts
shared/models/videos/video-update.model.ts
shared/models/videos/video.model.ts
support/doc/api/openapi.yaml
support/doc/api/videos.yaml

index 7ae66ddfcdf23a447e1fcb3ab982cda5039b57c7..74c458645a5f152b946d24c18eba5b256aad2bc9 100644 (file)
@@ -81,6 +81,7 @@ export class VideoImportService {
       nsfw: video.nsfw,
       waitTranscoding: video.waitTranscoding,
       commentsEnabled: video.commentsEnabled,
+      downloadingEnabled: video.downloadingEnabled,
       thumbnailfile: video.thumbnailfile,
       previewfile: video.previewfile,
       scheduleUpdate
index fa4ca7f9391014a7729dbcbfe6c05a2fc902ab58..ad85641dcd63c5dbddef6fc80c5e6e61cbdd6665 100644 (file)
@@ -12,6 +12,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
   files: VideoFile[]
   account: Account
   commentsEnabled: boolean
+  downloadingEnabled: boolean
 
   waitTranscoding: boolean
   state: VideoConstant<VideoState>
@@ -29,6 +30,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
     this.tags = hash.tags
     this.support = hash.support
     this.commentsEnabled = hash.commentsEnabled
+    this.downloadingEnabled = hash.downloadingEnabled
 
     this.buildLikeAndDislikePercents()
   }
index 0046be96455c08abf1478e1a899643f7750534ed..47703ff798b2cda015ccff1d19bf64ad559c600e 100644 (file)
@@ -14,6 +14,7 @@ export class VideoEdit implements VideoUpdate {
   tags: string[]
   nsfw: boolean
   commentsEnabled: boolean
+  downloadingEnabled: boolean
   waitTranscoding: boolean
   channelId: number
   privacy: VideoPrivacy
@@ -26,7 +27,7 @@ export class VideoEdit implements VideoUpdate {
   id?: number
   scheduleUpdate?: VideoScheduleUpdate
 
-  constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
+  constructor (video?: Video & { tags: string[], commentsEnabled: boolean, downloadingEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
     if (video) {
       this.id = video.id
       this.uuid = video.uuid
@@ -38,6 +39,7 @@ export class VideoEdit implements VideoUpdate {
       this.tags = video.tags
       this.nsfw = video.nsfw
       this.commentsEnabled = video.commentsEnabled
+      this.downloadingEnabled = video.downloadingEnabled
       this.waitTranscoding = video.waitTranscoding
       this.channelId = video.channel.id
       this.privacy = video.privacy.id
@@ -80,6 +82,7 @@ export class VideoEdit implements VideoUpdate {
       tags: this.tags,
       nsfw: this.nsfw,
       commentsEnabled: this.commentsEnabled,
+      downloadingEnabled: this.downloadingEnabled,
       waitTranscoding: this.waitTranscoding,
       channelId: this.channelId,
       privacy: this.privacy
index 724a0bde94505cb10140b27921d13ac9d4ebad9f..c0339dd39d806cca4efc1a402a9eec881c93db3b 100644 (file)
@@ -95,6 +95,7 @@ export class VideoService implements VideosProvider {
       nsfw: video.nsfw,
       waitTranscoding: video.waitTranscoding,
       commentsEnabled: video.commentsEnabled,
+      downloadingEnabled: video.downloadingEnabled,
       thumbnailfile: video.thumbnailfile,
       previewfile: video.previewfile,
       scheduleUpdate
index 0f7184ff8e82616750fbf6d18dd6eabd5efd2e10..57cf0e395639202b245cf41c849c4b2047602098 100644 (file)
@@ -77,6 +77,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
       privacy: this.firstStepPrivacyId,
       waitTranscoding: false,
       commentsEnabled: true,
+      downloadingEnabled: true,
       channelId: this.firstStepChannelId
     }
 
@@ -91,6 +92,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
 
         this.video = new VideoEdit(Object.assign(res.video, {
           commentsEnabled: videoUpdate.commentsEnabled,
+          downloadingEnabled: videoUpdate.downloadingEnabled,
           support: null,
           thumbnailUrl: null,
           previewUrl: null
index 031e557ed688b8dd6bb80c569ec19266a2a86d6e..11db4a7ef42a73e12344c22f69cef3445c25be64 100644 (file)
@@ -69,6 +69,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
       privacy: this.firstStepPrivacyId,
       waitTranscoding: false,
       commentsEnabled: true,
+      downloadingEnabled: true,
       channelId: this.firstStepChannelId
     }
 
@@ -83,6 +84,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
 
         this.video = new VideoEdit(Object.assign(res.video, {
           commentsEnabled: videoUpdate.commentsEnabled,
+          downloadingEnabled: videoUpdate.downloadingEnabled,
           support: null,
           thumbnailUrl: null,
           previewUrl: null
index 941dc5441edac3f2dc56f3e6773ddb6a809eb314..53f72f4e6ee9038d467fa92e05dcae3d76f3089d 100644 (file)
@@ -159,6 +159,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     const nsfw = false
     const waitTranscoding = true
     const commentsEnabled = true
+    const downloadingEnabled = true
     const channelId = this.firstStepChannelId.toString()
 
     const formData = new FormData()
@@ -167,6 +168,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     formData.append('privacy', VideoPrivacy.PRIVATE.toString())
     formData.append('nsfw', '' + nsfw)
     formData.append('commentsEnabled', '' + commentsEnabled)
+    formData.append('downloadingEnabled', '' + downloadingEnabled)
     formData.append('waitTranscoding', '' + waitTranscoding)
     formData.append('channelId', '' + channelId)
     formData.append('videofile', videofile)
index 770785d023da9f19d98ed6f9bc5a0bc4063c3d76..ba04d638f6a1f34649ab4b279f55bbcec7fa16d0 100644 (file)
@@ -80,7 +80,7 @@
                     </div>
 
                     <div ngbDropdownMenu>
-                      <a class="dropdown-item" i18n-title title="Download the video" href="#" (click)="showDownloadModal($event)">
+                      <a *ngIf="isVideoDownloadable()" class="dropdown-item" i18n-title title="Download the video" href="#" (click)="showDownloadModal($event)">
                         <span class="icon icon-download"></span> <ng-container i18n>Download</ng-container>
                       </a>
 
index c5deddf050272affacdef1bdb69789994bc6e010..7cc831ab15c7ed0802790c14bd887f61f12c66a1 100644 (file)
@@ -313,6 +313,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     return this.video && this.video.state.id === VideoState.TO_TRANSCODE
   }
 
+  isVideoDownloadable () {
+    return this.video && this.video.downloadingEnabled
+  }
+
   isVideoToImport () {
     return this.video && this.video.state.id === VideoState.TO_IMPORT
   }
index 398fd5a7f68e9379a0cfb1f6091ed38d2e3dabda..a5cddba896b28ebe8f342c36ed9a2f04cadef71f 100644 (file)
@@ -171,6 +171,7 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You
     licence: body.licence || importData.licence,
     language: body.language || undefined,
     commentsEnabled: body.commentsEnabled || true,
+    downloadingEnabled: body.downloadingEnabled || true,
     waitTranscoding: body.waitTranscoding || false,
     state: VideoState.TO_IMPORT,
     nsfw: body.nsfw || importData.nsfw || false,
index 6a73e13d00c64da1b16ad5c77baefb6fad89e543..ec25006e86b8409a2d11e9c3fb4b5650573196ed 100644 (file)
@@ -179,6 +179,7 @@ async function addVideo (req: express.Request, res: express.Response) {
     licence: videoInfo.licence,
     language: videoInfo.language,
     commentsEnabled: videoInfo.commentsEnabled || false,
+    downloadingEnabled: videoInfo.downloadingEnabled || false,
     waitTranscoding: videoInfo.waitTranscoding || false,
     state: CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED,
     nsfw: videoInfo.nsfw || false,
@@ -322,6 +323,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
       if (videoInfoToUpdate.support !== undefined) videoInstance.set('support', videoInfoToUpdate.support)
       if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description)
       if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled)
+      if (videoInfoToUpdate.downloadingEnabled !== undefined) videoInstance.set('downloadingEnabled', videoInfoToUpdate.downloadingEnabled)
       if (videoInfoToUpdate.privacy !== undefined) {
         const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10)
         videoInstance.set('privacy', newPrivacy)
index 1304c7559d0c4b302bebebfc9731696826d18161..7f903e4866574b75e79b29c0bd470258718f398f 100644 (file)
@@ -28,6 +28,7 @@ function activityPubContextify <T> (data: T) {
         size: 'schema:Number',
         fps: 'schema:Number',
         commentsEnabled: 'schema:Boolean',
+        downloadingEnabled: 'schema:Boolean',
         waitTranscoding: 'schema:Boolean',
         expires: 'schema:expires',
         support: 'schema:Text',
index 00311fce13dbf7b6a5b0a81e15cd487932845ae6..d2c9aee0188277cce5c3cb392452943f9bad9686 100644 (file)
@@ -117,7 +117,8 @@ const videoKeysToKeep = [
   'channel-uuid',
   'channel-name',
   'support',
-  'commentsEnabled'
+  'commentsEnabled',
+  'downloadingEnabled'
 ]
 class VideoAuditView extends EntityAuditView {
   constructor (private video: VideoDetails) {
index f88d265610f5e9620c83d0bb7e67051414c351d9..34e4cdff9e0e1691d1c3859a4bfaebeebd06ed06 100644 (file)
@@ -67,6 +67,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) {
     isVideoViewsValid(video.views) &&
     isBooleanValid(video.sensitive) &&
     isBooleanValid(video.commentsEnabled) &&
+    isBooleanValid(video.downloadingEnabled) &&
     isDateValid(video.published) &&
     isDateValid(video.updated) &&
     (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) &&
diff --git a/server/initializers/migrations/0280-video-downloading-enabled.ts b/server/initializers/migrations/0280-video-downloading-enabled.ts
new file mode 100644 (file)
index 0000000..c070010
--- /dev/null
@@ -0,0 +1,27 @@
+import * as Sequelize from 'sequelize'
+import { Migration } from '../../models/migrations'
+
+async function up (utils: {
+  transaction: Sequelize.Transaction,
+  queryInterface: Sequelize.QueryInterface,
+  sequelize: Sequelize.Sequelize
+}): Promise<void> {
+  const data = {
+    type: Sequelize.BOOLEAN,
+    allowNull: false,
+    defaultValue: true
+  } as Migration.Boolean
+  await utils.queryInterface.addColumn('video', 'downloadingEnabled', data)
+
+  data.defaultValue = null
+  return utils.queryInterface.changeColumn('video', 'downloadingEnabled', data)
+}
+
+function down (options) {
+  throw new Error('Not implemented.')
+}
+
+export {
+  up,
+  down
+}
index 54cea542f37b9e29aa69c287ffe54f0ed6c1ef77..dd02141eeac07f96eb0d5526e7cfbcadb6f44ad8 100644 (file)
@@ -230,6 +230,7 @@ async function updateVideoFromAP (options: {
       options.video.set('support', videoData.support)
       options.video.set('nsfw', videoData.nsfw)
       options.video.set('commentsEnabled', videoData.commentsEnabled)
+      options.video.set('downloadingEnabled', videoData.downloadingEnabled)
       options.video.set('waitTranscoding', videoData.waitTranscoding)
       options.video.set('state', videoData.state)
       options.video.set('duration', videoData.duration)
@@ -441,6 +442,7 @@ async function videoActivityObjectToDBAttributes (
     support,
     nsfw: videoObject.sensitive,
     commentsEnabled: videoObject.commentsEnabled,
+    downloadingEnabled: videoObject.downloadingEnabled,
     waitTranscoding: videoObject.waitTranscoding,
     state: videoObject.state,
     channelId: videoChannel.id,
index d6b8aa7253932261ac5be5585b52dd2282cf8445..bdba87496d79c3f42d696a3962d506c11a458400 100644 (file)
@@ -349,6 +349,10 @@ function getCommonVideoAttributes () {
       .optional()
       .toBoolean()
       .custom(isBooleanValid).withMessage('Should have comments enabled boolean'),
+    body('downloadingEnabled')
+      .optional()
+      .toBoolean()
+      .custom(isBooleanValid).withMessage('Should have downloading enabled boolean'),
 
     body('scheduleUpdate')
       .optional()
index 905e8444997e8306d07773213960491ad9b41261..0b0da41810c7b09c32588a0965bc7f063237085e 100644 (file)
@@ -128,6 +128,7 @@ function videoModelToFormattedDetailsJSON (video: VideoModel): VideoDetails {
     account: video.VideoChannel.Account.toFormattedJSON(),
     tags,
     commentsEnabled: video.commentsEnabled,
+    downloadingEnabled: video.downloadingEnabled,
     waitTranscoding: video.waitTranscoding,
     state: {
       id: video.state,
@@ -259,6 +260,7 @@ function videoModelToActivityPubObject (video: VideoModel): VideoTorrentObject {
     waitTranscoding: video.waitTranscoding,
     state: video.state,
     commentsEnabled: video.commentsEnabled,
+    downloadingEnabled: video.downloadingEnabled,
     published: video.publishedAt.toISOString(),
     updated: video.updatedAt.toISOString(),
     mediaType: 'text/markdown',
index 46d823240526ee7daddce7e371057070f07f397f..a2fe53fb90bec9f78e407d192f3a468ee7eddfdf 100644 (file)
@@ -598,6 +598,10 @@ export class VideoModel extends Model<VideoModel> {
   @Column
   commentsEnabled: boolean
 
+  @AllowNull(false)
+  @Column
+  downloadingEnabled: boolean
+
   @AllowNull(false)
   @Column
   waitTranscoding: boolean
index 44645b0e2531a9e9b0c5e6f0b966b38c81644290..8dd87b8aec303f723eb5f28d66e3ea769a7ea4b3 100644 (file)
@@ -84,6 +84,7 @@ describe('Test video imports API validator', function () {
         language: 'pt',
         nsfw: false,
         commentsEnabled: true,
+        downloadingEnabled: true,
         waitTranscoding: true,
         description: 'my super description',
         support: 'my super support text',
index 904d2287090b12dc3859c4779541d99b1d3ce80a..c5740087cb552aeb81c2d7487a838cd4f8b81f2e 100644 (file)
@@ -175,6 +175,7 @@ describe('Test videos API validator', function () {
         language: 'pt',
         nsfw: false,
         commentsEnabled: true,
+        downloadingEnabled: true,
         waitTranscoding: true,
         description: 'my super description',
         support: 'my super support text',
@@ -419,6 +420,7 @@ describe('Test videos API validator', function () {
       language: 'pt',
       nsfw: false,
       commentsEnabled: false,
+      downloadingEnabled: false,
       description: 'my super description',
       privacy: VideoPrivacy.PUBLIC,
       tags: [ 'tag1', 'tag2' ]
index 310c291bf946e0f4e5015347ea470f68ce4c99bc..5cad1d09deaed2dae8766249616ef151a39f394d 100644 (file)
@@ -305,6 +305,7 @@ describe('Test follows', function () {
         },
         isLocal,
         commentsEnabled: true,
+        downloadingEnabled: true,
         duration: 5,
         tags: [ 'tag1', 'tag2', 'tag3' ],
         privacy: VideoPrivacy.PUBLIC,
index ed15c8090659ec0cc095e781bcefdfd17556b229..971de4607538b566ad4a8010c02ef7bccbb55003 100644 (file)
@@ -70,6 +70,7 @@ describe('Test handle downs', function () {
     tags: [ 'tag1p1', 'tag2p1' ],
     privacy: VideoPrivacy.PUBLIC,
     commentsEnabled: true,
+    downloadingEnabled: true,
     channel: {
       name: 'root_channel',
       displayName: 'Main root channel',
index 4553ee8553a1084072486122ec009e005a71bc4d..83e391ccdae6403b652122ba03155965c80141bc 100644 (file)
@@ -127,6 +127,7 @@ describe('Test multiple servers', function () {
           tags: [ 'tag1p1', 'tag2p1' ],
           privacy: VideoPrivacy.PUBLIC,
           commentsEnabled: true,
+          downloadingEnabled: true,
           channel: {
             displayName: 'my channel',
             name: 'super_channel_name',
@@ -198,6 +199,7 @@ describe('Test multiple servers', function () {
           },
           isLocal,
           commentsEnabled: true,
+          downloadingEnabled: true,
           duration: 5,
           tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
           privacy: VideoPrivacy.PUBLIC,
@@ -306,6 +308,7 @@ describe('Test multiple servers', function () {
           isLocal,
           duration: 5,
           commentsEnabled: true,
+          downloadingEnabled: true,
           tags: [ 'tag1p3' ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
@@ -337,6 +340,7 @@ describe('Test multiple servers', function () {
             host: 'localhost:9003'
           },
           commentsEnabled: true,
+          downloadingEnabled: true,
           isLocal,
           duration: 5,
           tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
@@ -654,6 +658,7 @@ describe('Test multiple servers', function () {
           isLocal,
           duration: 5,
           commentsEnabled: true,
+          downloadingEnabled: true,
           tags: [ 'tag_up_1', 'tag_up_2' ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
@@ -975,6 +980,7 @@ describe('Test multiple servers', function () {
           isLocal,
           duration: 5,
           commentsEnabled: false,
+          downloadingEnabled: false,
           tags: [ ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
index e3d62b7a0df4c1dfa41ccf40f47557c514624256..8995a85257d20c73c072e44a1c0f57b13633c83a 100644 (file)
@@ -55,6 +55,7 @@ describe('Test a single server', function () {
     tags: [ 'tag1', 'tag2', 'tag3' ],
     privacy: VideoPrivacy.PUBLIC,
     commentsEnabled: true,
+    downloadingEnabled: true,
     channel: {
       displayName: 'Main root channel',
       name: 'root_channel',
@@ -87,6 +88,7 @@ describe('Test a single server', function () {
     privacy: VideoPrivacy.PUBLIC,
     duration: 5,
     commentsEnabled: false,
+    downloadingEnabled: false,
     channel: {
       name: 'root_channel',
       displayName: 'Main root channel',
@@ -356,6 +358,7 @@ describe('Test a single server', function () {
       nsfw: false,
       description: 'my super description updated',
       commentsEnabled: false,
+      downloadingEnabled: false,
       tags: [ 'tagup1', 'tagup2' ]
     }
     await updateVideo(server.url, server.accessToken, videoId, attributes)
index 87c385f3877f87109c23e21f187a87fc0c793b4a..a7fd4c8a60b140a625ce52afa881aebb131281cb 100644 (file)
@@ -27,6 +27,7 @@ type VideoAttributes = {
   language?: string
   nsfw?: boolean
   commentsEnabled?: boolean
+  downloadingEnabled?: boolean
   waitTranscoding?: boolean
   description?: string
   tags?: string[]
@@ -310,6 +311,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
     tags: [ 'tag' ],
     privacy: VideoPrivacy.PUBLIC,
     commentsEnabled: true,
+    downloadingEnabled: true,
     fixture: 'video_short.webm'
   }, videoAttributesArg)
 
@@ -320,6 +322,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
               .field('name', attributes.name)
               .field('nsfw', JSON.stringify(attributes.nsfw))
               .field('commentsEnabled', JSON.stringify(attributes.commentsEnabled))
+              .field('downloadingEnabled', JSON.stringify(attributes.downloadingEnabled))
               .field('waitTranscoding', JSON.stringify(attributes.waitTranscoding))
               .field('privacy', attributes.privacy.toString())
               .field('channelId', attributes.channelId)
@@ -370,6 +373,7 @@ function updateVideo (url: string, accessToken: string, id: number | string, att
   if (attributes.language) body['language'] = attributes.language
   if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw)
   if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled)
+  if (attributes.downloadingEnabled !== undefined) body['downloadingEnabled'] = JSON.stringify(attributes.downloadingEnabled)
   if (attributes.description) body['description'] = attributes.description
   if (attributes.tags) body['tags'] = attributes.tags
   if (attributes.privacy) body['privacy'] = attributes.privacy
@@ -435,6 +439,7 @@ async function completeVideoCheck (
     language: string
     nsfw: boolean
     commentsEnabled: boolean
+    downloadingEnabled: boolean
     description: string
     publishedAt?: string
     support: string
@@ -509,6 +514,7 @@ async function completeVideoCheck (
   expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true
   expect(dateIsValid(videoDetails.channel.updatedAt.toString())).to.be.true
   expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
+  expect(videoDetails.downloadingEnabled).to.equal(attributes.downloadingEnabled)
 
   for (const attributeFile of attributes.files) {
     const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution)
index 13090a028fe3af8324d402470d7e68f2bc621408..675c621dfdc93b834b9c19b7fbf396039ca74158 100644 (file)
@@ -212,6 +212,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st
     nsfw: isNSFW(videoInfo),
     waitTranscoding: true,
     commentsEnabled: true,
+    downloadingEnabled: true,
     description: videoInfo.description || undefined,
     support: undefined,
     tags,
index 6248fb47d648f6cc1519f9892080991582e8b363..e7b885a3887c150de1de9cc9e0255ecd0ba6d779 100644 (file)
@@ -30,6 +30,7 @@ if (!program['tags']) program['tags'] = []
 if (!program['nsfw']) program['nsfw'] = false
 if (!program['privacy']) program['privacy'] = VideoPrivacy.PUBLIC
 if (!program['commentsEnabled']) program['commentsEnabled'] = false
+if (!program['downloadingEnabled']) program['downloadingEnabled'] = false
 
 getSettings()
   .then(settings => {
@@ -116,6 +117,7 @@ async function run () {
     description: program['videoDescription'],
     tags: program['tags'],
     commentsEnabled: program['commentsEnabled'],
+    downloadingEnabled: program['downloadingEnabled'],
     fixture: program['file'],
     thumbnailfile: program['thumbnail'],
     previewfile: program['preview'],
index 8504c178fa0d50eed5e52345d3db86c66d34c6f3..beb2f519ec9ce7123af553572dc9700018e85313 100644 (file)
@@ -20,7 +20,8 @@ export interface VideoTorrentObject {
   subtitleLanguage: ActivityIdentifierObject[]
   views: number
   sensitive: boolean
-  commentsEnabled: boolean
+  commentsEnabled: boolean,
+  downloadingEnabled: boolean,
   waitTranscoding: boolean
   state: VideoState
   published: string
index 190d637832719d744d45f8430b47584134ec1686..6e5e03e0a03d4d37374f39296940cea92a5a47dd 100644 (file)
@@ -13,6 +13,7 @@ export interface VideoCreate {
   name: string
   tags?: string[]
   commentsEnabled?: boolean
+  downloadingEnabled?: boolean
   privacy: VideoPrivacy
   scheduleUpdate?: VideoScheduleUpdate
 }
index ed141a824f6959e169ac2ba9c573e1f60da68b66..bf7a9af37a6436b489680b3b3508025416d5d398 100644 (file)
@@ -11,6 +11,7 @@ export interface VideoUpdate {
   privacy?: VideoPrivacy
   tags?: string[]
   commentsEnabled?: boolean
+  downloadingEnabled?: boolean
   nsfw?: boolean
   waitTranscoding?: boolean
   channelId?: number
index 4a9fa58b109792a7b4b57958a0a2eb04d3d538c8..783cd86e5b41e6cd92bbe3deb056242d198896a9 100644 (file)
@@ -82,6 +82,7 @@ export interface VideoDetails extends Video {
   files: VideoFile[]
   account: Account
   commentsEnabled: boolean
+  downloadingEnabled: boolean
 
   // Not optional in details (unlike in Video)
   waitTranscoding: boolean
index 59ca8b29a9305f16a8fe3af1fd50fac86c05fff9..9ce24c0ed7df733dd84603a43e4748c4efafe099 100644 (file)
@@ -536,6 +536,7 @@ paths:
         - $ref: "videos.yaml#/parameters/name"
         - $ref: "videos.yaml#/parameters/tags"
         - $ref: "videos.yaml#/parameters/commentsEnabled"
+        - $ref: "videos.yaml#/parameters/downloadingEnabled"
         - $ref: "videos.yaml#/parameters/privacy"
         - $ref: "videos.yaml#/parameters/scheduleUpdate"
       responses:
@@ -632,6 +633,7 @@ paths:
         - $ref: "videos.yaml#/parameters/name"
         - $ref: "videos.yaml#/parameters/tags"
         - $ref: "videos.yaml#/parameters/commentsEnabled"
+        - $ref: "videos.yaml#/parameters/downloadingEnabled"
         - $ref: "videos.yaml#/parameters/privacy"
         - $ref: "videos.yaml#/parameters/scheduleUpdate"
       responses:
index 593ae56e2172901229a9c7c6117b9c74e0f3e8d0..93aa262854fe76166c4507cc3d249acf36d0b3d7 100644 (file)
@@ -65,6 +65,11 @@ parameters:
     in: formData
     type: boolean
     description: 'Enable or disable comments for this video'
+  downloadingEnabled:
+    name: downloadingEnabled
+    in: formData
+    type: boolean
+    description: 'Enable or disable downloading for this video'
   privacy:
     name: privacy
     in: formData