diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/videos/import.ts | 1 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 2 | ||||
-rw-r--r-- | server/helpers/activitypub.ts | 1 | ||||
-rw-r--r-- | server/helpers/audit-logger.ts | 3 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0280-video-downloading-enabled.ts | 27 | ||||
-rw-r--r-- | server/lib/activitypub/videos.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/videos/videos.ts | 4 | ||||
-rw-r--r-- | server/models/video/video-format-utils.ts | 2 | ||||
-rw-r--r-- | server/models/video/video.ts | 4 | ||||
-rw-r--r-- | server/tests/api/check-params/video-imports.ts | 1 | ||||
-rw-r--r-- | server/tests/api/check-params/videos.ts | 2 | ||||
-rw-r--r-- | server/tests/api/server/follows.ts | 1 | ||||
-rw-r--r-- | server/tests/api/server/handle-down.ts | 1 | ||||
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 12 | ||||
-rw-r--r-- | server/tests/api/videos/single-server.ts | 3 | ||||
-rw-r--r-- | server/tools/peertube-import-videos.ts | 1 | ||||
-rw-r--r-- | server/tools/peertube-upload.ts | 2 |
18 files changed, 68 insertions, 3 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 98366cd82..7053d5253 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -164,6 +164,7 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You | |||
164 | licence: body.licence || importData.licence, | 164 | licence: body.licence || importData.licence, |
165 | language: body.language || undefined, | 165 | language: body.language || undefined, |
166 | commentsEnabled: body.commentsEnabled || true, | 166 | commentsEnabled: body.commentsEnabled || true, |
167 | downloadEnabled: body.downloadEnabled || true, | ||
167 | waitTranscoding: body.waitTranscoding || false, | 168 | waitTranscoding: body.waitTranscoding || false, |
168 | state: VideoState.TO_IMPORT, | 169 | state: VideoState.TO_IMPORT, |
169 | nsfw: body.nsfw || importData.nsfw || false, | 170 | nsfw: body.nsfw || importData.nsfw || false, |
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 3b1c2d255..76a318d13 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -182,6 +182,7 @@ async function addVideo (req: express.Request, res: express.Response) { | |||
182 | licence: videoInfo.licence, | 182 | licence: videoInfo.licence, |
183 | language: videoInfo.language, | 183 | language: videoInfo.language, |
184 | commentsEnabled: videoInfo.commentsEnabled || false, | 184 | commentsEnabled: videoInfo.commentsEnabled || false, |
185 | downloadEnabled: videoInfo.downloadEnabled || true, | ||
185 | waitTranscoding: videoInfo.waitTranscoding || false, | 186 | waitTranscoding: videoInfo.waitTranscoding || false, |
186 | state: CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED, | 187 | state: CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED, |
187 | nsfw: videoInfo.nsfw || false, | 188 | nsfw: videoInfo.nsfw || false, |
@@ -326,6 +327,7 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
326 | if (videoInfoToUpdate.support !== undefined) videoInstance.set('support', videoInfoToUpdate.support) | 327 | if (videoInfoToUpdate.support !== undefined) videoInstance.set('support', videoInfoToUpdate.support) |
327 | if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description) | 328 | if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description) |
328 | if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled) | 329 | if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled) |
330 | if (videoInfoToUpdate.downloadEnabled !== undefined) videoInstance.set('downloadEnabled', videoInfoToUpdate.downloadEnabled) | ||
329 | if (videoInfoToUpdate.privacy !== undefined) { | 331 | if (videoInfoToUpdate.privacy !== undefined) { |
330 | const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10) | 332 | const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10) |
331 | videoInstance.set('privacy', newPrivacy) | 333 | videoInstance.set('privacy', newPrivacy) |
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index eba552524..62d78373e 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts | |||
@@ -29,6 +29,7 @@ function activityPubContextify <T> (data: T) { | |||
29 | size: 'sc:Number', | 29 | size: 'sc:Number', |
30 | fps: 'sc:Number', | 30 | fps: 'sc:Number', |
31 | commentsEnabled: 'sc:Boolean', | 31 | commentsEnabled: 'sc:Boolean', |
32 | downloadEnabled: 'sc:Boolean', | ||
32 | waitTranscoding: 'sc:Boolean', | 33 | waitTranscoding: 'sc:Boolean', |
33 | expires: 'sc:expires', | 34 | expires: 'sc:expires', |
34 | support: 'sc:Text', | 35 | support: 'sc:Text', |
diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index 00311fce1..a121f0b8a 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts | |||
@@ -117,7 +117,8 @@ const videoKeysToKeep = [ | |||
117 | 'channel-uuid', | 117 | 'channel-uuid', |
118 | 'channel-name', | 118 | 'channel-name', |
119 | 'support', | 119 | 'support', |
120 | 'commentsEnabled' | 120 | 'commentsEnabled', |
121 | 'downloadEnabled' | ||
121 | ] | 122 | ] |
122 | class VideoAuditView extends EntityAuditView { | 123 | class VideoAuditView extends EntityAuditView { |
123 | constructor (private video: VideoDetails) { | 124 | constructor (private video: VideoDetails) { |
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index ad99c2724..53ad0588d 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -39,6 +39,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { | |||
39 | // Default attributes | 39 | // Default attributes |
40 | if (!isVideoStateValid(video.state)) video.state = VideoState.PUBLISHED | 40 | if (!isVideoStateValid(video.state)) video.state = VideoState.PUBLISHED |
41 | if (!isBooleanValid(video.waitTranscoding)) video.waitTranscoding = false | 41 | if (!isBooleanValid(video.waitTranscoding)) video.waitTranscoding = false |
42 | if (!isBooleanValid(video.downloadEnabled)) video.downloadEnabled = true | ||
42 | 43 | ||
43 | return isActivityPubUrlValid(video.id) && | 44 | return isActivityPubUrlValid(video.id) && |
44 | isVideoNameValid(video.name) && | 45 | isVideoNameValid(video.name) && |
@@ -50,6 +51,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { | |||
50 | isVideoViewsValid(video.views) && | 51 | isVideoViewsValid(video.views) && |
51 | isBooleanValid(video.sensitive) && | 52 | isBooleanValid(video.sensitive) && |
52 | isBooleanValid(video.commentsEnabled) && | 53 | isBooleanValid(video.commentsEnabled) && |
54 | isBooleanValid(video.downloadEnabled) && | ||
53 | isDateValid(video.published) && | 55 | isDateValid(video.published) && |
54 | isDateValid(video.updated) && | 56 | isDateValid(video.updated) && |
55 | (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) && | 57 | (!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 index 000000000..e79466447 --- /dev/null +++ b/server/initializers/migrations/0280-video-downloading-enabled.ts | |||
@@ -0,0 +1,27 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import { Migration } from '../../models/migrations' | ||
3 | |||
4 | async function up (utils: { | ||
5 | transaction: Sequelize.Transaction, | ||
6 | queryInterface: Sequelize.QueryInterface, | ||
7 | sequelize: Sequelize.Sequelize | ||
8 | }): Promise<void> { | ||
9 | const data = { | ||
10 | type: Sequelize.BOOLEAN, | ||
11 | allowNull: false, | ||
12 | defaultValue: true | ||
13 | } as Migration.Boolean | ||
14 | await utils.queryInterface.addColumn('video', 'downloadEnabled', data) | ||
15 | |||
16 | data.defaultValue = null | ||
17 | return utils.queryInterface.changeColumn('video', 'downloadEnabled', data) | ||
18 | } | ||
19 | |||
20 | function down (options) { | ||
21 | throw new Error('Not implemented.') | ||
22 | } | ||
23 | |||
24 | export { | ||
25 | up, | ||
26 | down | ||
27 | } | ||
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index edd01234f..710929aac 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -243,6 +243,7 @@ async function updateVideoFromAP (options: { | |||
243 | options.video.set('support', videoData.support) | 243 | options.video.set('support', videoData.support) |
244 | options.video.set('nsfw', videoData.nsfw) | 244 | options.video.set('nsfw', videoData.nsfw) |
245 | options.video.set('commentsEnabled', videoData.commentsEnabled) | 245 | options.video.set('commentsEnabled', videoData.commentsEnabled) |
246 | options.video.set('downloadEnabled', videoData.downloadEnabled) | ||
246 | options.video.set('waitTranscoding', videoData.waitTranscoding) | 247 | options.video.set('waitTranscoding', videoData.waitTranscoding) |
247 | options.video.set('state', videoData.state) | 248 | options.video.set('state', videoData.state) |
248 | options.video.set('duration', videoData.duration) | 249 | options.video.set('duration', videoData.duration) |
@@ -503,6 +504,7 @@ async function videoActivityObjectToDBAttributes ( | |||
503 | support, | 504 | support, |
504 | nsfw: videoObject.sensitive, | 505 | nsfw: videoObject.sensitive, |
505 | commentsEnabled: videoObject.commentsEnabled, | 506 | commentsEnabled: videoObject.commentsEnabled, |
507 | downloadEnabled: videoObject.downloadEnabled, | ||
506 | waitTranscoding: videoObject.waitTranscoding, | 508 | waitTranscoding: videoObject.waitTranscoding, |
507 | state: videoObject.state, | 509 | state: videoObject.state, |
508 | channelId: videoChannel.id, | 510 | channelId: videoChannel.id, |
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 051a19e16..d9626929c 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts | |||
@@ -340,6 +340,10 @@ function getCommonVideoAttributes () { | |||
340 | .optional() | 340 | .optional() |
341 | .toBoolean() | 341 | .toBoolean() |
342 | .custom(isBooleanValid).withMessage('Should have comments enabled boolean'), | 342 | .custom(isBooleanValid).withMessage('Should have comments enabled boolean'), |
343 | body('downloadEnabled') | ||
344 | .optional() | ||
345 | .toBoolean() | ||
346 | .custom(isBooleanValid).withMessage('Should have downloading enabled boolean'), | ||
343 | 347 | ||
344 | body('scheduleUpdate') | 348 | body('scheduleUpdate') |
345 | .optional() | 349 | .optional() |
diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index e49dbee30..76d0445d4 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts | |||
@@ -140,6 +140,7 @@ function videoModelToFormattedDetailsJSON (video: VideoModel): VideoDetails { | |||
140 | account: video.VideoChannel.Account.toFormattedJSON(), | 140 | account: video.VideoChannel.Account.toFormattedJSON(), |
141 | tags, | 141 | tags, |
142 | commentsEnabled: video.commentsEnabled, | 142 | commentsEnabled: video.commentsEnabled, |
143 | downloadEnabled: video.downloadEnabled, | ||
143 | waitTranscoding: video.waitTranscoding, | 144 | waitTranscoding: video.waitTranscoding, |
144 | state: { | 145 | state: { |
145 | id: video.state, | 146 | id: video.state, |
@@ -320,6 +321,7 @@ function videoModelToActivityPubObject (video: VideoModel): VideoTorrentObject { | |||
320 | waitTranscoding: video.waitTranscoding, | 321 | waitTranscoding: video.waitTranscoding, |
321 | state: video.state, | 322 | state: video.state, |
322 | commentsEnabled: video.commentsEnabled, | 323 | commentsEnabled: video.commentsEnabled, |
324 | downloadEnabled: video.downloadEnabled, | ||
323 | published: video.publishedAt.toISOString(), | 325 | published: video.publishedAt.toISOString(), |
324 | updated: video.updatedAt.toISOString(), | 326 | updated: video.updatedAt.toISOString(), |
325 | mediaType: 'text/markdown', | 327 | mediaType: 'text/markdown', |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 702260772..0feeed4f8 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -717,6 +717,10 @@ export class VideoModel extends Model<VideoModel> { | |||
717 | 717 | ||
718 | @AllowNull(false) | 718 | @AllowNull(false) |
719 | @Column | 719 | @Column |
720 | downloadEnabled: boolean | ||
721 | |||
722 | @AllowNull(false) | ||
723 | @Column | ||
720 | waitTranscoding: boolean | 724 | waitTranscoding: boolean |
721 | 725 | ||
722 | @AllowNull(false) | 726 | @AllowNull(false) |
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 7bf187007..6dd9f15f7 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts | |||
@@ -88,6 +88,7 @@ describe('Test video imports API validator', function () { | |||
88 | language: 'pt', | 88 | language: 'pt', |
89 | nsfw: false, | 89 | nsfw: false, |
90 | commentsEnabled: true, | 90 | commentsEnabled: true, |
91 | downloadEnabled: true, | ||
91 | waitTranscoding: true, | 92 | waitTranscoding: true, |
92 | description: 'my super description', | 93 | description: 'my super description', |
93 | support: 'my super support text', | 94 | support: 'my super support text', |
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index f26b91435..878ffe025 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts | |||
@@ -179,6 +179,7 @@ describe('Test videos API validator', function () { | |||
179 | language: 'pt', | 179 | language: 'pt', |
180 | nsfw: false, | 180 | nsfw: false, |
181 | commentsEnabled: true, | 181 | commentsEnabled: true, |
182 | downloadEnabled: true, | ||
182 | waitTranscoding: true, | 183 | waitTranscoding: true, |
183 | description: 'my super description', | 184 | description: 'my super description', |
184 | support: 'my super support text', | 185 | support: 'my super support text', |
@@ -428,6 +429,7 @@ describe('Test videos API validator', function () { | |||
428 | language: 'pt', | 429 | language: 'pt', |
429 | nsfw: false, | 430 | nsfw: false, |
430 | commentsEnabled: false, | 431 | commentsEnabled: false, |
432 | downloadEnabled: false, | ||
431 | description: 'my super description', | 433 | description: 'my super description', |
432 | privacy: VideoPrivacy.PUBLIC, | 434 | privacy: VideoPrivacy.PUBLIC, |
433 | tags: [ 'tag1', 'tag2' ] | 435 | tags: [ 'tag1', 'tag2' ] |
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index b0fc5d293..ad4c87c73 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -348,6 +348,7 @@ describe('Test follows', function () { | |||
348 | }, | 348 | }, |
349 | isLocal, | 349 | isLocal, |
350 | commentsEnabled: true, | 350 | commentsEnabled: true, |
351 | downloadEnabled: true, | ||
351 | duration: 5, | 352 | duration: 5, |
352 | tags: [ 'tag1', 'tag2', 'tag3' ], | 353 | tags: [ 'tag1', 'tag2', 'tag3' ], |
353 | privacy: VideoPrivacy.PUBLIC, | 354 | privacy: VideoPrivacy.PUBLIC, |
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index cd7baadad..cd5acbe16 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -76,6 +76,7 @@ describe('Test handle downs', function () { | |||
76 | tags: [ 'tag1p1', 'tag2p1' ], | 76 | tags: [ 'tag1p1', 'tag2p1' ], |
77 | privacy: VideoPrivacy.PUBLIC, | 77 | privacy: VideoPrivacy.PUBLIC, |
78 | commentsEnabled: true, | 78 | commentsEnabled: true, |
79 | downloadEnabled: true, | ||
79 | channel: { | 80 | channel: { |
80 | name: 'root_channel', | 81 | name: 'root_channel', |
81 | displayName: 'Main root channel', | 82 | displayName: 'Main root channel', |
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 6c281e49e..1b471ba79 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -128,6 +128,7 @@ describe('Test multiple servers', function () { | |||
128 | tags: [ 'tag1p1', 'tag2p1' ], | 128 | tags: [ 'tag1p1', 'tag2p1' ], |
129 | privacy: VideoPrivacy.PUBLIC, | 129 | privacy: VideoPrivacy.PUBLIC, |
130 | commentsEnabled: true, | 130 | commentsEnabled: true, |
131 | downloadEnabled: true, | ||
131 | channel: { | 132 | channel: { |
132 | displayName: 'my channel', | 133 | displayName: 'my channel', |
133 | name: 'super_channel_name', | 134 | name: 'super_channel_name', |
@@ -199,6 +200,7 @@ describe('Test multiple servers', function () { | |||
199 | }, | 200 | }, |
200 | isLocal, | 201 | isLocal, |
201 | commentsEnabled: true, | 202 | commentsEnabled: true, |
203 | downloadEnabled: true, | ||
202 | duration: 5, | 204 | duration: 5, |
203 | tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], | 205 | tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], |
204 | privacy: VideoPrivacy.PUBLIC, | 206 | privacy: VideoPrivacy.PUBLIC, |
@@ -307,6 +309,7 @@ describe('Test multiple servers', function () { | |||
307 | isLocal, | 309 | isLocal, |
308 | duration: 5, | 310 | duration: 5, |
309 | commentsEnabled: true, | 311 | commentsEnabled: true, |
312 | downloadEnabled: true, | ||
310 | tags: [ 'tag1p3' ], | 313 | tags: [ 'tag1p3' ], |
311 | privacy: VideoPrivacy.PUBLIC, | 314 | privacy: VideoPrivacy.PUBLIC, |
312 | channel: { | 315 | channel: { |
@@ -338,6 +341,7 @@ describe('Test multiple servers', function () { | |||
338 | host: 'localhost:9003' | 341 | host: 'localhost:9003' |
339 | }, | 342 | }, |
340 | commentsEnabled: true, | 343 | commentsEnabled: true, |
344 | downloadEnabled: true, | ||
341 | isLocal, | 345 | isLocal, |
342 | duration: 5, | 346 | duration: 5, |
343 | tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], | 347 | tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], |
@@ -655,6 +659,7 @@ describe('Test multiple servers', function () { | |||
655 | isLocal, | 659 | isLocal, |
656 | duration: 5, | 660 | duration: 5, |
657 | commentsEnabled: true, | 661 | commentsEnabled: true, |
662 | downloadEnabled: true, | ||
658 | tags: [ 'tag_up_1', 'tag_up_2' ], | 663 | tags: [ 'tag_up_1', 'tag_up_2' ], |
659 | privacy: VideoPrivacy.PUBLIC, | 664 | privacy: VideoPrivacy.PUBLIC, |
660 | channel: { | 665 | channel: { |
@@ -914,11 +919,12 @@ describe('Test multiple servers', function () { | |||
914 | } | 919 | } |
915 | }) | 920 | }) |
916 | 921 | ||
917 | it('Should disable comments', async function () { | 922 | it('Should disable comments and download', async function () { |
918 | this.timeout(20000) | 923 | this.timeout(20000) |
919 | 924 | ||
920 | const attributes = { | 925 | const attributes = { |
921 | commentsEnabled: false | 926 | commentsEnabled: false, |
927 | downloadEnabled: false | ||
922 | } | 928 | } |
923 | 929 | ||
924 | await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes) | 930 | await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes) |
@@ -928,6 +934,7 @@ describe('Test multiple servers', function () { | |||
928 | for (const server of servers) { | 934 | for (const server of servers) { |
929 | const res = await getVideo(server.url, videoUUID) | 935 | const res = await getVideo(server.url, videoUUID) |
930 | expect(res.body.commentsEnabled).to.be.false | 936 | expect(res.body.commentsEnabled).to.be.false |
937 | expect(res.body.downloadEnabled).to.be.false | ||
931 | 938 | ||
932 | const text = 'my super forbidden comment' | 939 | const text = 'my super forbidden comment' |
933 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409) | 940 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409) |
@@ -976,6 +983,7 @@ describe('Test multiple servers', function () { | |||
976 | isLocal, | 983 | isLocal, |
977 | duration: 5, | 984 | duration: 5, |
978 | commentsEnabled: false, | 985 | commentsEnabled: false, |
986 | downloadEnabled: false, | ||
979 | tags: [ ], | 987 | tags: [ ], |
980 | privacy: VideoPrivacy.PUBLIC, | 988 | privacy: VideoPrivacy.PUBLIC, |
981 | channel: { | 989 | channel: { |
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index 069dec67c..cfdcbaf3f 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts | |||
@@ -55,6 +55,7 @@ describe('Test a single server', function () { | |||
55 | tags: [ 'tag1', 'tag2', 'tag3' ], | 55 | tags: [ 'tag1', 'tag2', 'tag3' ], |
56 | privacy: VideoPrivacy.PUBLIC, | 56 | privacy: VideoPrivacy.PUBLIC, |
57 | commentsEnabled: true, | 57 | commentsEnabled: true, |
58 | downloadEnabled: true, | ||
58 | channel: { | 59 | channel: { |
59 | displayName: 'Main root channel', | 60 | displayName: 'Main root channel', |
60 | name: 'root_channel', | 61 | name: 'root_channel', |
@@ -87,6 +88,7 @@ describe('Test a single server', function () { | |||
87 | privacy: VideoPrivacy.PUBLIC, | 88 | privacy: VideoPrivacy.PUBLIC, |
88 | duration: 5, | 89 | duration: 5, |
89 | commentsEnabled: false, | 90 | commentsEnabled: false, |
91 | downloadEnabled: false, | ||
90 | channel: { | 92 | channel: { |
91 | name: 'root_channel', | 93 | name: 'root_channel', |
92 | displayName: 'Main root channel', | 94 | displayName: 'Main root channel', |
@@ -356,6 +358,7 @@ describe('Test a single server', function () { | |||
356 | nsfw: false, | 358 | nsfw: false, |
357 | description: 'my super description updated', | 359 | description: 'my super description updated', |
358 | commentsEnabled: false, | 360 | commentsEnabled: false, |
361 | downloadEnabled: false, | ||
359 | tags: [ 'tagup1', 'tagup2' ] | 362 | tags: [ 'tagup1', 'tagup2' ] |
360 | } | 363 | } |
361 | await updateVideo(server.url, server.accessToken, videoId, attributes) | 364 | await updateVideo(server.url, server.accessToken, videoId, attributes) |
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index f50aafc35..151c5a989 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -224,6 +224,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st | |||
224 | nsfw: isNSFW(videoInfo), | 224 | nsfw: isNSFW(videoInfo), |
225 | waitTranscoding: true, | 225 | waitTranscoding: true, |
226 | commentsEnabled: true, | 226 | commentsEnabled: true, |
227 | downloadEnabled: true, | ||
227 | description: videoInfo.description || undefined, | 228 | description: videoInfo.description || undefined, |
228 | support: undefined, | 229 | support: undefined, |
229 | tags, | 230 | tags, |
diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts index cc7bd9b4c..ebc62c965 100644 --- a/server/tools/peertube-upload.ts +++ b/server/tools/peertube-upload.ts | |||
@@ -30,6 +30,7 @@ if (!program['tags']) program['tags'] = [] | |||
30 | if (!program['nsfw']) program['nsfw'] = false | 30 | if (!program['nsfw']) program['nsfw'] = false |
31 | if (!program['privacy']) program['privacy'] = VideoPrivacy.PUBLIC | 31 | if (!program['privacy']) program['privacy'] = VideoPrivacy.PUBLIC |
32 | if (!program['commentsEnabled']) program['commentsEnabled'] = false | 32 | if (!program['commentsEnabled']) program['commentsEnabled'] = false |
33 | if (!program['downloadEnabled']) program['downloadEnabled'] = true | ||
33 | 34 | ||
34 | getSettings() | 35 | getSettings() |
35 | .then(settings => { | 36 | .then(settings => { |
@@ -116,6 +117,7 @@ async function run () { | |||
116 | description: program['videoDescription'], | 117 | description: program['videoDescription'], |
117 | tags: program['tags'], | 118 | tags: program['tags'], |
118 | commentsEnabled: program['commentsEnabled'], | 119 | commentsEnabled: program['commentsEnabled'], |
120 | downloadEnabled: program['downloadEnabled'], | ||
119 | fixture: program['file'], | 121 | fixture: program['file'], |
120 | thumbnailfile: program['thumbnail'], | 122 | thumbnailfile: program['thumbnail'], |
121 | previewfile: program['preview'], | 123 | previewfile: program['preview'], |