X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.ts;h=4703e20f28acc50372afb205cb14c3a2cc3158dd;hb=7b97127e8ba718d673b8a43afa964d136723e6a2;hp=175935835bcba09b363fd1e2055ca5da2a92e120;hpb=e722fb5923ddf11d72e48cec9788abc64327c22f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 175935835..4703e20f2 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -1,11 +1,13 @@ -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, + UserRegistrationState, + VideoChannelSyncState, VideoImportState, VideoPrivacy, VideoRateType, @@ -19,12 +21,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 = 715 +const LAST_MIGRATION_VERSION = 755 // --------------------------------------------------------------------------- @@ -64,6 +66,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 +79,8 @@ const SORTABLE_COLUMNS = { ACCOUNT_FOLLOWERS: [ 'createdAt' ], CHANNEL_FOLLOWERS: [ 'createdAt' ], + USER_REGISTRATIONS: [ 'createdAt', 'state' ], + 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 +104,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 +114,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 +130,8 @@ const ACTOR_FOLLOW_SCORE = { const FOLLOW_STATES: { [ id: string ]: FollowState } = { PENDING: 'pending', - ACCEPTED: 'accepted' + ACCEPTED: 'accepted', + REJECTED: 'rejected' } const REMOTE_SCHEME = { @@ -155,13 +157,17 @@ 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, + '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-broadcast-parallel': 30, - 'activitypub-http-unicast': 10, + 'activitypub-http-unicast': 30, 'activitypub-http-fetcher': 3, 'activitypub-cleaner': 1, 'activitypub-follow': 1, @@ -174,7 +180,11 @@ const JOB_CONCURRENCY: { [id in Exclude