import { JobType, VideoRateType, VideoState } from '../../shared/models'
import { ActivityPubActorType } from '../../shared/models/activitypub'
import { FollowState } from '../../shared/models/actors'
-import { VideoPrivacy } from '../../shared/models/videos'
+import { VideoPrivacy, VideoAbuseState, VideoImportState } from '../../shared/models/videos'
// Do not use barrels, remain constants as independent as possible
import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { invert } from 'lodash'
-import { VideoImportState } from '../../shared/models/videos/video-import-state.enum'
// Use a variable to reload the configuration if we need
let config: IConfig = require('config')
// ---------------------------------------------------------------------------
-const LAST_MIGRATION_VERSION = 240
+const LAST_MIGRATION_VERSION = 255
// ---------------------------------------------------------------------------
USERS: [ 'id', 'username', 'createdAt' ],
ACCOUNTS: [ 'createdAt' ],
JOBS: [ 'createdAt' ],
- VIDEO_ABUSES: [ 'id', 'createdAt' ],
+ VIDEO_ABUSES: [ 'id', 'createdAt', 'state' ],
VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ],
VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes' ],
VIDEO_IMPORTS: [ 'createdAt' ],
FEEDS: '15 minutes',
ROBOTS: '2 hours',
NODEINFO: '10 minutes',
+ DNT_POLICY: '1 week',
ACTIVITY_PUB: {
VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example
}
'video-import': 1,
'email': 5
}
+const JOB_TTL: { [ id in JobType ]: number } = {
+ 'activitypub-http-broadcast': 60000 * 10, // 10 minutes
+ 'activitypub-http-unicast': 60000 * 10, // 10 minutes
+ 'activitypub-http-fetcher': 60000 * 10, // 10 minutes
+ 'activitypub-follow': 60000 * 10, // 10 minutes
+ 'video-file-import': 1000 * 3600, // 1 hour
+ 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long
+ 'video-import': 1000 * 3600 * 5, // 5 hours
+ 'email': 60000 * 10 // 10 minutes
+}
const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job
const JOB_REQUEST_TIMEOUT = 3000 // 3 seconds
-const JOB_REQUEST_TTL = 60000 * 10 // 10 minutes
const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
// 1 hour
get '1080p' () { return config.get<boolean>('transcoding.resolutions.1080p') }
}
},
+ IMPORT: {
+ VIDEOS: {
+ HTTP: {
+ get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }
+ },
+ TORRENT: {
+ get ENABLED () { return config.get<boolean>('import.videos.torrent.enabled') }
+ }
+ }
+ },
CACHE: {
PREVIEWS: {
get SIZE () { return config.get<number>('cache.previews.size') }
DESCRIPTION: { min: 3, max: 250 }, // Length
USERNAME: { min: 3, max: 20 }, // Length
PASSWORD: { min: 6, max: 255 }, // Length
- VIDEO_QUOTA: { min: -1 }
+ VIDEO_QUOTA: { min: -1 },
+ BLOCKED_REASON: { min: 3, max: 250 } // Length
},
VIDEO_ABUSES: {
+ REASON: { min: 2, max: 300 }, // Length
+ MODERATION_COMMENT: { min: 2, max: 300 } // Length
+ },
+ VIDEO_BLACKLIST: {
REASON: { min: 2, max: 300 } // Length
},
VIDEO_CHANNELS: {
}
},
VIDEO_IMPORTS: {
- URL: { min: 3, max: 2000 } // Length
+ URL: { min: 3, max: 2000 }, // Length
+ TORRENT_NAME: { min: 3, max: 255 }, // Length
+ TORRENT_FILE: {
+ EXTNAME: [ '.torrent' ],
+ FILE_SIZE: {
+ max: 1024 * 200 // 200 KB
+ }
+ }
},
VIDEOS: {
NAME: { min: 3, max: 120 }, // Length
[VideoImportState.SUCCESS]: 'Success'
}
+const VIDEO_ABUSE_STATES = {
+ [VideoAbuseState.PENDING]: 'Pending',
+ [VideoAbuseState.REJECTED]: 'Rejected',
+ [VideoAbuseState.ACCEPTED]: 'Accepted'
+}
+
const VIDEO_MIMETYPE_EXT = {
'video/webm': '.webm',
'video/ogg': '.ogv',
'application/x-subrip': '.srt'
}
+const TORRENT_MIMETYPE_EXT = {
+ 'application/x-bittorrent': '.torrent'
+}
+
// ---------------------------------------------------------------------------
const SERVER_ACTOR_NAME = 'peertube'
ROUTE_CACHE_LIFETIME,
SORTABLE_COLUMNS,
FEEDS,
+ JOB_TTL,
NSFW_POLICY_TYPES,
+ TORRENT_MIMETYPE_EXT,
STATIC_MAX_AGE,
STATIC_PATHS,
ACTIVITY_PUB,
VIDEO_MIMETYPE_EXT,
VIDEO_TRANSCODING_FPS,
FFMPEG_NICE,
+ VIDEO_ABUSE_STATES,
JOB_REQUEST_TIMEOUT,
- JOB_REQUEST_TTL,
USER_PASSWORD_RESET_LIFETIME,
IMAGE_MIMETYPE_EXT,
SCHEDULER_INTERVALS_MS,