aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker-after-init.ts7
-rw-r--r--server/initializers/config.ts3
-rw-r--r--server/initializers/constants.ts5
-rw-r--r--server/initializers/migrations/0065-video-file-size.ts3
-rw-r--r--server/initializers/migrations/0450-streaming-playlist-files.ts40
5 files changed, 55 insertions, 3 deletions
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts
index db3115085..9fefba769 100644
--- a/server/initializers/checker-after-init.ts
+++ b/server/initializers/checker-after-init.ts
@@ -101,6 +101,13 @@ function checkConfig () {
101 } 101 }
102 } 102 }
103 103
104 // Transcoding
105 if (CONFIG.TRANSCODING.ENABLED) {
106 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false && CONFIG.TRANSCODING.HLS.ENABLED === false) {
107 return 'You need to enable at least WebTorrent transcoding or HLS transcoding.'
108 }
109 }
110
104 return null 111 return null
105} 112}
106 113
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 164d714d6..6d5d55487 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -177,6 +177,9 @@ const CONFIG = {
177 }, 177 },
178 HLS: { 178 HLS: {
179 get ENABLED () { return config.get<boolean>('transcoding.hls.enabled') } 179 get ENABLED () { return config.get<boolean>('transcoding.hls.enabled') }
180 },
181 WEBTORRENT: {
182 get ENABLED () { return config.get<boolean>('transcoding.webtorrent.enabled') }
180 } 183 }
181 }, 184 },
182 IMPORT: { 185 IMPORT: {
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index fd4c0fdaa..eaad84bee 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
14 14
15// --------------------------------------------------------------------------- 15// ---------------------------------------------------------------------------
16 16
17const LAST_MIGRATION_VERSION = 445 17const LAST_MIGRATION_VERSION = 450
18 18
19// --------------------------------------------------------------------------- 19// ---------------------------------------------------------------------------
20 20
@@ -505,7 +505,8 @@ const STATIC_PATHS = {
505} 505}
506const STATIC_DOWNLOAD_PATHS = { 506const STATIC_DOWNLOAD_PATHS = {
507 TORRENTS: '/download/torrents/', 507 TORRENTS: '/download/torrents/',
508 VIDEOS: '/download/videos/' 508 VIDEOS: '/download/videos/',
509 HLS_VIDEOS: '/download/streaming-playlists/hls/videos/'
509} 510}
510const LAZY_STATIC_PATHS = { 511const LAZY_STATIC_PATHS = {
511 AVATARS: '/lazy-static/avatars/', 512 AVATARS: '/lazy-static/avatars/',
diff --git a/server/initializers/migrations/0065-video-file-size.ts b/server/initializers/migrations/0065-video-file-size.ts
index 66f25016a..e9ce77e50 100644
--- a/server/initializers/migrations/0065-video-file-size.ts
+++ b/server/initializers/migrations/0065-video-file-size.ts
@@ -2,6 +2,7 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { stat } from 'fs-extra' 3import { stat } from 'fs-extra'
4import { VideoModel } from '../../models/video/video' 4import { VideoModel } from '../../models/video/video'
5import { getVideoFilePath } from '@server/lib/video-paths'
5 6
6function up (utils: { 7function up (utils: {
7 transaction: Sequelize.Transaction, 8 transaction: Sequelize.Transaction,
@@ -16,7 +17,7 @@ function up (utils: {
16 videos.forEach(video => { 17 videos.forEach(video => {
17 video.VideoFiles.forEach(videoFile => { 18 video.VideoFiles.forEach(videoFile => {
18 const p = new Promise((res, rej) => { 19 const p = new Promise((res, rej) => {
19 stat(video.getVideoFilePath(videoFile), (err, stats) => { 20 stat(getVideoFilePath(video, videoFile), (err, stats) => {
20 if (err) return rej(err) 21 if (err) return rej(err)
21 22
22 videoFile.size = stats.size 23 videoFile.size = stats.size
diff --git a/server/initializers/migrations/0450-streaming-playlist-files.ts b/server/initializers/migrations/0450-streaming-playlist-files.ts
new file mode 100644
index 000000000..536ef00f9
--- /dev/null
+++ b/server/initializers/migrations/0450-streaming-playlist-files.ts
@@ -0,0 +1,40 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction,
5 queryInterface: Sequelize.QueryInterface,
6 sequelize: Sequelize.Sequelize,
7 db: any
8}): Promise<void> {
9 {
10 const data = {
11 type: Sequelize.INTEGER,
12 allowNull: true,
13 references: {
14 model: 'videoStreamingPlaylist',
15 key: 'id'
16 },
17 onDelete: 'CASCADE'
18 }
19
20 await utils.queryInterface.addColumn('videoFile', 'videoStreamingPlaylistId', data)
21 }
22
23 {
24 const data = {
25 type: Sequelize.INTEGER,
26 allowNull: true
27 }
28
29 await utils.queryInterface.changeColumn('videoFile', 'videoId', data)
30 }
31}
32
33function down (options) {
34 throw new Error('Not implemented.')
35}
36
37export {
38 up,
39 down
40}