aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts18
-rw-r--r--server/initializers/database.ts4
2 files changed, 19 insertions, 3 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index bec343bb7..fdd772d84 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -8,6 +8,7 @@ import { VideoPrivacy } from '../../shared/models/videos'
8import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' 8import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
9import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 9import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
10import { invert } from 'lodash' 10import { invert } from 'lodash'
11import { VideoImportState } from '../../shared/models/videos/video-import-state.enum'
11 12
12// Use a variable to reload the configuration if we need 13// Use a variable to reload the configuration if we need
13let config: IConfig = require('config') 14let config: IConfig = require('config')
@@ -85,6 +86,7 @@ const JOB_ATTEMPTS: { [ id in JobType ]: number } = {
85 'activitypub-follow': 5, 86 'activitypub-follow': 5,
86 'video-file-import': 1, 87 'video-file-import': 1,
87 'video-file': 1, 88 'video-file': 1,
89 'video-import': 1,
88 'email': 5 90 'email': 5
89} 91}
90const JOB_CONCURRENCY: { [ id in JobType ]: number } = { 92const JOB_CONCURRENCY: { [ id in JobType ]: number } = {
@@ -94,6 +96,7 @@ const JOB_CONCURRENCY: { [ id in JobType ]: number } = {
94 'activitypub-follow': 3, 96 'activitypub-follow': 3,
95 'video-file-import': 1, 97 'video-file-import': 1,
96 'video-file': 1, 98 'video-file': 1,
99 'video-import': 1,
97 'email': 5 100 'email': 5
98} 101}
99const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job 102const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job
@@ -248,6 +251,9 @@ const CONSTRAINTS_FIELDS = {
248 } 251 }
249 } 252 }
250 }, 253 },
254 VIDEO_IMPORTS: {
255 URL: { min: 3, max: 2000 } // Length
256 },
251 VIDEOS: { 257 VIDEOS: {
252 NAME: { min: 3, max: 120 }, // Length 258 NAME: { min: 3, max: 120 }, // Length
253 LANGUAGE: { min: 1, max: 10 }, // Length 259 LANGUAGE: { min: 1, max: 10 }, // Length
@@ -262,7 +268,7 @@ const CONSTRAINTS_FIELDS = {
262 }, 268 },
263 EXTNAME: [ '.mp4', '.ogv', '.webm' ], 269 EXTNAME: [ '.mp4', '.ogv', '.webm' ],
264 INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2 270 INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2
265 DURATION: { min: 1 }, // Number 271 DURATION: { min: 0 }, // Number
266 TAGS: { min: 0, max: 5 }, // Number of total tags 272 TAGS: { min: 0, max: 5 }, // Number of total tags
267 TAG: { min: 2, max: 30 }, // Length 273 TAG: { min: 2, max: 30 }, // Length
268 THUMBNAIL: { min: 2, max: 30 }, 274 THUMBNAIL: { min: 2, max: 30 },
@@ -363,7 +369,14 @@ const VIDEO_PRIVACIES = {
363 369
364const VIDEO_STATES = { 370const VIDEO_STATES = {
365 [VideoState.PUBLISHED]: 'Published', 371 [VideoState.PUBLISHED]: 'Published',
366 [VideoState.TO_TRANSCODE]: 'To transcode' 372 [VideoState.TO_TRANSCODE]: 'To transcode',
373 [VideoState.TO_IMPORT]: 'To import'
374}
375
376const VIDEO_IMPORT_STATES = {
377 [VideoImportState.FAILED]: 'Failed',
378 [VideoImportState.PENDING]: 'Pending',
379 [VideoImportState.SUCCESS]: 'Success'
367} 380}
368 381
369const VIDEO_MIMETYPE_EXT = { 382const VIDEO_MIMETYPE_EXT = {
@@ -585,6 +598,7 @@ export {
585 RATES_LIMIT, 598 RATES_LIMIT,
586 VIDEO_EXT_MIMETYPE, 599 VIDEO_EXT_MIMETYPE,
587 JOB_COMPLETED_LIFETIME, 600 JOB_COMPLETED_LIFETIME,
601 VIDEO_IMPORT_STATES,
588 VIDEO_VIEW_LIFETIME, 602 VIDEO_VIEW_LIFETIME,
589 buildLanguages 603 buildLanguages
590} 604}
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index 21c083084..0be752363 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -24,6 +24,7 @@ import { VideoTagModel } from '../models/video/video-tag'
24import { CONFIG } from './constants' 24import { CONFIG } from './constants'
25import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update' 25import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update'
26import { VideoCaptionModel } from '../models/video/video-caption' 26import { VideoCaptionModel } from '../models/video/video-caption'
27import { VideoImportModel } from '../models/video/video-import'
27 28
28require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string 29require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string
29 30
@@ -81,7 +82,8 @@ async function initDatabaseModels (silent: boolean) {
81 VideoTagModel, 82 VideoTagModel,
82 VideoModel, 83 VideoModel,
83 VideoCommentModel, 84 VideoCommentModel,
84 ScheduleVideoUpdateModel 85 ScheduleVideoUpdateModel,
86 VideoImportModel
85 ]) 87 ])
86 88
87 // Check extensions exist in the database 89 // Check extensions exist in the database