]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/constants.ts
Implement video comment list in admin
[github/Chocobozzz/PeerTube.git] / server / initializers / constants.ts
index a93fe3c516fb212fb0d4e86eb6b119fc8bfaad2d..fde87d9f8a65b7a2d783d007639e08873b29dfa9 100644 (file)
@@ -1,29 +1,30 @@
-import { join } from 'path'
+import { randomInt } from '../../shared/core-utils/miscs/miscs'
+import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
 import { randomBytes } from 'crypto'
-import { ActivityPubActorType } from '../../shared/models/activitypub'
-import { FollowState } from '../../shared/models/actors'
+import { invert } from 'lodash'
+import { join } from 'path'
 import {
   AbuseState,
+  JobType,
   VideoImportState,
   VideoPrivacy,
-  VideoTranscodingFPS,
-  JobType,
   VideoRateType,
   VideoResolution,
-  VideoState
+  VideoState,
+  VideoTranscodingFPS
 } from '../../shared/models'
-// Do not use barrels, remain constants as independent as possible
-import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils'
+import { ActivityPubActorType } from '../../shared/models/activitypub'
+import { FollowState } from '../../shared/models/actors'
 import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
-import { invert } from 'lodash'
-import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
 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, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
 import { CONFIG, registerConfigChangedHandler } from './config'
 
 // ---------------------------------------------------------------------------
 
-const LAST_MIGRATION_VERSION = 540
+const LAST_MIGRATION_VERSION = 550
 
 // ---------------------------------------------------------------------------
 
@@ -62,7 +63,10 @@ const SORTABLE_COLUMNS = {
   JOBS: [ 'createdAt' ],
   VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ],
   VIDEO_IMPORTS: [ 'createdAt' ],
+
   VIDEO_COMMENT_THREADS: [ 'createdAt', 'totalReplies' ],
+  VIDEO_COMMENTS: [ 'createdAt' ],
+
   VIDEO_RATES: [ 'createdAt' ],
   BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ],
   FOLLOWERS: [ 'createdAt', 'state', 'score' ],
@@ -172,7 +176,7 @@ const JOB_TTL: { [id in JobType]: number } = {
 }
 const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = {
   'videos-views': {
-    cron: '1 * * * *' // At 1 minute past the hour
+    cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour
   }
 }
 
@@ -316,7 +320,7 @@ const CONSTRAINTS_FIELDS = {
   }
 }
 
-let VIEW_LIFETIME = {
+const VIEW_LIFETIME = {
   VIDEO: 60000 * 60, // 1 hour
   LIVE: 60000 * 5 // 5 minutes
 }
@@ -512,6 +516,10 @@ const HTTP_SIGNATURE = {
   HEADER_NAME: 'signature',
   ALGORITHM: 'rsa-sha256',
   HEADERS_TO_SIGN: [ '(request-target)', 'host', 'date', 'digest' ],
+  REQUIRED_HEADERS: {
+    ALL: [ '(request-target)', 'host', 'date' ],
+    POST: [ '(request-target)', 'host', 'date', 'digest' ]
+  },
   CLOCK_SKEW_SECONDS: 1800
 }
 
@@ -615,6 +623,7 @@ const VIDEO_LIVE = {
   CLEANUP_DELAY: 1000 * 60 * 5, // 5 minutes
   SEGMENT_TIME_SECONDS: 4, // 4 seconds
   SEGMENTS_LIST_SIZE: 15, // 15 maximum segments in live playlist
+  EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION: 3,
   RTMP: {
     CHUNK_SIZE: 60000,
     GOP_CACHE: true,
@@ -745,6 +754,7 @@ if (isTestInstance() === true) {
 
   VIDEO_LIVE.CLEANUP_DELAY = 5000
   VIDEO_LIVE.SEGMENT_TIME_SECONDS = 2
+  VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION = 1
 }
 
 updateWebserverUrls()