diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/activitypub/client.ts | 2 | ||||
-rw-r--r-- | server/controllers/static.ts | 13 | ||||
-rw-r--r-- | server/initializers/checker-before-init.ts | 2 | ||||
-rw-r--r-- | server/initializers/constants.ts | 10 | ||||
-rw-r--r-- | server/initializers/installer.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/url.ts | 2 | ||||
-rw-r--r-- | server/lib/hls.ts | 6 | ||||
-rw-r--r-- | server/lib/video-transcoding.ts | 6 | ||||
-rw-r--r-- | server/models/video/video-streaming-playlist.ts | 6 | ||||
-rw-r--r-- | server/models/video/video.ts | 4 |
10 files changed, 31 insertions, 24 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index f616047b0..0d1dff96f 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -124,7 +124,7 @@ activityPubClientRouter.get('/redundancy/videos/:videoId/:resolution([0-9]+)(-:f | |||
124 | executeIfActivityPub(asyncMiddleware(videoFileRedundancyGetValidator)), | 124 | executeIfActivityPub(asyncMiddleware(videoFileRedundancyGetValidator)), |
125 | executeIfActivityPub(asyncMiddleware(videoRedundancyController)) | 125 | executeIfActivityPub(asyncMiddleware(videoRedundancyController)) |
126 | ) | 126 | ) |
127 | activityPubClientRouter.get('/redundancy/video-playlists/:streamingPlaylistType/:videoId', | 127 | activityPubClientRouter.get('/redundancy/streaming-playlists/:streamingPlaylistType/:videoId', |
128 | executeIfActivityPub(asyncMiddleware(videoPlaylistRedundancyGetValidator)), | 128 | executeIfActivityPub(asyncMiddleware(videoPlaylistRedundancyGetValidator)), |
129 | executeIfActivityPub(asyncMiddleware(videoRedundancyController)) | 129 | executeIfActivityPub(asyncMiddleware(videoRedundancyController)) |
130 | ) | 130 | ) |
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index b21f9da00..639445b74 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,6 +1,13 @@ | |||
1 | import * as cors from 'cors' | 1 | import * as cors from 'cors' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { CONFIG, HLS_PLAYLIST_DIRECTORY, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' | 3 | import { |
4 | CONFIG, | ||
5 | HLS_STREAMING_PLAYLIST_DIRECTORY, | ||
6 | ROUTE_CACHE_LIFETIME, | ||
7 | STATIC_DOWNLOAD_PATHS, | ||
8 | STATIC_MAX_AGE, | ||
9 | STATIC_PATHS | ||
10 | } from '../initializers' | ||
4 | import { VideosPreviewCache } from '../lib/cache' | 11 | import { VideosPreviewCache } from '../lib/cache' |
5 | import { cacheRoute } from '../middlewares/cache' | 12 | import { cacheRoute } from '../middlewares/cache' |
6 | import { asyncMiddleware, videosGetValidator } from '../middlewares' | 13 | import { asyncMiddleware, videosGetValidator } from '../middlewares' |
@@ -53,9 +60,9 @@ staticRouter.use( | |||
53 | 60 | ||
54 | // HLS | 61 | // HLS |
55 | staticRouter.use( | 62 | staticRouter.use( |
56 | STATIC_PATHS.PLAYLISTS.HLS, | 63 | STATIC_PATHS.STREAMING_PLAYLISTS.HLS, |
57 | cors(), | 64 | cors(), |
58 | express.static(HLS_PLAYLIST_DIRECTORY, { fallthrough: false }) // 404 if the file does not exist | 65 | express.static(HLS_STREAMING_PLAYLIST_DIRECTORY, { fallthrough: false }) // 404 if the file does not exist |
59 | ) | 66 | ) |
60 | 67 | ||
61 | // Thumbnails path for express | 68 | // Thumbnails path for express |
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index 2567d957b..3e1d2c589 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -12,7 +12,7 @@ function checkMissedConfig () { | |||
12 | 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 'database.pool.max', | 12 | 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 'database.pool.max', |
13 | 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', | 13 | 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', |
14 | 'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache', | 14 | 'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache', |
15 | 'storage.redundancy', 'storage.tmp', 'storage.playlists', | 15 | 'storage.redundancy', 'storage.tmp', 'storage.streaming_playlists', |
16 | 'log.level', | 16 | 'log.level', |
17 | 'user.video_quota', 'user.video_quota_daily', | 17 | 'user.video_quota', 'user.video_quota_daily', |
18 | 'csp.enabled', 'csp.report_only', 'csp.report_uri', | 18 | 'csp.enabled', 'csp.report_only', 'csp.report_uri', |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 59c30fdee..cabb0681a 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -196,7 +196,7 @@ const CONFIG = { | |||
196 | AVATARS_DIR: buildPath(config.get<string>('storage.avatars')), | 196 | AVATARS_DIR: buildPath(config.get<string>('storage.avatars')), |
197 | LOG_DIR: buildPath(config.get<string>('storage.logs')), | 197 | LOG_DIR: buildPath(config.get<string>('storage.logs')), |
198 | VIDEOS_DIR: buildPath(config.get<string>('storage.videos')), | 198 | VIDEOS_DIR: buildPath(config.get<string>('storage.videos')), |
199 | PLAYLISTS_DIR: buildPath(config.get<string>('storage.playlists')), | 199 | STREAMING_PLAYLISTS_DIR: buildPath(config.get<string>('storage.streaming_playlists')), |
200 | REDUNDANCY_DIR: buildPath(config.get<string>('storage.redundancy')), | 200 | REDUNDANCY_DIR: buildPath(config.get<string>('storage.redundancy')), |
201 | THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')), | 201 | THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')), |
202 | PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')), | 202 | PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')), |
@@ -625,8 +625,8 @@ const STATIC_PATHS = { | |||
625 | TORRENTS: '/static/torrents/', | 625 | TORRENTS: '/static/torrents/', |
626 | WEBSEED: '/static/webseed/', | 626 | WEBSEED: '/static/webseed/', |
627 | REDUNDANCY: '/static/redundancy/', | 627 | REDUNDANCY: '/static/redundancy/', |
628 | PLAYLISTS: { | 628 | STREAMING_PLAYLISTS: { |
629 | HLS: '/static/playlists/hls' | 629 | HLS: '/static/streaming-playlists/hls' |
630 | }, | 630 | }, |
631 | AVATARS: '/static/avatars/', | 631 | AVATARS: '/static/avatars/', |
632 | VIDEO_CAPTIONS: '/static/video-captions/' | 632 | VIDEO_CAPTIONS: '/static/video-captions/' |
@@ -670,7 +670,7 @@ const CACHE = { | |||
670 | } | 670 | } |
671 | } | 671 | } |
672 | 672 | ||
673 | const HLS_PLAYLIST_DIRECTORY = join(CONFIG.STORAGE.PLAYLISTS_DIR, 'hls') | 673 | const HLS_STREAMING_PLAYLIST_DIRECTORY = join(CONFIG.STORAGE.STREAMING_PLAYLISTS_DIR, 'hls') |
674 | const HLS_REDUNDANCY_DIRECTORY = join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls') | 674 | const HLS_REDUNDANCY_DIRECTORY = join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls') |
675 | 675 | ||
676 | const MEMOIZE_TTL = { | 676 | const MEMOIZE_TTL = { |
@@ -777,7 +777,7 @@ export { | |||
777 | PRIVATE_RSA_KEY_SIZE, | 777 | PRIVATE_RSA_KEY_SIZE, |
778 | ROUTE_CACHE_LIFETIME, | 778 | ROUTE_CACHE_LIFETIME, |
779 | SORTABLE_COLUMNS, | 779 | SORTABLE_COLUMNS, |
780 | HLS_PLAYLIST_DIRECTORY, | 780 | HLS_STREAMING_PLAYLIST_DIRECTORY, |
781 | FEEDS, | 781 | FEEDS, |
782 | JOB_TTL, | 782 | JOB_TTL, |
783 | NSFW_POLICY_TYPES, | 783 | NSFW_POLICY_TYPES, |
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index c669606f8..349d7afb7 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -6,7 +6,7 @@ import { UserModel } from '../models/account/user' | |||
6 | import { ApplicationModel } from '../models/application/application' | 6 | import { ApplicationModel } from '../models/application/application' |
7 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 7 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
8 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' | 8 | import { applicationExist, clientsExist, usersExist } from './checker-after-init' |
9 | import { CACHE, CONFIG, HLS_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' | 9 | import { CACHE, CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' |
10 | import { sequelizeTypescript } from './database' | 10 | import { sequelizeTypescript } from './database' |
11 | import { remove, ensureDir } from 'fs-extra' | 11 | import { remove, ensureDir } from 'fs-extra' |
12 | 12 | ||
@@ -74,7 +74,7 @@ function createDirectoriesIfNotExist () { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | // Playlist directories | 76 | // Playlist directories |
77 | tasks.push(ensureDir(HLS_PLAYLIST_DIRECTORY)) | 77 | tasks.push(ensureDir(HLS_STREAMING_PLAYLIST_DIRECTORY)) |
78 | 78 | ||
79 | return Promise.all(tasks) | 79 | return Promise.all(tasks) |
80 | } | 80 | } |
diff --git a/server/lib/activitypub/url.ts b/server/lib/activitypub/url.ts index c80b09436..7c2ee5bc6 100644 --- a/server/lib/activitypub/url.ts +++ b/server/lib/activitypub/url.ts | |||
@@ -27,7 +27,7 @@ function getVideoCacheFileActivityPubUrl (videoFile: VideoFileModel) { | |||
27 | } | 27 | } |
28 | 28 | ||
29 | function getVideoCacheStreamingPlaylistActivityPubUrl (video: VideoModel, playlist: VideoStreamingPlaylistModel) { | 29 | function getVideoCacheStreamingPlaylistActivityPubUrl (video: VideoModel, playlist: VideoStreamingPlaylistModel) { |
30 | return `${CONFIG.WEBSERVER.URL}/redundancy/video-playlists/${playlist.getStringType()}/${video.uuid}` | 30 | return `${CONFIG.WEBSERVER.URL}/redundancy/streaming-playlists/${playlist.getStringType()}/${video.uuid}` |
31 | } | 31 | } |
32 | 32 | ||
33 | function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) { | 33 | function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) { |
diff --git a/server/lib/hls.ts b/server/lib/hls.ts index 16a805ac2..74ed25183 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoModel } from '../models/video/video' | 1 | import { VideoModel } from '../models/video/video' |
2 | import { basename, join, dirname } from 'path' | 2 | import { basename, join, dirname } from 'path' |
3 | import { CONFIG, HLS_PLAYLIST_DIRECTORY } from '../initializers' | 3 | import { CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY } from '../initializers' |
4 | import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra' | 4 | import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra' |
5 | import { getVideoFileSize } from '../helpers/ffmpeg-utils' | 5 | import { getVideoFileSize } from '../helpers/ffmpeg-utils' |
6 | import { sha256 } from '../helpers/core-utils' | 6 | import { sha256 } from '../helpers/core-utils' |
@@ -11,7 +11,7 @@ import { generateRandomString } from '../helpers/utils' | |||
11 | import { flatten, uniq } from 'lodash' | 11 | import { flatten, uniq } from 'lodash' |
12 | 12 | ||
13 | async function updateMasterHLSPlaylist (video: VideoModel) { | 13 | async function updateMasterHLSPlaylist (video: VideoModel) { |
14 | const directory = join(HLS_PLAYLIST_DIRECTORY, video.uuid) | 14 | const directory = join(HLS_STREAMING_PLAYLIST_DIRECTORY, video.uuid) |
15 | const masterPlaylists: string[] = [ '#EXTM3U', '#EXT-X-VERSION:3' ] | 15 | const masterPlaylists: string[] = [ '#EXTM3U', '#EXT-X-VERSION:3' ] |
16 | const masterPlaylistPath = join(directory, VideoStreamingPlaylistModel.getMasterHlsPlaylistFilename()) | 16 | const masterPlaylistPath = join(directory, VideoStreamingPlaylistModel.getMasterHlsPlaylistFilename()) |
17 | 17 | ||
@@ -40,7 +40,7 @@ async function updateMasterHLSPlaylist (video: VideoModel) { | |||
40 | async function updateSha256Segments (video: VideoModel) { | 40 | async function updateSha256Segments (video: VideoModel) { |
41 | const json: { [filename: string]: { [range: string]: string } } = {} | 41 | const json: { [filename: string]: { [range: string]: string } } = {} |
42 | 42 | ||
43 | const playlistDirectory = join(HLS_PLAYLIST_DIRECTORY, video.uuid) | 43 | const playlistDirectory = join(HLS_STREAMING_PLAYLIST_DIRECTORY, video.uuid) |
44 | 44 | ||
45 | // For all the resolutions available for this video | 45 | // For all the resolutions available for this video |
46 | for (const file of video.VideoFiles) { | 46 | for (const file of video.VideoFiles) { |
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index 086b860a2..e932c0e55 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { CONFIG, HLS_PLAYLIST_DIRECTORY } from '../initializers' | 1 | import { CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY } from '../initializers' |
2 | import { extname, join } from 'path' | 2 | import { extname, join } from 'path' |
3 | import { getVideoFileFPS, getVideoFileResolution, transcode } from '../helpers/ffmpeg-utils' | 3 | import { getVideoFileFPS, getVideoFileResolution, transcode } from '../helpers/ffmpeg-utils' |
4 | import { copy, ensureDir, move, remove, stat } from 'fs-extra' | 4 | import { copy, ensureDir, move, remove, stat } from 'fs-extra' |
@@ -89,8 +89,8 @@ async function transcodeOriginalVideofile (video: VideoModel, resolution: VideoR | |||
89 | } | 89 | } |
90 | 90 | ||
91 | async function generateHlsPlaylist (video: VideoModel, resolution: VideoResolution, isPortraitMode: boolean) { | 91 | async function generateHlsPlaylist (video: VideoModel, resolution: VideoResolution, isPortraitMode: boolean) { |
92 | const baseHlsDirectory = join(HLS_PLAYLIST_DIRECTORY, video.uuid) | 92 | const baseHlsDirectory = join(HLS_STREAMING_PLAYLIST_DIRECTORY, video.uuid) |
93 | await ensureDir(join(HLS_PLAYLIST_DIRECTORY, video.uuid)) | 93 | await ensureDir(join(HLS_STREAMING_PLAYLIST_DIRECTORY, video.uuid)) |
94 | 94 | ||
95 | const videoInputPath = join(CONFIG.STORAGE.VIDEOS_DIR, video.getVideoFilename(video.getOriginalFile())) | 95 | const videoInputPath = join(CONFIG.STORAGE.VIDEOS_DIR, video.getVideoFilename(video.getOriginalFile())) |
96 | const outputPath = join(baseHlsDirectory, VideoStreamingPlaylistModel.getHlsPlaylistFilename(resolution)) | 96 | const outputPath = join(baseHlsDirectory, VideoStreamingPlaylistModel.getHlsPlaylistFilename(resolution)) |
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts index e489f9b0e..b147aca36 100644 --- a/server/models/video/video-streaming-playlist.ts +++ b/server/models/video/video-streaming-playlist.ts | |||
@@ -130,15 +130,15 @@ export class VideoStreamingPlaylistModel extends Model<VideoStreamingPlaylistMod | |||
130 | } | 130 | } |
131 | 131 | ||
132 | static getHlsMasterPlaylistStaticPath (videoUUID: string) { | 132 | static getHlsMasterPlaylistStaticPath (videoUUID: string) { |
133 | return join(STATIC_PATHS.PLAYLISTS.HLS, videoUUID, VideoStreamingPlaylistModel.getMasterHlsPlaylistFilename()) | 133 | return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, VideoStreamingPlaylistModel.getMasterHlsPlaylistFilename()) |
134 | } | 134 | } |
135 | 135 | ||
136 | static getHlsPlaylistStaticPath (videoUUID: string, resolution: number) { | 136 | static getHlsPlaylistStaticPath (videoUUID: string, resolution: number) { |
137 | return join(STATIC_PATHS.PLAYLISTS.HLS, videoUUID, VideoStreamingPlaylistModel.getHlsPlaylistFilename(resolution)) | 137 | return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, VideoStreamingPlaylistModel.getHlsPlaylistFilename(resolution)) |
138 | } | 138 | } |
139 | 139 | ||
140 | static getHlsSha256SegmentsStaticPath (videoUUID: string) { | 140 | static getHlsSha256SegmentsStaticPath (videoUUID: string) { |
141 | return join(STATIC_PATHS.PLAYLISTS.HLS, videoUUID, VideoStreamingPlaylistModel.getHlsSha256SegmentsFilename()) | 141 | return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, VideoStreamingPlaylistModel.getHlsSha256SegmentsFilename()) |
142 | } | 142 | } |
143 | 143 | ||
144 | getStringType () { | 144 | getStringType () { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index a563f78ef..06c63e87c 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -53,7 +53,7 @@ import { | |||
53 | API_VERSION, | 53 | API_VERSION, |
54 | CONFIG, | 54 | CONFIG, |
55 | CONSTRAINTS_FIELDS, | 55 | CONSTRAINTS_FIELDS, |
56 | HLS_PLAYLIST_DIRECTORY, | 56 | HLS_STREAMING_PLAYLIST_DIRECTORY, |
57 | HLS_REDUNDANCY_DIRECTORY, | 57 | HLS_REDUNDANCY_DIRECTORY, |
58 | PREVIEWS_SIZE, | 58 | PREVIEWS_SIZE, |
59 | REMOTE_SCHEME, | 59 | REMOTE_SCHEME, |
@@ -1751,7 +1751,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1751 | } | 1751 | } |
1752 | 1752 | ||
1753 | removeStreamingPlaylist (isRedundancy = false) { | 1753 | removeStreamingPlaylist (isRedundancy = false) { |
1754 | const baseDir = isRedundancy ? HLS_REDUNDANCY_DIRECTORY : HLS_PLAYLIST_DIRECTORY | 1754 | const baseDir = isRedundancy ? HLS_REDUNDANCY_DIRECTORY : HLS_STREAMING_PLAYLIST_DIRECTORY |
1755 | 1755 | ||
1756 | const filePath = join(baseDir, this.uuid) | 1756 | const filePath = join(baseDir, this.uuid) |
1757 | return remove(filePath) | 1757 | return remove(filePath) |