From 40346ead2b0b7afa475aef057d3673b6c7574b7a Mon Sep 17 00:00:00 2001 From: Wicklow <123956049+wickloww@users.noreply.github.com> Date: Thu, 29 Jun 2023 07:48:55 +0000 Subject: Feature/password protected videos (#5836) * Add server endpoints * Refactoring test suites * Update server and add openapi documentation * fix compliation and tests * upload/import password protected video on client * add server error code * Add video password to update resolver * add custom message when sharing pw protected video * improve confirm component * Add new alert in component * Add ability to watch protected video on client * Cannot have password protected replay privacy * Add migration * Add tests * update after review * Update check params tests * Add live videos test * Add more filter test * Update static file privacy test * Update object storage tests * Add test on feeds * Add missing word * Fix tests * Fix tests on live videos * add embed support on password protected videos * fix style * Correcting data leaks * Unable to add password protected privacy on replay * Updated code based on review comments * fix validator and command * Updated code based on review comments --- shared/models/server/server-error-code.enum.ts | 5 ++++- shared/models/videos/index.ts | 1 + shared/models/videos/video-create.model.ts | 1 + shared/models/videos/video-password.model.ts | 7 +++++++ shared/models/videos/video-privacy.enum.ts | 3 ++- shared/models/videos/video-update.model.ts | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 shared/models/videos/video-password.model.ts (limited to 'shared/models') diff --git a/shared/models/server/server-error-code.enum.ts b/shared/models/server/server-error-code.enum.ts index 2b093380c..77d1e1d3f 100644 --- a/shared/models/server/server-error-code.enum.ts +++ b/shared/models/server/server-error-code.enum.ts @@ -49,7 +49,10 @@ export const enum ServerErrorCode { RUNNER_JOB_NOT_IN_PROCESSING_STATE = 'runner_job_not_in_processing_state', RUNNER_JOB_NOT_IN_PENDING_STATE = 'runner_job_not_in_pending_state', - UNKNOWN_RUNNER_TOKEN = 'unknown_runner_token' + UNKNOWN_RUNNER_TOKEN = 'unknown_runner_token', + + VIDEO_REQUIRES_PASSWORD = 'video_requires_password', + INCORRECT_VIDEO_PASSWORD = 'incorrect_video_password' } /** diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index 4c1790228..80be1854b 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -39,3 +39,4 @@ export * from './video-update.model' export * from './video-view.model' export * from './video.model' export * from './video-create-result.model' +export * from './video-password.model' diff --git a/shared/models/videos/video-create.model.ts b/shared/models/videos/video-create.model.ts index 732d508d1..7a34b5afe 100644 --- a/shared/models/videos/video-create.model.ts +++ b/shared/models/videos/video-create.model.ts @@ -18,6 +18,7 @@ export interface VideoCreate { privacy: VideoPrivacy scheduleUpdate?: VideoScheduleUpdate originallyPublishedAt?: Date | string + videoPasswords?: string[] thumbnailfile?: Blob | string previewfile?: Blob | string diff --git a/shared/models/videos/video-password.model.ts b/shared/models/videos/video-password.model.ts new file mode 100644 index 000000000..c0280b9b9 --- /dev/null +++ b/shared/models/videos/video-password.model.ts @@ -0,0 +1,7 @@ +export interface VideoPassword { + id: number + password: string + videoId: number + createdAt: Date | string + updatedAt: Date | string +} diff --git a/shared/models/videos/video-privacy.enum.ts b/shared/models/videos/video-privacy.enum.ts index 39fd0529f..12e1d196f 100644 --- a/shared/models/videos/video-privacy.enum.ts +++ b/shared/models/videos/video-privacy.enum.ts @@ -2,5 +2,6 @@ export const enum VideoPrivacy { PUBLIC = 1, UNLISTED = 2, PRIVATE = 3, - INTERNAL = 4 + INTERNAL = 4, + PASSWORD_PROTECTED = 5 } diff --git a/shared/models/videos/video-update.model.ts b/shared/models/videos/video-update.model.ts index 86653b959..43537b5af 100644 --- a/shared/models/videos/video-update.model.ts +++ b/shared/models/videos/video-update.model.ts @@ -19,6 +19,7 @@ export interface VideoUpdate { previewfile?: Blob scheduleUpdate?: VideoScheduleUpdate originallyPublishedAt?: Date | string + videoPasswords?: string[] pluginData?: any } -- cgit v1.2.3