X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.ts;h=7d9ffc6682186fb41638d71d3dd7e11f1cb51796;hb=883993c81ecc2388d4a4b37b29b81b6de73d264f;hp=7a3ec387415762deba0e8ef2afdb1b115b8ec456;hpb=d74d29ad9e35929491cf37223398d2535ab23de0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 7a3ec3874..7d9ffc668 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -18,7 +18,7 @@ let config: IConfig = require('config') // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 345 +const LAST_MIGRATION_VERSION = 355 // --------------------------------------------------------------------------- @@ -100,36 +100,40 @@ const REMOTE_SCHEME = { WS: 'wss' } -const JOB_ATTEMPTS: { [ id in JobType ]: number } = { +// TODO: remove 'video-file' +const JOB_ATTEMPTS: { [ id in (JobType | 'video-file') ]: number } = { 'activitypub-http-broadcast': 5, 'activitypub-http-unicast': 5, 'activitypub-http-fetcher': 5, 'activitypub-follow': 5, 'video-file-import': 1, + 'video-transcoding': 1, 'video-file': 1, 'video-import': 1, 'email': 5, 'videos-views': 1, 'activitypub-refresher': 1 } -const JOB_CONCURRENCY: { [ id in JobType ]: number } = { +const JOB_CONCURRENCY: { [ id in (JobType | 'video-file') ]: number } = { 'activitypub-http-broadcast': 1, 'activitypub-http-unicast': 5, 'activitypub-http-fetcher': 1, 'activitypub-follow': 3, 'video-file-import': 1, + 'video-transcoding': 1, 'video-file': 1, 'video-import': 1, 'email': 5, 'videos-views': 1, 'activitypub-refresher': 1 } -const JOB_TTL: { [ id in JobType ]: number } = { +const JOB_TTL: { [ id in (JobType | 'video-file') ]: 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-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long 'video-import': 1000 * 3600 * 2, // hours 'email': 60000 * 10, // 10 minutes @@ -284,6 +288,13 @@ const CONFIG = { } } }, + AUTO_BLACKLIST: { + VIDEOS: { + OF_USERS: { + get ENABLED () { return config.get('auto_blacklist.videos.of_users.enabled') } + } + } + }, CACHE: { PREVIEWS: { get SIZE () { return config.get('cache.previews.size') } @@ -313,6 +324,12 @@ const CONFIG = { get USERNAME () { return config.get('services.twitter.username') }, get WHITELISTED () { return config.get('services.twitter.whitelisted') } } + }, + FOLLOWERS: { + INSTANCE: { + get ENABLED () { return config.get('followers.instance.enabled') }, + get MANUAL_APPROVAL () { return config.get('followers.instance.manual_approval') } + } } } @@ -715,6 +732,8 @@ const TRACKER_RATE_LIMITS = { ANNOUNCES_PER_IP: 30 // maximum announces for all our torrents in the interval } +const P2P_MEDIA_LOADER_PEER_VERSION = 2 + // --------------------------------------------------------------------------- // Special constants for a test instance @@ -761,6 +780,7 @@ updateWebserverUrls() export { API_VERSION, HLS_REDUNDANCY_DIRECTORY, + P2P_MEDIA_LOADER_PEER_VERSION, AVATARS_SIZE, ACCEPT_HEADERS, BCRYPT_SALT_SIZE, @@ -881,6 +901,8 @@ function buildVideosExtname () { function buildVideosRedundancy (objs: any[]): VideosRedundancy[] { if (!objs) return [] + if (!Array.isArray(objs)) return objs + return objs.map(obj => { return Object.assign({}, obj, { minLifetime: parseDuration(obj.min_lifetime),