diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-26 10:55:40 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | 418d092afa81e2c8fe8ac6838fc4b5eb0af6a782 (patch) | |
tree | 5e9bc5604fd5d66a006cfebb7acdbdd5486e5d1e /server/initializers | |
parent | b427febb4d5cebf03b815bca2c59af6e82491569 (diff) | |
download | PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.gz PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.zst PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.zip |
Playlist server API
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.ts | 23 | ||||
-rw-r--r-- | server/initializers/database.ts | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 0d9a6a512..154a9cffe 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -10,6 +10,7 @@ import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | |||
10 | import { invert } from 'lodash' | 10 | import { invert } from 'lodash' |
11 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' | 11 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' |
12 | import * as bytes from 'bytes' | 12 | import * as bytes from 'bytes' |
13 | import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' | ||
13 | 14 | ||
14 | // Use a variable to reload the configuration if we need | 15 | // Use a variable to reload the configuration if we need |
15 | let config: IConfig = require('config') | 16 | let config: IConfig = require('config') |
@@ -52,7 +53,9 @@ const SORTABLE_COLUMNS = { | |||
52 | ACCOUNTS_BLOCKLIST: [ 'createdAt' ], | 53 | ACCOUNTS_BLOCKLIST: [ 'createdAt' ], |
53 | SERVERS_BLOCKLIST: [ 'createdAt' ], | 54 | SERVERS_BLOCKLIST: [ 'createdAt' ], |
54 | 55 | ||
55 | USER_NOTIFICATIONS: [ 'createdAt' ] | 56 | USER_NOTIFICATIONS: [ 'createdAt' ], |
57 | |||
58 | VIDEO_PLAYLISTS: [ 'createdAt' ] | ||
56 | } | 59 | } |
57 | 60 | ||
58 | const OAUTH_LIFETIME = { | 61 | const OAUTH_LIFETIME = { |
@@ -386,6 +389,17 @@ let CONSTRAINTS_FIELDS = { | |||
386 | FILE_SIZE: { min: 10 }, | 389 | FILE_SIZE: { min: 10 }, |
387 | URL: { min: 3, max: 2000 } // Length | 390 | URL: { min: 3, max: 2000 } // Length |
388 | }, | 391 | }, |
392 | VIDEO_PLAYLISTS: { | ||
393 | NAME: { min: 1, max: 120 }, // Length | ||
394 | DESCRIPTION: { min: 3, max: 1000 }, // Length | ||
395 | URL: { min: 3, max: 2000 }, // Length | ||
396 | IMAGE: { | ||
397 | EXTNAME: [ '.jpg', '.jpeg' ], | ||
398 | FILE_SIZE: { | ||
399 | max: 2 * 1024 * 1024 // 2MB | ||
400 | } | ||
401 | } | ||
402 | }, | ||
389 | ACTORS: { | 403 | ACTORS: { |
390 | PUBLIC_KEY: { min: 10, max: 5000 }, // Length | 404 | PUBLIC_KEY: { min: 10, max: 5000 }, // Length |
391 | PRIVATE_KEY: { min: 10, max: 5000 }, // Length | 405 | PRIVATE_KEY: { min: 10, max: 5000 }, // Length |
@@ -502,6 +516,12 @@ const VIDEO_ABUSE_STATES = { | |||
502 | [VideoAbuseState.ACCEPTED]: 'Accepted' | 516 | [VideoAbuseState.ACCEPTED]: 'Accepted' |
503 | } | 517 | } |
504 | 518 | ||
519 | const VIDEO_PLAYLIST_PRIVACIES = { | ||
520 | [VideoPlaylistPrivacy.PUBLIC]: 'Public', | ||
521 | [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted', | ||
522 | [VideoPlaylistPrivacy.PRIVATE]: 'Private' | ||
523 | } | ||
524 | |||
505 | const MIMETYPES = { | 525 | const MIMETYPES = { |
506 | VIDEO: { | 526 | VIDEO: { |
507 | MIMETYPE_EXT: buildVideoMimetypeExt(), | 527 | MIMETYPE_EXT: buildVideoMimetypeExt(), |
@@ -786,6 +806,7 @@ export { | |||
786 | VIDEO_IMPORT_STATES, | 806 | VIDEO_IMPORT_STATES, |
787 | VIDEO_VIEW_LIFETIME, | 807 | VIDEO_VIEW_LIFETIME, |
788 | CONTACT_FORM_LIFETIME, | 808 | CONTACT_FORM_LIFETIME, |
809 | VIDEO_PLAYLIST_PRIVACIES, | ||
789 | buildLanguages | 810 | buildLanguages |
790 | } | 811 | } |
791 | 812 | ||
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index fe296142d..541ebbecf 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -34,6 +34,8 @@ import { ServerBlocklistModel } from '../models/server/server-blocklist' | |||
34 | import { UserNotificationModel } from '../models/account/user-notification' | 34 | import { UserNotificationModel } from '../models/account/user-notification' |
35 | import { UserNotificationSettingModel } from '../models/account/user-notification-setting' | 35 | import { UserNotificationSettingModel } from '../models/account/user-notification-setting' |
36 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' | 36 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' |
37 | import { VideoPlaylistModel } from '../models/video/video-playlist' | ||
38 | import { VideoPlaylistElementModel } from '../models/video/video-playlist-element' | ||
37 | 39 | ||
38 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string | 40 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string |
39 | 41 | ||
@@ -101,7 +103,9 @@ async function initDatabaseModels (silent: boolean) { | |||
101 | ServerBlocklistModel, | 103 | ServerBlocklistModel, |
102 | UserNotificationModel, | 104 | UserNotificationModel, |
103 | UserNotificationSettingModel, | 105 | UserNotificationSettingModel, |
104 | VideoStreamingPlaylistModel | 106 | VideoStreamingPlaylistModel, |
107 | VideoPlaylistModel, | ||
108 | VideoPlaylistElementModel | ||
105 | ]) | 109 | ]) |
106 | 110 | ||
107 | // Check extensions exist in the database | 111 | // Check extensions exist in the database |