aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/videos/videos-command.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands/videos/videos-command.ts')
-rw-r--r--shared/server-commands/videos/videos-command.ts33
1 files changed, 27 insertions, 6 deletions
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts
index b5df9c325..9602fa7da 100644
--- a/shared/server-commands/videos/videos-command.ts
+++ b/shared/server-commands/videos/videos-command.ts
@@ -111,8 +111,9 @@ export class VideosCommand extends AbstractCommand {
111 rate (options: OverrideCommandOptions & { 111 rate (options: OverrideCommandOptions & {
112 id: number | string 112 id: number | string
113 rating: UserVideoRateType 113 rating: UserVideoRateType
114 videoPassword?: string
114 }) { 115 }) {
115 const { id, rating } = options 116 const { id, rating, videoPassword } = options
116 const path = '/api/v1/videos/' + id + '/rate' 117 const path = '/api/v1/videos/' + id + '/rate'
117 118
118 return this.putBodyRequest({ 119 return this.putBodyRequest({
@@ -120,6 +121,7 @@ export class VideosCommand extends AbstractCommand {
120 121
121 path, 122 path,
122 fields: { rating }, 123 fields: { rating },
124 headers: this.buildVideoPasswordHeader(videoPassword),
123 implicitToken: true, 125 implicitToken: true,
124 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 126 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
125 }) 127 })
@@ -151,6 +153,23 @@ export class VideosCommand extends AbstractCommand {
151 }) 153 })
152 } 154 }
153 155
156 getWithPassword (options: OverrideCommandOptions & {
157 id: number | string
158 password?: string
159 }) {
160 const path = '/api/v1/videos/' + options.id
161
162 return this.getRequestBody<VideoDetails>({
163 ...options,
164 headers:{
165 'x-peertube-video-password': options.password
166 },
167 path,
168 implicitToken: false,
169 defaultExpectedStatus: HttpStatusCode.OK_200
170 })
171 }
172
154 getSource (options: OverrideCommandOptions & { 173 getSource (options: OverrideCommandOptions & {
155 id: number | string 174 id: number | string
156 }) { 175 }) {
@@ -608,11 +627,13 @@ export class VideosCommand extends AbstractCommand {
608 nsfw?: boolean 627 nsfw?: boolean
609 privacy?: VideoPrivacy 628 privacy?: VideoPrivacy
610 fixture?: string 629 fixture?: string
630 videoPasswords?: string[]
611 }) { 631 }) {
612 const attributes: VideoEdit = { name: options.name } 632 const attributes: VideoEdit = { name: options.name }
613 if (options.nsfw) attributes.nsfw = options.nsfw 633 if (options.nsfw) attributes.nsfw = options.nsfw
614 if (options.privacy) attributes.privacy = options.privacy 634 if (options.privacy) attributes.privacy = options.privacy
615 if (options.fixture) attributes.fixture = options.fixture 635 if (options.fixture) attributes.fixture = options.fixture
636 if (options.videoPasswords) attributes.videoPasswords = options.videoPasswords
616 637
617 return this.upload({ ...options, attributes }) 638 return this.upload({ ...options, attributes })
618 } 639 }
@@ -665,10 +686,10 @@ export class VideosCommand extends AbstractCommand {
665 }) 686 })
666 } 687 }
667 688
668 removeAllWebTorrentFiles (options: OverrideCommandOptions & { 689 removeAllWebVideoFiles (options: OverrideCommandOptions & {
669 videoId: number | string 690 videoId: number | string
670 }) { 691 }) {
671 const path = '/api/v1/videos/' + options.videoId + '/webtorrent' 692 const path = '/api/v1/videos/' + options.videoId + '/web-videos'
672 693
673 return this.deleteRequest({ 694 return this.deleteRequest({
674 ...options, 695 ...options,
@@ -679,11 +700,11 @@ export class VideosCommand extends AbstractCommand {
679 }) 700 })
680 } 701 }
681 702
682 removeWebTorrentFile (options: OverrideCommandOptions & { 703 removeWebVideoFile (options: OverrideCommandOptions & {
683 videoId: number | string 704 videoId: number | string
684 fileId: number 705 fileId: number
685 }) { 706 }) {
686 const path = '/api/v1/videos/' + options.videoId + '/webtorrent/' + options.fileId 707 const path = '/api/v1/videos/' + options.videoId + '/web-videos/' + options.fileId
687 708
688 return this.deleteRequest({ 709 return this.deleteRequest({
689 ...options, 710 ...options,
@@ -696,7 +717,7 @@ export class VideosCommand extends AbstractCommand {
696 717
697 runTranscoding (options: OverrideCommandOptions & { 718 runTranscoding (options: OverrideCommandOptions & {
698 videoId: number | string 719 videoId: number | string
699 transcodingType: 'hls' | 'webtorrent' 720 transcodingType: 'hls' | 'webtorrent' | 'web-video'
700 }) { 721 }) {
701 const path = '/api/v1/videos/' + options.videoId + '/transcoding' 722 const path = '/api/v1/videos/' + options.videoId + '/transcoding'
702 723