aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-26 10:55:40 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-03-18 11:17:59 +0100
commit418d092afa81e2c8fe8ac6838fc4b5eb0af6a782 (patch)
tree5e9bc5604fd5d66a006cfebb7acdbdd5486e5d1e /server/initializers
parentb427febb4d5cebf03b815bca2c59af6e82491569 (diff)
downloadPeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.gz
PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.zst
PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.zip
Playlist server API
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts23
-rw-r--r--server/initializers/database.ts6
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'
10import { invert } from 'lodash' 10import { invert } from 'lodash'
11import { CronRepeatOptions, EveryRepeatOptions } from 'bull' 11import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
12import * as bytes from 'bytes' 12import * as bytes from 'bytes'
13import { 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
15let config: IConfig = require('config') 16let 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
58const OAUTH_LIFETIME = { 61const 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
519const VIDEO_PLAYLIST_PRIVACIES = {
520 [VideoPlaylistPrivacy.PUBLIC]: 'Public',
521 [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted',
522 [VideoPlaylistPrivacy.PRIVATE]: 'Private'
523}
524
505const MIMETYPES = { 525const 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'
34import { UserNotificationModel } from '../models/account/user-notification' 34import { UserNotificationModel } from '../models/account/user-notification'
35import { UserNotificationSettingModel } from '../models/account/user-notification-setting' 35import { UserNotificationSettingModel } from '../models/account/user-notification-setting'
36import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' 36import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'
37import { VideoPlaylistModel } from '../models/video/video-playlist'
38import { VideoPlaylistElementModel } from '../models/video/video-playlist-element'
37 39
38require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string 40require('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