From edb4ffc7e0b13659d7c73b120f2c87b27e4c26a1 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 8 Oct 2018 09:26:04 -0500 Subject: Set bitrate limits for transcoding (fixes #638) (#1135) * Set bitrate limits for transcoding (fixes #638) * added optimization script and test, changed stuff * fix test, improve docs * re-add optimize-old-videos script * added documentation * Don't optimize videos without valid UUID, or redundancy videos * move getUUIDFromFilename * fix tests? * update torrent and file size, some more fixes/improvements * use higher bitrate for high fps video, adjust bitrates * add test video * don't throw error if resolution is undefined * generate test fixture on the fly * use random noise video for bitrate test, add promise * shorten test video to avoid timeout * use existing function to optimize video * various fixes * increase test timeout * limit test fixture size, add link * test fixes * add await * more test fixes, add -b:v parameter * replace ffmpeg wiki link * fix ffmpeg params * fix unit test * add test fixture to .gitgnore * add video transcoding fps model * add missing file --- shared/models/videos/index.ts | 1 + shared/models/videos/video-resolution.enum.ts | 55 ++++++++++++++++++++++ .../models/videos/video-transcoding-fps.model.ts | 6 +++ 3 files changed, 62 insertions(+) create mode 100644 shared/models/videos/video-transcoding-fps.model.ts (limited to 'shared/models') diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index 90a0e3053..056ae06da 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -21,6 +21,7 @@ export * from './video-update.model' export * from './video.model' export * from './video-query.type' export * from './video-state.enum' +export * from './video-transcoding-fps.model' export * from './caption/video-caption.model' export * from './caption/video-caption-update.model' export * from './import/video-import-create.model' diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts index 100fc0e6e..3c52bbf98 100644 --- a/shared/models/videos/video-resolution.enum.ts +++ b/shared/models/videos/video-resolution.enum.ts @@ -1,3 +1,5 @@ +import { VideoTranscodingFPS } from './video-transcoding-fps.model' + export enum VideoResolution { H_240P = 240, H_360P = 360, @@ -5,3 +7,56 @@ export enum VideoResolution { H_720P = 720, H_1080P = 1080 } + +/** + * Bitrate targets for different resolutions and frame rates, in bytes per second. + * Sources for individual quality levels: + * Google Live Encoder: https://support.google.com/youtube/answer/2853702?hl=en + * YouTube Video Info (tested with random music video): https://www.h3xed.com/blogmedia/youtube-info.php + */ +export function getTargetBitrate (resolution: VideoResolution, fps: number, + fpsTranscodingConstants: VideoTranscodingFPS) { + switch (resolution) { + case VideoResolution.H_240P: + // quality according to Google Live Encoder: 300 - 700 Kbps + // Quality according to YouTube Video Info: 186 Kbps + return 250 * 1000 + case VideoResolution.H_360P: + // quality according to Google Live Encoder: 400 - 1,000 Kbps + // Quality according to YouTube Video Info: 480 Kbps + return 500 * 1000 + case VideoResolution.H_480P: + // quality according to Google Live Encoder: 500 - 2,000 Kbps + // Quality according to YouTube Video Info: 879 Kbps + return 900 * 1000 + case VideoResolution.H_720P: + if (fps === fpsTranscodingConstants.MAX) { + // quality according to Google Live Encoder: 2,250 - 6,000 Kbps + // Quality according to YouTube Video Info: 2634 Kbps + return 2600 * 1000 + } else { + // quality according to Google Live Encoder: 1,500 - 4,000 Kbps + // Quality according to YouTube Video Info: 1752 Kbps + return 1750 * 1000 + } + case VideoResolution.H_1080P: // fallthrough + default: + if (fps === fpsTranscodingConstants.MAX) { + // quality according to Google Live Encoder: 3000 - 6000 Kbps + // Quality according to YouTube Video Info: 4387 Kbps + return 4400 * 1000 + } else { + // quality according to Google Live Encoder: 3000 - 6000 Kbps + // Quality according to YouTube Video Info: 3277 Kbps + return 3300 * 1000 + } + } +} + +/** + * The maximum bitrate we expect to see on a transcoded video in bytes per second. + */ +export function getMaxBitrate (resolution: VideoResolution, fps: number, + fpsTranscodingConstants: VideoTranscodingFPS) { + return getTargetBitrate(resolution, fps, fpsTranscodingConstants) * 2 +} diff --git a/shared/models/videos/video-transcoding-fps.model.ts b/shared/models/videos/video-transcoding-fps.model.ts new file mode 100644 index 000000000..82022d2f1 --- /dev/null +++ b/shared/models/videos/video-transcoding-fps.model.ts @@ -0,0 +1,6 @@ +export type VideoTranscodingFPS = { + MIN: number, + AVERAGE: number, + MAX: number, + KEEP_ORIGIN_FPS_RESOLUTION_MIN: number +} -- cgit v1.2.3 From c1c86c1599acf8aad71fb7d7f312c43d6d1fa5ac Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Oct 2018 17:47:19 +0200 Subject: Try to cache video_high_bitrate_1080p in travis --- shared/models/videos/video-resolution.enum.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'shared/models') diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts index 3c52bbf98..e40e5b58b 100644 --- a/shared/models/videos/video-resolution.enum.ts +++ b/shared/models/videos/video-resolution.enum.ts @@ -34,22 +34,22 @@ export function getTargetBitrate (resolution: VideoResolution, fps: number, // quality according to Google Live Encoder: 2,250 - 6,000 Kbps // Quality according to YouTube Video Info: 2634 Kbps return 2600 * 1000 - } else { - // quality according to Google Live Encoder: 1,500 - 4,000 Kbps - // Quality according to YouTube Video Info: 1752 Kbps - return 1750 * 1000 } + + // quality according to Google Live Encoder: 1,500 - 4,000 Kbps + // Quality according to YouTube Video Info: 1752 Kbps + return 1750 * 1000 case VideoResolution.H_1080P: // fallthrough default: if (fps === fpsTranscodingConstants.MAX) { // quality according to Google Live Encoder: 3000 - 6000 Kbps // Quality according to YouTube Video Info: 4387 Kbps return 4400 * 1000 - } else { - // quality according to Google Live Encoder: 3000 - 6000 Kbps - // Quality according to YouTube Video Info: 3277 Kbps - return 3300 * 1000 } + + // quality according to Google Live Encoder: 3000 - 6000 Kbps + // Quality according to YouTube Video Info: 3277 Kbps + return 3300 * 1000 } } -- cgit v1.2.3 From 1cd3facc3de899ac864e979cd6d6a704b712cce3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Oct 2018 11:46:50 +0200 Subject: Add ability to list all local videos Including private/unlisted for moderators/admins --- shared/models/search/videos-search-query.model.ts | 3 +++ shared/models/users/user-right.enum.ts | 1 + shared/models/users/user-role.ts | 3 ++- shared/models/videos/video-query.type.ts | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) (limited to 'shared/models') diff --git a/shared/models/search/videos-search-query.model.ts b/shared/models/search/videos-search-query.model.ts index 29aa5c100..0db220758 100644 --- a/shared/models/search/videos-search-query.model.ts +++ b/shared/models/search/videos-search-query.model.ts @@ -1,4 +1,5 @@ import { NSFWQuery } from './nsfw-query.model' +import { VideoFilter } from '../videos' export interface VideosSearchQuery { search?: string @@ -23,4 +24,6 @@ export interface VideosSearchQuery { durationMin?: number // seconds durationMax?: number // seconds + + filter?: VideoFilter } diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index c4ccd632f..ed2c536ce 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts @@ -14,5 +14,6 @@ export enum UserRight { REMOVE_ANY_VIDEO_CHANNEL, REMOVE_ANY_VIDEO_COMMENT, UPDATE_ANY_VIDEO, + SEE_ALL_VIDEOS, CHANGE_VIDEO_OWNERSHIP } diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index 552aad999..d7020c0f2 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts @@ -26,7 +26,8 @@ const userRoleRights: { [ id: number ]: UserRight[] } = { UserRight.REMOVE_ANY_VIDEO, UserRight.REMOVE_ANY_VIDEO_CHANNEL, UserRight.REMOVE_ANY_VIDEO_COMMENT, - UserRight.UPDATE_ANY_VIDEO + UserRight.UPDATE_ANY_VIDEO, + UserRight.SEE_ALL_VIDEOS ], [UserRole.USER]: [] diff --git a/shared/models/videos/video-query.type.ts b/shared/models/videos/video-query.type.ts index ff0f527f3..f76a91aad 100644 --- a/shared/models/videos/video-query.type.ts +++ b/shared/models/videos/video-query.type.ts @@ -1 +1 @@ -export type VideoFilter = 'local' +export type VideoFilter = 'local' | 'all-local' -- cgit v1.2.3 From 64cc5e8575fda47b281ae20abf0020e27fc8ce7c Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 5 Oct 2018 15:17:34 +0200 Subject: add webtorrent opt-out settings - add a key in localstorage to remember the opt-out - add a user setting --- shared/models/users/user-update-me.model.ts | 4 +++- shared/models/users/user-webtorrent-policy.type.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 shared/models/users/user-webtorrent-policy.type.ts (limited to 'shared/models') diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts index bbffe1487..81790377e 100644 --- a/shared/models/users/user-update-me.model.ts +++ b/shared/models/users/user-update-me.model.ts @@ -1,9 +1,11 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type' +import { WebTorrentPolicyType } from './user-webtorrent-policy.type' export interface UserUpdateMe { displayName?: string description?: string - nsfwPolicy?: NSFWPolicyType + nsfwPolicy?: NSFWPolicyType, + webTorrentPolicy?: WebTorrentPolicyType, autoPlayVideo?: boolean email?: string currentPassword?: string diff --git a/shared/models/users/user-webtorrent-policy.type.ts b/shared/models/users/user-webtorrent-policy.type.ts new file mode 100644 index 000000000..e293f761d --- /dev/null +++ b/shared/models/users/user-webtorrent-policy.type.ts @@ -0,0 +1 @@ +export type WebTorrentPolicyType = 'enable' | 'disable' | 'disable_on_mobile' -- cgit v1.2.3 From ed638e5325096ef580da20f370ac61c59cd48cf7 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 12 Oct 2018 18:12:39 +0200 Subject: move to boolean switch --- shared/models/users/user-update-me.model.ts | 3 +-- shared/models/users/user-webtorrent-policy.type.ts | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 shared/models/users/user-webtorrent-policy.type.ts (limited to 'shared/models') diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts index 81790377e..10edeee2e 100644 --- a/shared/models/users/user-update-me.model.ts +++ b/shared/models/users/user-update-me.model.ts @@ -1,11 +1,10 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type' -import { WebTorrentPolicyType } from './user-webtorrent-policy.type' export interface UserUpdateMe { displayName?: string description?: string nsfwPolicy?: NSFWPolicyType, - webTorrentPolicy?: WebTorrentPolicyType, + webTorrentEnabled?: boolean, autoPlayVideo?: boolean email?: string currentPassword?: string diff --git a/shared/models/users/user-webtorrent-policy.type.ts b/shared/models/users/user-webtorrent-policy.type.ts deleted file mode 100644 index e293f761d..000000000 --- a/shared/models/users/user-webtorrent-policy.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type WebTorrentPolicyType = 'enable' | 'disable' | 'disable_on_mobile' -- cgit v1.2.3 From 7ad9b9846c44d198a736183fb186c2039f5236b5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Oct 2018 15:26:04 +0200 Subject: Add ability for users to block an account/instance on server side --- shared/models/blocklist/account-block.model.ts | 7 +++++++ shared/models/blocklist/index.ts | 2 ++ shared/models/blocklist/server-block.model.ts | 9 +++++++++ shared/models/index.ts | 1 + 4 files changed, 19 insertions(+) create mode 100644 shared/models/blocklist/account-block.model.ts create mode 100644 shared/models/blocklist/index.ts create mode 100644 shared/models/blocklist/server-block.model.ts (limited to 'shared/models') diff --git a/shared/models/blocklist/account-block.model.ts b/shared/models/blocklist/account-block.model.ts new file mode 100644 index 000000000..d6f8840c5 --- /dev/null +++ b/shared/models/blocklist/account-block.model.ts @@ -0,0 +1,7 @@ +import { Account } from '../actors' + +export interface AccountBlock { + byAccount: Account + accountBlocked: Account + createdAt: Date | string +} diff --git a/shared/models/blocklist/index.ts b/shared/models/blocklist/index.ts new file mode 100644 index 000000000..fc7873270 --- /dev/null +++ b/shared/models/blocklist/index.ts @@ -0,0 +1,2 @@ +export * from './account-block.model' +export * from './server-block.model' diff --git a/shared/models/blocklist/server-block.model.ts b/shared/models/blocklist/server-block.model.ts new file mode 100644 index 000000000..efba672bd --- /dev/null +++ b/shared/models/blocklist/server-block.model.ts @@ -0,0 +1,9 @@ +import { Account } from '../actors' + +export interface ServerBlock { + byAccount: Account + serverBlocked: { + host: string + } + createdAt: Date | string +} diff --git a/shared/models/index.ts b/shared/models/index.ts index e61d6cbdc..062533834 100644 --- a/shared/models/index.ts +++ b/shared/models/index.ts @@ -1,6 +1,7 @@ export * from './activitypub' export * from './actors' export * from './avatars' +export * from './blocklist' export * from './redundancy' export * from './users' export * from './videos' -- cgit v1.2.3 From af5767ffae41b2d5604e41ba9a7225c623dd6735 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Oct 2018 17:26:40 +0200 Subject: Add user/instance block by users in the client --- shared/models/blocklist/account-block.model.ts | 2 +- shared/models/blocklist/server-block.model.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'shared/models') diff --git a/shared/models/blocklist/account-block.model.ts b/shared/models/blocklist/account-block.model.ts index d6f8840c5..a942ed614 100644 --- a/shared/models/blocklist/account-block.model.ts +++ b/shared/models/blocklist/account-block.model.ts @@ -2,6 +2,6 @@ import { Account } from '../actors' export interface AccountBlock { byAccount: Account - accountBlocked: Account + blockedAccount: Account createdAt: Date | string } diff --git a/shared/models/blocklist/server-block.model.ts b/shared/models/blocklist/server-block.model.ts index efba672bd..a8b8af0b7 100644 --- a/shared/models/blocklist/server-block.model.ts +++ b/shared/models/blocklist/server-block.model.ts @@ -2,7 +2,7 @@ import { Account } from '../actors' export interface ServerBlock { byAccount: Account - serverBlocked: { + blockedServer: { host: string } createdAt: Date | string -- cgit v1.2.3 From b44164bb567fe7c9f65f1ac2908d44990a8ccc8e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Oct 2018 13:03:04 +0200 Subject: Add ability to mute a user/instance by server in server api --- shared/models/users/user-right.enum.ts | 3 +++ shared/models/users/user-role.ts | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'shared/models') diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index ed2c536ce..51c59d20a 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts @@ -8,6 +8,9 @@ export enum UserRight { MANAGE_JOBS, MANAGE_CONFIGURATION, + MANAGE_ACCOUNTS_BLOCKLIST, + MANAGE_SERVERS_BLOCKLIST, + MANAGE_VIDEO_BLACKLIST, REMOVE_ANY_VIDEO, diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index d7020c0f2..adef8fd95 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts @@ -27,7 +27,9 @@ const userRoleRights: { [ id: number ]: UserRight[] } = { UserRight.REMOVE_ANY_VIDEO_CHANNEL, UserRight.REMOVE_ANY_VIDEO_COMMENT, UserRight.UPDATE_ANY_VIDEO, - UserRight.SEE_ALL_VIDEOS + UserRight.SEE_ALL_VIDEOS, + UserRight.MANAGE_ACCOUNTS_BLOCKLIST, + UserRight.MANAGE_SERVERS_BLOCKLIST ], [UserRole.USER]: [] -- cgit v1.2.3 From 7f196c9320ab010fcf659dbf819d83dded5eeb7f Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 9 Oct 2018 17:46:26 -0500 Subject: Scale bitrate linearly with FPS --- shared/models/videos/video-resolution.enum.ts | 37 ++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'shared/models') diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts index e40e5b58b..13c0fe9a7 100644 --- a/shared/models/videos/video-resolution.enum.ts +++ b/shared/models/videos/video-resolution.enum.ts @@ -9,13 +9,13 @@ export enum VideoResolution { } /** - * Bitrate targets for different resolutions and frame rates, in bytes per second. + * Bitrate targets for different resolutions, at VideoTranscodingFPS.AVERAGE. + * * Sources for individual quality levels: * Google Live Encoder: https://support.google.com/youtube/answer/2853702?hl=en * YouTube Video Info (tested with random music video): https://www.h3xed.com/blogmedia/youtube-info.php */ -export function getTargetBitrate (resolution: VideoResolution, fps: number, - fpsTranscodingConstants: VideoTranscodingFPS) { +export function getBaseBitrate (resolution: VideoResolution) { switch (resolution) { case VideoResolution.H_240P: // quality according to Google Live Encoder: 300 - 700 Kbps @@ -30,29 +30,36 @@ export function getTargetBitrate (resolution: VideoResolution, fps: number, // Quality according to YouTube Video Info: 879 Kbps return 900 * 1000 case VideoResolution.H_720P: - if (fps === fpsTranscodingConstants.MAX) { - // quality according to Google Live Encoder: 2,250 - 6,000 Kbps - // Quality according to YouTube Video Info: 2634 Kbps - return 2600 * 1000 - } - // quality according to Google Live Encoder: 1,500 - 4,000 Kbps // Quality according to YouTube Video Info: 1752 Kbps return 1750 * 1000 case VideoResolution.H_1080P: // fallthrough default: - if (fps === fpsTranscodingConstants.MAX) { - // quality according to Google Live Encoder: 3000 - 6000 Kbps - // Quality according to YouTube Video Info: 4387 Kbps - return 4400 * 1000 - } - // quality according to Google Live Encoder: 3000 - 6000 Kbps // Quality according to YouTube Video Info: 3277 Kbps return 3300 * 1000 } } +/** + * Calculate the target bitrate based on video resolution and FPS. + */ +export function getTargetBitrate (resolution: VideoResolution, fps: number, + fpsTranscodingConstants: VideoTranscodingFPS) { + const baseBitrate = getBaseBitrate(resolution) + // The maximum bitrate, used when fps === VideoTranscodingFPS.MAX + // Based on numbers from Youtube, 60 fps bitrate divided by 30 fps bitrate: + // 2600 / 1750 = 1.48571428571 + // 4400 / 3300 = 1.33333333333 + const maxBitrate = baseBitrate * 1.4 + const maxBitrateDifference = maxBitrate - baseBitrate + const maxFpsDifference = fpsTranscodingConstants.MAX - fpsTranscodingConstants.AVERAGE + // For 1080p video with default settings, this results in the following formula: + // 3300 + (x - 30) * (1320/30) + // Example outputs: 1080p30: 3300 kbps, 1080p60: 4620 kbps, 720p30: 1750, 720p60: 2450 + return baseBitrate + (fps - fpsTranscodingConstants.AVERAGE) * (maxBitrateDifference / maxFpsDifference) +} + /** * The maximum bitrate we expect to see on a transcoded video in bytes per second. */ -- cgit v1.2.3 From e243c38c356b5cfd8ba1783f19389a99dc5cf527 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 9 Oct 2018 18:22:35 -0500 Subject: better documentation --- shared/models/videos/video-resolution.enum.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'shared/models') diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts index 13c0fe9a7..4d2644cc0 100644 --- a/shared/models/videos/video-resolution.enum.ts +++ b/shared/models/videos/video-resolution.enum.ts @@ -49,14 +49,16 @@ export function getTargetBitrate (resolution: VideoResolution, fps: number, const baseBitrate = getBaseBitrate(resolution) // The maximum bitrate, used when fps === VideoTranscodingFPS.MAX // Based on numbers from Youtube, 60 fps bitrate divided by 30 fps bitrate: - // 2600 / 1750 = 1.48571428571 - // 4400 / 3300 = 1.33333333333 + // 720p: 2600 / 1750 = 1.48571428571 + // 1080p: 4400 / 3300 = 1.33333333333 const maxBitrate = baseBitrate * 1.4 const maxBitrateDifference = maxBitrate - baseBitrate const maxFpsDifference = fpsTranscodingConstants.MAX - fpsTranscodingConstants.AVERAGE // For 1080p video with default settings, this results in the following formula: // 3300 + (x - 30) * (1320/30) - // Example outputs: 1080p30: 3300 kbps, 1080p60: 4620 kbps, 720p30: 1750, 720p60: 2450 + // Example outputs: + // 1080p10: 2420 kbps, 1080p30: 3300 kbps, 1080p60: 4620 kbps + // 720p10: 1283 kbps, 720p30: 1750 kbps, 720p60: 2450 return baseBitrate + (fps - fpsTranscodingConstants.AVERAGE) * (maxBitrateDifference / maxFpsDifference) } -- cgit v1.2.3 From 2f71dcf8de13e5250957173c9a2efe1c5544aeb2 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 9 Oct 2018 18:53:16 -0500 Subject: more documentation --- shared/models/videos/video-resolution.enum.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'shared/models') diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts index 4d2644cc0..c9b258921 100644 --- a/shared/models/videos/video-resolution.enum.ts +++ b/shared/models/videos/video-resolution.enum.ts @@ -43,14 +43,20 @@ export function getBaseBitrate (resolution: VideoResolution) { /** * Calculate the target bitrate based on video resolution and FPS. + * + * The calculation is based on two values: + * Bitrate at VideoTranscodingFPS.AVERAGE is always the same as + * getBaseBitrate(). Bitrate at VideoTranscodingFPS.MAX is always + * getBaseBitrate() * 1.4. All other values are calculated linearly + * between these two points. */ export function getTargetBitrate (resolution: VideoResolution, fps: number, fpsTranscodingConstants: VideoTranscodingFPS) { const baseBitrate = getBaseBitrate(resolution) // The maximum bitrate, used when fps === VideoTranscodingFPS.MAX // Based on numbers from Youtube, 60 fps bitrate divided by 30 fps bitrate: - // 720p: 2600 / 1750 = 1.48571428571 - // 1080p: 4400 / 3300 = 1.33333333333 + // 720p: 2600 / 1750 = 1.49 + // 1080p: 4400 / 3300 = 1.33 const maxBitrate = baseBitrate * 1.4 const maxBitrateDifference = maxBitrate - baseBitrate const maxFpsDifference = fpsTranscodingConstants.MAX - fpsTranscodingConstants.AVERAGE @@ -58,7 +64,7 @@ export function getTargetBitrate (resolution: VideoResolution, fps: number, // 3300 + (x - 30) * (1320/30) // Example outputs: // 1080p10: 2420 kbps, 1080p30: 3300 kbps, 1080p60: 4620 kbps - // 720p10: 1283 kbps, 720p30: 1750 kbps, 720p60: 2450 + // 720p10: 1283 kbps, 720p30: 1750 kbps, 720p60: 2450 kbps return baseBitrate + (fps - fpsTranscodingConstants.AVERAGE) * (maxBitrateDifference / maxFpsDifference) } -- cgit v1.2.3 From c19787797150daf706dec586a44819a8b727fe84 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Wed, 10 Oct 2018 02:39:34 -0500 Subject: dont export base bitrate --- shared/models/videos/video-resolution.enum.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shared/models') diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts index c9b258921..2eee03843 100644 --- a/shared/models/videos/video-resolution.enum.ts +++ b/shared/models/videos/video-resolution.enum.ts @@ -15,7 +15,7 @@ export enum VideoResolution { * Google Live Encoder: https://support.google.com/youtube/answer/2853702?hl=en * YouTube Video Info (tested with random music video): https://www.h3xed.com/blogmedia/youtube-info.php */ -export function getBaseBitrate (resolution: VideoResolution) { +function getBaseBitrate (resolution: VideoResolution) { switch (resolution) { case VideoResolution.H_240P: // quality according to Google Live Encoder: 300 - 700 Kbps -- cgit v1.2.3 From 0229b014e0101844df028342b8d4dd9ae4e887a4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Oct 2018 13:10:58 +0200 Subject: Fix tests --- shared/models/videos/video-resolution.enum.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'shared/models') diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts index 2eee03843..7da5e7100 100644 --- a/shared/models/videos/video-resolution.enum.ts +++ b/shared/models/videos/video-resolution.enum.ts @@ -50,8 +50,7 @@ function getBaseBitrate (resolution: VideoResolution) { * getBaseBitrate() * 1.4. All other values are calculated linearly * between these two points. */ -export function getTargetBitrate (resolution: VideoResolution, fps: number, - fpsTranscodingConstants: VideoTranscodingFPS) { +export function getTargetBitrate (resolution: VideoResolution, fps: number, fpsTranscodingConstants: VideoTranscodingFPS) { const baseBitrate = getBaseBitrate(resolution) // The maximum bitrate, used when fps === VideoTranscodingFPS.MAX // Based on numbers from Youtube, 60 fps bitrate divided by 30 fps bitrate: @@ -71,7 +70,6 @@ export function getTargetBitrate (resolution: VideoResolution, fps: number, /** * The maximum bitrate we expect to see on a transcoded video in bytes per second. */ -export function getMaxBitrate (resolution: VideoResolution, fps: number, - fpsTranscodingConstants: VideoTranscodingFPS) { +export function getMaxBitrate (resolution: VideoResolution, fps: number, fpsTranscodingConstants: VideoTranscodingFPS) { return getTargetBitrate(resolution, fps, fpsTranscodingConstants) * 2 } -- cgit v1.2.3 From 244b4ae3973bc1511464a08158a123767f83179c Mon Sep 17 00:00:00 2001 From: BO41 Date: Thu, 18 Oct 2018 09:08:59 +0200 Subject: NoImplicitAny flag true (#1157) this enables the `noImplicitAny` flag in the Typescript compiler > When the noImplicitAny flag is true and the TypeScript compiler cannot infer the type, it still generates the JavaScript files, but it also reports an error. Many seasoned developers prefer this stricter setting because type checking catches more unintentional errors at compile time. closes: #1131 replaces #1137 --- shared/models/i18n/i18n.ts | 4 ++-- shared/models/overviews/videos-overview.ts | 1 + shared/models/server/custom-config.model.ts | 1 + shared/models/users/user.model.ts | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) (limited to 'shared/models') diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts index 5c3249452..9278c043b 100644 --- a/shared/models/i18n/i18n.ts +++ b/shared/models/i18n/i18n.ts @@ -1,6 +1,6 @@ export const LOCALE_FILES = [ 'player', 'server' ] -export const I18N_LOCALES = { +export const I18N_LOCALES: any = { 'en-US': 'English', 'fr-FR': 'Français', 'eu-ES': 'Euskara', @@ -17,7 +17,7 @@ export const I18N_LOCALES = { 'zh-Hans-CN': '简体中文(中国)' } -const I18N_LOCALE_ALIAS = { +const I18N_LOCALE_ALIAS: any = { 'en': 'en-US', 'fr': 'fr-FR', 'eu': 'eu-ES', diff --git a/shared/models/overviews/videos-overview.ts b/shared/models/overviews/videos-overview.ts index ee009d94c..8c8785763 100644 --- a/shared/models/overviews/videos-overview.ts +++ b/shared/models/overviews/videos-overview.ts @@ -15,4 +15,5 @@ export interface VideosOverview { tag: string videos: Video[] }[] + [key: string]: any } diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 3afd36fcd..c5156d9f3 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -55,6 +55,7 @@ export interface CustomConfig { '480p': boolean '720p': boolean '1080p': boolean + [key: string]: boolean } } diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 8147dc48e..06a660206 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -20,4 +20,5 @@ export interface User { blockedReason?: string videoQuotaUsed?: number + [key: string]: any } -- cgit v1.2.3 From e27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Oct 2018 08:48:24 +0200 Subject: AP mimeType -> mediaType --- shared/models/activitypub/objects/common-objects.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'shared/models') diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index 1de60da94..118a4f43d 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts @@ -19,7 +19,9 @@ export interface ActivityIconObject { export type ActivityVideoUrlObject = { type: 'Link' - mimeType: 'video/mp4' | 'video/webm' | 'video/ogg' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'video/mp4' | 'video/webm' | 'video/ogg' + mediaType: 'video/mp4' | 'video/webm' | 'video/ogg' href: string height: number size: number @@ -31,14 +33,18 @@ export type ActivityUrlObject = | { type: 'Link' - mimeType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' href: string height: number } | { type: 'Link' - mimeType: 'text/html' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'text/html' + mediaType: 'text/html' href: string } -- cgit v1.2.3 From c199c427d4ae586339822320f20f512a7a19dc3f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Oct 2018 14:35:31 +0200 Subject: Better typings --- shared/models/i18n/i18n.ts | 4 ++-- shared/models/overviews/videos-overview.ts | 1 - shared/models/server/custom-config.model.ts | 1 - shared/models/users/user.model.ts | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) (limited to 'shared/models') diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts index 9278c043b..5c3249452 100644 --- a/shared/models/i18n/i18n.ts +++ b/shared/models/i18n/i18n.ts @@ -1,6 +1,6 @@ export const LOCALE_FILES = [ 'player', 'server' ] -export const I18N_LOCALES: any = { +export const I18N_LOCALES = { 'en-US': 'English', 'fr-FR': 'Français', 'eu-ES': 'Euskara', @@ -17,7 +17,7 @@ export const I18N_LOCALES: any = { 'zh-Hans-CN': '简体中文(中国)' } -const I18N_LOCALE_ALIAS: any = { +const I18N_LOCALE_ALIAS = { 'en': 'en-US', 'fr': 'fr-FR', 'eu': 'eu-ES', diff --git a/shared/models/overviews/videos-overview.ts b/shared/models/overviews/videos-overview.ts index 8c8785763..ee009d94c 100644 --- a/shared/models/overviews/videos-overview.ts +++ b/shared/models/overviews/videos-overview.ts @@ -15,5 +15,4 @@ export interface VideosOverview { tag: string videos: Video[] }[] - [key: string]: any } diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index c5156d9f3..3afd36fcd 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -55,7 +55,6 @@ export interface CustomConfig { '480p': boolean '720p': boolean '1080p': boolean - [key: string]: boolean } } diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 06a660206..8147dc48e 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -20,5 +20,4 @@ export interface User { blockedReason?: string videoQuotaUsed?: number - [key: string]: any } -- cgit v1.2.3 From 5c6d985faeef1d6793d3f44ca6374f1a9b722806 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 14 Nov 2018 15:01:28 +0100 Subject: Check activities host --- shared/models/activitypub/objects/dislike-object.ts | 3 ++- shared/models/videos/video-rate.type.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'shared/models') diff --git a/shared/models/activitypub/objects/dislike-object.ts b/shared/models/activitypub/objects/dislike-object.ts index 295175774..7218fb784 100644 --- a/shared/models/activitypub/objects/dislike-object.ts +++ b/shared/models/activitypub/objects/dislike-object.ts @@ -1,5 +1,6 @@ export interface DislikeObject { - type: 'Dislike', + id: string + type: 'Dislike' actor: string object: string } diff --git a/shared/models/videos/video-rate.type.ts b/shared/models/videos/video-rate.type.ts index 17aaba5a5..d48774a4b 100644 --- a/shared/models/videos/video-rate.type.ts +++ b/shared/models/videos/video-rate.type.ts @@ -1 +1 @@ -export type VideoRateType = 'like' | 'dislike' | 'none' +export type VideoRateType = 'like' | 'dislike' -- cgit v1.2.3 From 04b8c3fba614efc3827f583096c78b08cb668470 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Nov 2018 10:05:51 +0100 Subject: Delete invalid or deleted remote videos --- shared/models/server/job.model.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shared/models') diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts index 4046297c4..85bc9541b 100644 --- a/shared/models/server/job.model.ts +++ b/shared/models/server/job.model.ts @@ -8,7 +8,8 @@ export type JobType = 'activitypub-http-unicast' | 'video-file' | 'email' | 'video-import' | - 'videos-views' + 'videos-views' | + 'activitypub-refresher' export interface Job { id: number -- cgit v1.2.3 From fc2ec87a8c4dcfbb91a1a62cf4c07a2a8e6a50fe Mon Sep 17 00:00:00 2001 From: Josh Morel Date: Wed, 21 Nov 2018 02:48:29 -0500 Subject: enable email verification by admin (#1348) * enable email verification by admin * rename/label to set email as verified to be more explicit that admin is not sending another email to confirm * add update user emailVerified check-params test * make user.model emailVerified property required --- shared/models/users/user-update.model.ts | 1 + shared/models/users/user.model.ts | 1 + 2 files changed, 2 insertions(+) (limited to 'shared/models') diff --git a/shared/models/users/user-update.model.ts b/shared/models/users/user-update.model.ts index ce866fb18..abde51321 100644 --- a/shared/models/users/user-update.model.ts +++ b/shared/models/users/user-update.model.ts @@ -2,6 +2,7 @@ import { UserRole } from './user-role' export interface UserUpdate { email?: string + emailVerified?: boolean videoQuota?: number videoQuotaDaily?: number role?: UserRole diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 8147dc48e..82af17516 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -7,6 +7,7 @@ export interface User { id: number username: string email: string + emailVerified: boolean nsfwPolicy: NSFWPolicyType autoPlayVideo: boolean role: UserRole -- cgit v1.2.3 From d7aea77bdb989df7df4a9c492f5e5ab033291e07 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Dec 2018 17:43:24 +0100 Subject: Add ru pl and it translations --- shared/models/i18n/i18n.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'shared/models') diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts index 5c3249452..d7164b73f 100644 --- a/shared/models/i18n/i18n.ts +++ b/shared/models/i18n/i18n.ts @@ -8,12 +8,14 @@ export const I18N_LOCALES = { 'cs-CZ': 'Čeština', 'eo': 'Esperanto', 'de-DE': 'Deutsch', + 'it-IT': 'Italiano', 'es-ES': 'Español', 'oc': 'Occitan', 'zh-Hant-TW': '繁體中文(台灣)', 'pt-BR': 'Português (Brasil)', 'sv-SE': 'svenska', - // 'pl-PL': 'Polski' + 'pl-PL': 'Polski', + 'ru-RU': 'русский', 'zh-Hans-CN': '简体中文(中国)' } @@ -26,8 +28,9 @@ const I18N_LOCALE_ALIAS = { 'de': 'de-DE', 'es': 'es-ES', 'pt': 'pt-BR', - 'sv': 'sv-SE' - // 'pl': 'pl-PL' + 'sv': 'sv-SE', + 'pl': 'pl-PL', + 'ru': 'ru-RU' } export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) -- cgit v1.2.3 From 3b3b18203fe73e499bf8b49b15369710df95993e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 5 Dec 2018 15:10:45 +0100 Subject: Add error when email system is not configured and using the forgot password system --- shared/models/server/server-config.model.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shared/models') diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 91196c1eb..a6d28e05e 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -15,6 +15,10 @@ export interface ServerConfig { } } + email: { + enabled: boolean + } + signup: { allowed: boolean, allowedForCurrentIP: boolean, -- cgit v1.2.3 From 14e2014acc1362cfbb770c051a7254b156cd8efb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Dec 2018 14:52:50 +0100 Subject: Support additional video extensions --- shared/models/server/custom-config.model.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'shared/models') diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 3afd36fcd..028aafa1a 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -48,6 +48,7 @@ export interface CustomConfig { transcoding: { enabled: boolean + allowAdditionalExtensions: boolean threads: number resolutions: { '240p': boolean -- cgit v1.2.3 From 8b9a525a180cc9f3a98c334cc052dcfc8f36dcd4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Dec 2018 15:52:38 +0100 Subject: Add history on server side Add ability to disable, clear and list user videos history --- shared/models/users/user-update-me.model.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'shared/models') diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts index 10edeee2e..e24afab94 100644 --- a/shared/models/users/user-update-me.model.ts +++ b/shared/models/users/user-update-me.model.ts @@ -3,9 +3,12 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type' export interface UserUpdateMe { displayName?: string description?: string - nsfwPolicy?: NSFWPolicyType, - webTorrentEnabled?: boolean, + nsfwPolicy?: NSFWPolicyType + + webTorrentEnabled?: boolean autoPlayVideo?: boolean + videosHistoryEnabled?: boolean + email?: string currentPassword?: string password?: string -- cgit v1.2.3 From 276d96529529621d5f70473990095495f2743c29 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 18 Dec 2018 11:32:37 +0100 Subject: Add ability to disable and clear history --- shared/models/users/user.model.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shared/models') diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 82af17516..2aabff494 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -9,7 +9,11 @@ export interface User { email: string emailVerified: boolean nsfwPolicy: NSFWPolicyType + autoPlayVideo: boolean + webTorrentEnabled: boolean + videosHistoryEnabled: boolean + role: UserRole videoQuota: number videoQuotaDaily: number -- cgit v1.2.3 From cef534ed53e4518fe0acf581bfe880788d42fc36 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 Dec 2018 10:36:24 +0100 Subject: Add user notification base code --- shared/models/users/index.ts | 2 + .../users/user-notification-setting.model.ts | 13 ++++++ shared/models/users/user-notification.model.ts | 47 ++++++++++++++++++++++ shared/models/users/user.model.ts | 2 + 4 files changed, 64 insertions(+) create mode 100644 shared/models/users/user-notification-setting.model.ts create mode 100644 shared/models/users/user-notification.model.ts (limited to 'shared/models') diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts index 7114741e0..cd07cf320 100644 --- a/shared/models/users/index.ts +++ b/shared/models/users/index.ts @@ -1,6 +1,8 @@ export * from './user.model' export * from './user-create.model' export * from './user-login.model' +export * from './user-notification.model' +export * from './user-notification-setting.model' export * from './user-refresh-token.model' export * from './user-update.model' export * from './user-update-me.model' diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts new file mode 100644 index 000000000..7cecd70a2 --- /dev/null +++ b/shared/models/users/user-notification-setting.model.ts @@ -0,0 +1,13 @@ +export enum UserNotificationSettingValue { + NONE = 1, + WEB_NOTIFICATION = 2, + EMAIL = 3, + WEB_NOTIFICATION_AND_EMAIL = 4 +} + +export interface UserNotificationSetting { + newVideoFromSubscription: UserNotificationSettingValue + newCommentOnMyVideo: UserNotificationSettingValue + videoAbuseAsModerator: UserNotificationSettingValue + blacklistOnMyVideo: UserNotificationSettingValue +} diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts new file mode 100644 index 000000000..39beb2350 --- /dev/null +++ b/shared/models/users/user-notification.model.ts @@ -0,0 +1,47 @@ +export enum UserNotificationType { + NEW_VIDEO_FROM_SUBSCRIPTION = 1, + NEW_COMMENT_ON_MY_VIDEO = 2, + NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, + BLACKLIST_ON_MY_VIDEO = 4, + UNBLACKLIST_ON_MY_VIDEO = 5 +} + +interface VideoInfo { + id: number + uuid: string + name: string +} + +export interface UserNotification { + id: number + type: UserNotificationType + read: boolean + + video?: VideoInfo & { + channel: { + id: number + displayName: string + } + } + + comment?: { + id: number + account: { + id: number + displayName: string + } + } + + videoAbuse?: { + id: number + video: VideoInfo + } + + videoBlacklist?: { + id: number + video: VideoInfo + } + + createdAt: string + updatedAt: string +} diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 2aabff494..af783d389 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -2,6 +2,7 @@ import { Account } from '../actors' import { VideoChannel } from '../videos/channel/video-channel.model' import { UserRole } from './user-role' import { NSFWPolicyType } from '../videos/nsfw-policy.type' +import { UserNotificationSetting } from './user-notification-setting.model' export interface User { id: number @@ -19,6 +20,7 @@ export interface User { videoQuotaDaily: number createdAt: Date account: Account + notificationSettings?: UserNotificationSetting videoChannels?: VideoChannel[] blocked: boolean -- cgit v1.2.3 From dc13348070d808d0ba3feb56a435b835c2e7e791 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 2 Jan 2019 16:37:43 +0100 Subject: Add import finished and video published notifs --- shared/models/users/user-notification-setting.model.ts | 2 ++ shared/models/users/user-notification.model.ts | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'shared/models') diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts index 7cecd70a2..55d351abf 100644 --- a/shared/models/users/user-notification-setting.model.ts +++ b/shared/models/users/user-notification-setting.model.ts @@ -10,4 +10,6 @@ export interface UserNotificationSetting { newCommentOnMyVideo: UserNotificationSettingValue videoAbuseAsModerator: UserNotificationSettingValue blacklistOnMyVideo: UserNotificationSettingValue + myVideoPublished: UserNotificationSettingValue + myVideoImportFinished: UserNotificationSettingValue } diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index 39beb2350..ee9ac275a 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -3,10 +3,13 @@ export enum UserNotificationType { NEW_COMMENT_ON_MY_VIDEO = 2, NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, BLACKLIST_ON_MY_VIDEO = 4, - UNBLACKLIST_ON_MY_VIDEO = 5 + UNBLACKLIST_ON_MY_VIDEO = 5, + MY_VIDEO_PUBLISHED = 6, + MY_VIDEO_IMPORT_SUCCESS = 7, + MY_VIDEO_IMPORT_ERROR = 8 } -interface VideoInfo { +export interface VideoInfo { id: number uuid: string name: string @@ -24,12 +27,22 @@ export interface UserNotification { } } + videoImport?: { + id: number + video?: VideoInfo + torrentName?: string + magnetUri?: string + targetUrl?: string + } + comment?: { id: number + threadId: number account: { id: number displayName: string } + video: VideoInfo } videoAbuse?: { -- cgit v1.2.3 From f7cc67b455a12ccae9b0ea16876d166720364357 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Jan 2019 08:56:20 +0100 Subject: Add new follow, mention and user registered notifs --- .../users/user-notification-setting.model.ts | 3 +++ shared/models/users/user-notification.model.ts | 24 +++++++++++++++++++++- shared/models/users/user-right.enum.ts | 5 +++++ shared/models/users/user-role.ts | 3 ++- 4 files changed, 33 insertions(+), 2 deletions(-) (limited to 'shared/models') diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts index 55d351abf..f580e827e 100644 --- a/shared/models/users/user-notification-setting.model.ts +++ b/shared/models/users/user-notification-setting.model.ts @@ -12,4 +12,7 @@ export interface UserNotificationSetting { blacklistOnMyVideo: UserNotificationSettingValue myVideoPublished: UserNotificationSettingValue myVideoImportFinished: UserNotificationSettingValue + newUserRegistration: UserNotificationSettingValue + newFollow: UserNotificationSettingValue + commentMention: UserNotificationSettingValue } diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index ee9ac275a..9dd4f099f 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -6,7 +6,10 @@ export enum UserNotificationType { UNBLACKLIST_ON_MY_VIDEO = 5, MY_VIDEO_PUBLISHED = 6, MY_VIDEO_IMPORT_SUCCESS = 7, - MY_VIDEO_IMPORT_ERROR = 8 + MY_VIDEO_IMPORT_ERROR = 8, + NEW_USER_REGISTRATION = 9, + NEW_FOLLOW = 10, + COMMENT_MENTION = 11 } export interface VideoInfo { @@ -55,6 +58,25 @@ export interface UserNotification { video: VideoInfo } + account?: { + id: number + displayName: string + name: string + } + + actorFollow?: { + id: number + follower: { + name: string + displayName: string + } + following: { + type: 'account' | 'channel' + name: string + displayName: string + } + } + createdAt: string updatedAt: string } diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index 51c59d20a..090256bca 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts @@ -2,10 +2,15 @@ export enum UserRight { ALL, MANAGE_USERS, + MANAGE_SERVER_FOLLOW, + MANAGE_SERVER_REDUNDANCY, + MANAGE_VIDEO_ABUSES, + MANAGE_JOBS, + MANAGE_CONFIGURATION, MANAGE_ACCOUNTS_BLOCKLIST, diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index adef8fd95..59c2ba106 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts @@ -29,7 +29,8 @@ const userRoleRights: { [ id: number ]: UserRight[] } = { UserRight.UPDATE_ANY_VIDEO, UserRight.SEE_ALL_VIDEOS, UserRight.MANAGE_ACCOUNTS_BLOCKLIST, - UserRight.MANAGE_SERVERS_BLOCKLIST + UserRight.MANAGE_SERVERS_BLOCKLIST, + UserRight.MANAGE_USERS ], [UserRole.USER]: [] -- cgit v1.2.3 From 2f1548fda32c3ba9e53913270394eedfacd55986 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 8 Jan 2019 11:26:41 +0100 Subject: Add notifications in the client --- shared/models/users/user-notification-setting.model.ts | 7 +++---- shared/models/users/user-notification.model.ts | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'shared/models') diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts index f580e827e..531e12bba 100644 --- a/shared/models/users/user-notification-setting.model.ts +++ b/shared/models/users/user-notification-setting.model.ts @@ -1,8 +1,7 @@ export enum UserNotificationSettingValue { - NONE = 1, - WEB_NOTIFICATION = 2, - EMAIL = 3, - WEB_NOTIFICATION_AND_EMAIL = 4 + NONE = 0, + WEB = 1 << 0, + EMAIL = 1 << 1 } export interface UserNotificationSetting { diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index 9dd4f099f..f41b6f534 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -2,11 +2,15 @@ export enum UserNotificationType { NEW_VIDEO_FROM_SUBSCRIPTION = 1, NEW_COMMENT_ON_MY_VIDEO = 2, NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, + BLACKLIST_ON_MY_VIDEO = 4, UNBLACKLIST_ON_MY_VIDEO = 5, + MY_VIDEO_PUBLISHED = 6, + MY_VIDEO_IMPORT_SUCCESS = 7, MY_VIDEO_IMPORT_ERROR = 8, + NEW_USER_REGISTRATION = 9, NEW_FOLLOW = 10, COMMENT_MENTION = 11 -- cgit v1.2.3 From a4101923e699e49ceb9ff36e971c75417fafc9f0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 9 Jan 2019 15:14:29 +0100 Subject: Implement contact form on server side --- shared/models/server/contact-form.model.ts | 5 +++++ shared/models/server/custom-config.model.ts | 4 ++++ shared/models/server/index.ts | 6 ++++++ shared/models/server/server-config.model.ts | 4 ++++ 4 files changed, 19 insertions(+) create mode 100644 shared/models/server/contact-form.model.ts create mode 100644 shared/models/server/index.ts (limited to 'shared/models') diff --git a/shared/models/server/contact-form.model.ts b/shared/models/server/contact-form.model.ts new file mode 100644 index 000000000..0696be8b4 --- /dev/null +++ b/shared/models/server/contact-form.model.ts @@ -0,0 +1,5 @@ +export interface ContactForm { + fromEmail: string + fromName: string + body: string +} diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 028aafa1a..7a3eaa33f 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -41,6 +41,10 @@ export interface CustomConfig { email: string } + contactForm: { + enabled: boolean + } + user: { videoQuota: number videoQuotaDaily: number diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts new file mode 100644 index 000000000..c42f6f67f --- /dev/null +++ b/shared/models/server/index.ts @@ -0,0 +1,6 @@ +export * from './about.model' +export * from './contact-form.model' +export * from './custom-config.model' +export * from './job.model' +export * from './server-config.model' +export * from './server-stats.model' diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index a6d28e05e..7031009d9 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -19,6 +19,10 @@ export interface ServerConfig { enabled: boolean } + contactForm: { + enabled: boolean + } + signup: { allowed: boolean, allowedForCurrentIP: boolean, -- cgit v1.2.3 From 5abb9fbbd12e7097e348d6a38622d364b1fa47ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 10 Jan 2019 15:39:51 +0100 Subject: Add ability to unfederate a local video (on blacklist) --- shared/models/videos/blacklist/video-blacklist-create.model.ts | 1 + shared/models/videos/blacklist/video-blacklist.model.ts | 1 + 2 files changed, 2 insertions(+) (limited to 'shared/models') diff --git a/shared/models/videos/blacklist/video-blacklist-create.model.ts b/shared/models/videos/blacklist/video-blacklist-create.model.ts index 89c69cb56..6e7d36421 100644 --- a/shared/models/videos/blacklist/video-blacklist-create.model.ts +++ b/shared/models/videos/blacklist/video-blacklist-create.model.ts @@ -1,3 +1,4 @@ export interface VideoBlacklistCreate { reason?: string + unfederate?: boolean } diff --git a/shared/models/videos/blacklist/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.ts index ef4e5e3a2..4bd976190 100644 --- a/shared/models/videos/blacklist/video-blacklist.model.ts +++ b/shared/models/videos/blacklist/video-blacklist.model.ts @@ -2,6 +2,7 @@ export interface VideoBlacklist { id: number createdAt: Date updatedAt: Date + unfederated: boolean reason?: string video: { -- cgit v1.2.3 From 9b4b15f91c485f9a7fe2ed314b4101f4b7506b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20B=C3=A9ranger?= <43744761+auberanger@users.noreply.github.com> Date: Mon, 14 Jan 2019 09:06:48 +0100 Subject: WIP : Indicate to users how "trending" works (#1458) * Get the INTERVAL_DAYS const in the video-trending component * Change Trending section title * Add a tooltip to explain how trending section works * Minor CSS fix for the my-feed popover next to the titlepage --- shared/models/server/server-config.model.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'shared/models') diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 7031009d9..f4245ed4d 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -78,4 +78,10 @@ export interface ServerConfig { videoQuota: number videoQuotaDaily: number } + + trending: { + videos: { + intervalDays: number + } + } } -- cgit v1.2.3 From 44b9c0ba31c4a97e3d874f33226ad935c3a90dd5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Jan 2019 09:45:54 +0100 Subject: Add totalLocalVideoFilesSize in stats --- shared/models/server/server-stats.model.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'shared/models') diff --git a/shared/models/server/server-stats.model.ts b/shared/models/server/server-stats.model.ts index a6bd2d4d3..74f3de5d3 100644 --- a/shared/models/server/server-stats.model.ts +++ b/shared/models/server/server-stats.model.ts @@ -5,6 +5,7 @@ export interface ServerStats { totalLocalVideos: number totalLocalVideoViews: number totalLocalVideoComments: number + totalLocalVideoFilesSize: number totalVideos: number totalVideoComments: number -- cgit v1.2.3 From 848f499def54db2dd36437ef0dfb74dd5041c23b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Jan 2019 11:14:12 +0100 Subject: Prepare Dislike/Flag/View fixes For now we Create these activities, but we should just send them directly. This fix handles correctly direct Dislikes/Flags/Views, we'll implement the sending correctly these activities in the next peertube version --- shared/models/activitypub/activity.ts | 31 +++++++++++++++++++---- shared/models/activitypub/objects/object.model.ts | 1 + 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 shared/models/activitypub/objects/object.model.ts (limited to 'shared/models') diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts index 44cb99efb..89994f665 100644 --- a/shared/models/activitypub/activity.ts +++ b/shared/models/activitypub/activity.ts @@ -5,12 +5,14 @@ import { DislikeObject } from './objects/dislike-object' import { VideoAbuseObject } from './objects/video-abuse-object' import { VideoCommentObject } from './objects/video-comment-object' import { ViewObject } from './objects/view-object' +import { APObject } from './objects/object.model' export type Activity = ActivityCreate | ActivityUpdate | ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | - ActivityUndo | ActivityLike | ActivityReject + ActivityUndo | ActivityLike | ActivityReject | ActivityView | ActivityDislike | ActivityFlag -export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' +export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' | + 'View' | 'Dislike' | 'Flag' export interface ActivityAudience { to: string[] @@ -59,15 +61,34 @@ export interface ActivityReject extends BaseActivity { export interface ActivityAnnounce extends BaseActivity { type: 'Announce' - object: string | { id: string } + object: APObject } export interface ActivityUndo extends BaseActivity { type: 'Undo', - object: ActivityFollow | ActivityLike | ActivityCreate | ActivityAnnounce + object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce } export interface ActivityLike extends BaseActivity { type: 'Like', - object: string + object: APObject +} + +export interface ActivityView extends BaseActivity { + type: 'View', + actor: string + object: APObject +} + +export interface ActivityDislike extends BaseActivity { + id: string + type: 'Dislike' + actor: string + object: APObject +} + +export interface ActivityFlag extends BaseActivity { + type: 'Flag', + content: string, + object: APObject } diff --git a/shared/models/activitypub/objects/object.model.ts b/shared/models/activitypub/objects/object.model.ts new file mode 100644 index 000000000..3fd33800a --- /dev/null +++ b/shared/models/activitypub/objects/object.model.ts @@ -0,0 +1 @@ +export type APObject = string | { id: string } -- cgit v1.2.3 From 457bb213b273a9b206cc5654eb085cede4e916ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Jan 2019 16:05:40 +0100 Subject: Refactor how we use icons Inject them in an angular component so we can easily change their color --- shared/models/actors/actor.model.ts | 2 +- shared/models/users/user-notification.model.ts | 30 +++++++++++--------------- shared/models/videos/video.model.ts | 4 ++-- 3 files changed, 16 insertions(+), 20 deletions(-) (limited to 'shared/models') diff --git a/shared/models/actors/actor.model.ts b/shared/models/actors/actor.model.ts index 6b3b1b47c..a3953874d 100644 --- a/shared/models/actors/actor.model.ts +++ b/shared/models/actors/actor.model.ts @@ -10,5 +10,5 @@ export interface Actor { followersCount: number createdAt: Date | string updatedAt: Date | string - avatar: Avatar + avatar?: Avatar } diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index f41b6f534..eaeb422df 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -22,16 +22,22 @@ export interface VideoInfo { name: string } +export interface ActorInfo { + id: number + displayName: string + name: string + avatar?: { + path: string + } +} + export interface UserNotification { id: number type: UserNotificationType read: boolean video?: VideoInfo & { - channel: { - id: number - displayName: string - } + channel: ActorInfo } videoImport?: { @@ -45,10 +51,7 @@ export interface UserNotification { comment?: { id: number threadId: number - account: { - id: number - displayName: string - } + account: ActorInfo video: VideoInfo } @@ -62,18 +65,11 @@ export interface UserNotification { video: VideoInfo } - account?: { - id: number - displayName: string - name: string - } + account?: ActorInfo actorFollow?: { id: number - follower: { - name: string - displayName: string - } + follower: ActorInfo following: { type: 'account' | 'channel' name: string diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 4a9fa58b1..022876a0b 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts @@ -24,7 +24,7 @@ export interface VideoChannelAttribute { displayName: string url: string host: string - avatar: Avatar + avatar?: Avatar } export interface AccountAttribute { @@ -34,7 +34,7 @@ export interface AccountAttribute { displayName: string url: string host: string - avatar: Avatar + avatar?: Avatar } export interface Video { -- cgit v1.2.3 From 38967f7b73cec6f6198c72d62f8d64bb88e6951c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Jan 2019 13:52:46 +0100 Subject: Add server host in notification account field --- shared/models/users/user-notification.model.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'shared/models') diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index eaeb422df..186b62612 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -26,6 +26,7 @@ export interface ActorInfo { id: number displayName: string name: string + host: string avatar?: { path: string } -- cgit v1.2.3 From 092092969633bbcf6d4891a083ea497a7d5c3154 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 29 Jan 2019 08:37:25 +0100 Subject: Add hls support on server --- .../activitypub/objects/cache-file-object.ts | 4 +- .../models/activitypub/objects/common-objects.ts | 60 +++++++++++++++------- shared/models/server/custom-config.model.ts | 3 ++ shared/models/server/server-config.model.ts | 8 ++- .../videos/video-streaming-playlist.model.ts | 12 +++++ .../models/videos/video-streaming-playlist.type.ts | 3 ++ shared/models/videos/video.model.ts | 5 ++ 7 files changed, 72 insertions(+), 23 deletions(-) create mode 100644 shared/models/videos/video-streaming-playlist.model.ts create mode 100644 shared/models/videos/video-streaming-playlist.type.ts (limited to 'shared/models') diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/shared/models/activitypub/objects/cache-file-object.ts index 0a5125f5b..4b0a3a724 100644 --- a/shared/models/activitypub/objects/cache-file-object.ts +++ b/shared/models/activitypub/objects/cache-file-object.ts @@ -1,9 +1,9 @@ -import { ActivityVideoUrlObject } from './common-objects' +import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objects' export interface CacheFileObject { id: string type: 'CacheFile', object: string expires: string - url: ActivityVideoUrlObject + url: ActivityVideoUrlObject | ActivityPlaylistUrlObject } diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index 118a4f43d..8c89810d6 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts @@ -28,25 +28,47 @@ export type ActivityVideoUrlObject = { fps: number } -export type ActivityUrlObject = - ActivityVideoUrlObject - | - { - type: 'Link' - // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) - mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' - mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' - href: string - height: number - } - | - { - type: 'Link' - // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) - mimeType?: 'text/html' - mediaType: 'text/html' - href: string - } +export type ActivityPlaylistSegmentHashesObject = { + type: 'Link' + name: 'sha256' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'application/json' + mediaType: 'application/json' + href: string +} + +export type ActivityPlaylistInfohashesObject = { + type: 'Infohash' + name: string +} + +export type ActivityPlaylistUrlObject = { + type: 'Link' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'application/x-mpegURL' + mediaType: 'application/x-mpegURL' + href: string + tag?: (ActivityPlaylistSegmentHashesObject | ActivityPlaylistInfohashesObject)[] +} + +export type ActivityBitTorrentUrlObject = { + type: 'Link' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + href: string + height: number +} + +export type ActivityHtmlUrlObject = { + type: 'Link' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'text/html' + mediaType: 'text/html' + href: string +} + +export type ActivityUrlObject = ActivityVideoUrlObject | ActivityPlaylistUrlObject | ActivityBitTorrentUrlObject | ActivityHtmlUrlObject export interface ActivityPubAttributedTo { type: 'Group' | 'Person' diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 7a3eaa33f..b42ff90c6 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -61,6 +61,9 @@ export interface CustomConfig { '720p': boolean '1080p': boolean } + hls: { + enabled: boolean + } } import: { diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index f4245ed4d..baafed31f 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -25,11 +25,15 @@ export interface ServerConfig { signup: { allowed: boolean, - allowedForCurrentIP: boolean, + allowedForCurrentIP: boolean requiresEmailVerification: boolean } transcoding: { + hls: { + enabled: boolean + } + enabledResolutions: number[] } @@ -48,7 +52,7 @@ export interface ServerConfig { file: { size: { max: number - }, + } extensions: string[] } } diff --git a/shared/models/videos/video-streaming-playlist.model.ts b/shared/models/videos/video-streaming-playlist.model.ts new file mode 100644 index 000000000..17f8fe865 --- /dev/null +++ b/shared/models/videos/video-streaming-playlist.model.ts @@ -0,0 +1,12 @@ +import { VideoStreamingPlaylistType } from './video-streaming-playlist.type' + +export class VideoStreamingPlaylist { + id: number + type: VideoStreamingPlaylistType + playlistUrl: string + segmentsSha256Url: string + + redundancies: { + baseUrl: string + }[] +} diff --git a/shared/models/videos/video-streaming-playlist.type.ts b/shared/models/videos/video-streaming-playlist.type.ts new file mode 100644 index 000000000..3b403f295 --- /dev/null +++ b/shared/models/videos/video-streaming-playlist.type.ts @@ -0,0 +1,3 @@ +export enum VideoStreamingPlaylistType { + HLS = 1 +} diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 022876a0b..803db8255 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts @@ -5,6 +5,7 @@ import { VideoChannel } from './channel/video-channel.model' import { VideoPrivacy } from './video-privacy.enum' import { VideoScheduleUpdate } from './video-schedule-update.model' import { VideoConstant } from './video-constant.model' +import { VideoStreamingPlaylist } from './video-streaming-playlist.model' export interface VideoFile { magnetUri: string @@ -86,4 +87,8 @@ export interface VideoDetails extends Video { // Not optional in details (unlike in Video) waitTranscoding: boolean state: VideoConstant + + trackerUrls: string[] + + streamingPlaylists: VideoStreamingPlaylist[] } -- cgit v1.2.3 From 4c280004ce62bf11ddb091854c28f1e1d54a54d6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Feb 2019 15:08:19 +0100 Subject: Use a single file instead of segments for HLS --- shared/models/activitypub/activitypub-ordered-collection.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shared/models') diff --git a/shared/models/activitypub/activitypub-ordered-collection.ts b/shared/models/activitypub/activitypub-ordered-collection.ts index dfec0bb76..3de0890bb 100644 --- a/shared/models/activitypub/activitypub-ordered-collection.ts +++ b/shared/models/activitypub/activitypub-ordered-collection.ts @@ -2,6 +2,9 @@ export interface ActivityPubOrderedCollection { '@context': string[] type: 'OrderedCollection' | 'OrderedCollectionPage' totalItems: number - partOf?: string orderedItems: T[] + + partOf?: string + next?: string + first?: string } -- cgit v1.2.3 From b426edd4854adc6e65844d8c54b8998e792b5778 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 11 Feb 2019 09:30:29 +0100 Subject: Cleanup reset user password by admin And add some tests --- shared/models/users/user-update.model.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'shared/models') diff --git a/shared/models/users/user-update.model.ts b/shared/models/users/user-update.model.ts index abde51321..cd215bab3 100644 --- a/shared/models/users/user-update.model.ts +++ b/shared/models/users/user-update.model.ts @@ -1,6 +1,7 @@ import { UserRole } from './user-role' export interface UserUpdate { + password?: string email?: string emailVerified?: boolean videoQuota?: number -- cgit v1.2.3