]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/checker-after-init.ts
server: serve files from storage/well-known (#5214)
[github/Chocobozzz/PeerTube.git] / server / initializers / checker-after-init.ts
index e542a539556368ffbab5a84d6599ceea886777c3..42839d1c97434ac445d5694481249c393f37b22c 100644 (file)
@@ -1,7 +1,7 @@
 import config from 'config'
-import { uniq } from 'lodash'
 import { URL } from 'url'
 import { getFFmpegVersion } from '@server/helpers/ffmpeg'
+import { uniqify } from '@shared/core-utils'
 import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type'
 import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
 import { isProdInstance, parseSemVersion } from '../helpers/core-utils'
@@ -48,6 +48,7 @@ function checkConfig () {
   checkRemoteRedundancyConfig()
   checkStorageConfig()
   checkTranscodingConfig()
+  checkImportConfig()
   checkBroadcastMessageConfig()
   checkSearchConfig()
   checkLiveConfig()
@@ -78,10 +79,14 @@ async function applicationExist () {
 
 async function checkFFmpegVersion () {
   const version = await getFFmpegVersion()
-  const { major, minor } = parseSemVersion(version)
+  const { major, minor, patch } = parseSemVersion(version)
 
   if (major < 4 || (major === 4 && minor < 1)) {
-    logger.warn('Your ffmpeg version (%s) is outdated. PeerTube supports ffmpeg >= 4.1. Please upgrade.', version)
+    logger.warn('Your ffmpeg version (%s) is outdated. PeerTube supports ffmpeg >= 4.1. Please upgrade ffmpeg.', version)
+  }
+
+  if (major === 4 && minor === 4 && patch === 0) {
+    logger.warn('There is a bug in ffmpeg 4.4.0 with HLS videos. Please upgrade ffmpeg.')
   }
 }
 
@@ -136,7 +141,7 @@ function checkLocalRedundancyConfig () {
       }
     }
 
-    const filtered = uniq(redundancyVideos.map(r => r.strategy))
+    const filtered = uniqify(redundancyVideos.map(r => r.strategy))
     if (filtered.length !== redundancyVideos.length) {
       throw new Error('Redundancy video entries should have unique strategies')
     }
@@ -196,6 +201,12 @@ function checkTranscodingConfig () {
   }
 }
 
+function checkImportConfig () {
+  if (CONFIG.IMPORT.VIDEO_CHANNEL_SYNCHRONIZATION.ENABLED && !CONFIG.IMPORT.VIDEOS.HTTP) {
+    throw new Error('You need to enable HTTP import to allow synchronization')
+  }
+}
+
 function checkBroadcastMessageConfig () {
   if (CONFIG.BROADCAST_MESSAGE.ENABLED) {
     const currentLevel = CONFIG.BROADCAST_MESSAGE.LEVEL