X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.ts;h=020ed68daca5cbc9a7c6dc6a9e40c8e91da901a9;hb=cb0eda5602a21d1626a7face32de6153ed07b5f9;hp=824a30bd2f182ee727890035ed333894139f5110;hpb=5d2fd66ab4a75281dab6363ba9131adee7be3a2b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 824a30bd2..020ed68da 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -1,11 +1,14 @@ -import { CronRepeatOptions, EveryRepeatOptions } from 'bull' -import { randomBytes } from 'crypto' +import { RepeatOptions } from 'bullmq' +import { Encoding, randomBytes } from 'crypto' import { invert } from 'lodash' import { join } from 'path' import { randomInt, root } from '@shared/core-utils' import { AbuseState, JobType, + RunnerJobState, + UserRegistrationState, + VideoChannelSyncState, VideoImportState, VideoPrivacy, VideoRateType, @@ -19,12 +22,12 @@ import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model' // Do not use barrels, remain constants as independent as possible -import { isTestInstance, parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' +import { isTestInstance, isTestOrDevInstance, parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' import { CONFIG, registerConfigChangedHandler } from './config' // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 710 +const LAST_MIGRATION_VERSION = 775 // --------------------------------------------------------------------------- @@ -52,8 +55,12 @@ const WEBSERVER = { WS: '', HOSTNAME: '', PORT: 0, + RTMP_URL: '', - RTMPS_URL: '' + RTMPS_URL: '', + + RTMP_BASE_LIVE_URL: '', + RTMPS_BASE_LIVE_URL: '' } // Sortable columns per schema @@ -64,6 +71,7 @@ const SORTABLE_COLUMNS = { JOBS: [ 'createdAt' ], VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ], VIDEO_IMPORTS: [ 'createdAt' ], + VIDEO_CHANNEL_SYNCS: [ 'externalChannelUrl', 'videoChannel', 'createdAt', 'lastSyncAt', 'state' ], VIDEO_COMMENT_THREADS: [ 'createdAt', 'totalReplies' ], VIDEO_COMMENTS: [ 'createdAt' ], @@ -76,6 +84,12 @@ const SORTABLE_COLUMNS = { ACCOUNT_FOLLOWERS: [ 'createdAt' ], CHANNEL_FOLLOWERS: [ 'createdAt' ], + USER_REGISTRATIONS: [ 'createdAt', 'state' ], + + RUNNERS: [ 'createdAt' ], + RUNNER_REGISTRATION_TOKENS: [ 'createdAt' ], + RUNNER_JOBS: [ 'updatedAt', 'createdAt', 'priority', 'state', 'progress' ], + VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'trending', 'hot', 'best' ], // Don't forget to update peertube-search-index with the same values @@ -99,11 +113,6 @@ const SORTABLE_COLUMNS = { VIDEO_REDUNDANCIES: [ 'name' ] } -const OAUTH_LIFETIME = { - ACCESS_TOKEN: 3600 * 24, // 1 day, for upload - REFRESH_TOKEN: 1209600 // 2 weeks -} - const ROUTE_CACHE_LIFETIME = { FEEDS: '15 minutes', ROBOTS: '2 hours', @@ -114,7 +123,8 @@ const ROUTE_CACHE_LIFETIME = { ACTIVITY_PUB: { VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example }, - STATS: '4 hours' + STATS: '4 hours', + WELL_KNOWN: '1 day' } // --------------------------------------------------------------------------- @@ -129,7 +139,8 @@ const ACTOR_FOLLOW_SCORE = { const FOLLOW_STATES: { [ id: string ]: FollowState } = { PENDING: 'pending', - ACCEPTED: 'accepted' + ACCEPTED: 'accepted', + REJECTED: 'rejected' } const REMOTE_SCHEME = { @@ -137,8 +148,11 @@ const REMOTE_SCHEME = { WS: 'wss' } +// --------------------------------------------------------------------------- + const JOB_ATTEMPTS: { [id in JobType]: number } = { 'activitypub-http-broadcast': 1, + 'activitypub-http-broadcast-parallel': 1, 'activitypub-http-unicast': 1, 'activitypub-http-fetcher': 2, 'activitypub-follow': 5, @@ -154,12 +168,18 @@ const JOB_ATTEMPTS: { [id in JobType]: number } = { 'video-live-ending': 1, 'video-studio-edition': 1, 'manage-video-torrent': 1, - 'move-to-object-storage': 3 + 'video-channel-import': 1, + 'after-video-channel-import': 1, + 'move-to-object-storage': 3, + 'transcoding-job-builder': 1, + 'notify': 1, + 'federate-video': 1 } // Excluded keys are jobs that can be configured by admins const JOB_CONCURRENCY: { [id in Exclude]: number } = { 'activitypub-http-broadcast': 1, - 'activitypub-http-unicast': 10, + 'activitypub-http-broadcast-parallel': 30, + 'activitypub-http-unicast': 30, 'activitypub-http-fetcher': 3, 'activitypub-cleaner': 1, 'activitypub-follow': 1, @@ -172,10 +192,16 @@ const JOB_CONCURRENCY: { [id in Exclude