X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fvideos%2Fvideos-command.ts;h=b5df9c32534a05a00849d691c0a7e71938962505;hb=5170f492b95dc81b75230312411c5fdb0019eed2;hp=5ec3b6ba88f18b769be181c3a34998774af81ebd;hpb=3545e72c686ff1725bbdfd8d16d693e2f4aa75a3;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts index 5ec3b6ba8..b5df9c325 100644 --- a/shared/server-commands/videos/videos-command.ts +++ b/shared/server-commands/videos/videos-command.ts @@ -4,7 +4,7 @@ import { expect } from 'chai' import { createReadStream, stat } from 'fs-extra' import got, { Response as GotResponse } from 'got' import validator from 'validator' -import { buildAbsoluteFixturePath, omit, pick, wait } from '@shared/core-utils' +import { buildAbsoluteFixturePath, getAllPrivacies, omit, pick, wait } from '@shared/core-utils' import { buildUUID } from '@shared/extra-utils' import { HttpStatusCode, @@ -15,6 +15,7 @@ import { VideoCreateResult, VideoDetails, VideoFileMetadata, + VideoInclude, VideoPrivacy, VideosCommonQuery, VideoTranscodingCreate @@ -209,6 +210,20 @@ export class VideosCommand extends AbstractCommand { }) } + listMySubscriptionVideos (options: OverrideCommandOptions & VideosCommonQuery = {}) { + const { sort = '-createdAt' } = options + const path = '/api/v1/users/me/subscriptions/videos' + + return this.getRequestBody>({ + ...options, + + path, + query: { sort, ...this.buildListQuery(options) }, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.OK_200 + }) + } + // --------------------------------------------------------------------------- list (options: OverrideCommandOptions & VideosCommonQuery = {}) { @@ -234,6 +249,22 @@ export class VideosCommand extends AbstractCommand { }) } + listAllForAdmin (options: OverrideCommandOptions & VideosCommonQuery = {}) { + const include = VideoInclude.NOT_PUBLISHED_STATE | VideoInclude.BLACKLISTED | VideoInclude.BLOCKED_OWNER + const nsfw = 'both' + const privacyOneOf = getAllPrivacies() + + return this.list({ + ...options, + + include, + nsfw, + privacyOneOf, + + token: this.buildCommonRequestToken({ ...options, implicitToken: true }) + }) + } + listByAccount (options: OverrideCommandOptions & VideosCommonQuery & { handle: string }) { @@ -344,7 +375,7 @@ export class VideosCommand extends AbstractCommand { mode?: 'legacy' | 'resumable' // default legacy waitTorrentGeneration?: boolean // default true } = {}) { - const { mode = 'legacy', waitTorrentGeneration } = options + const { mode = 'legacy', waitTorrentGeneration = true } = options let defaultChannelId = 1 try {