diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-12 16:09:02 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-10-24 14:48:24 +0200 |
commit | 3545e72c686ff1725bbdfd8d16d693e2f4aa75a3 (patch) | |
tree | e7f1d12ef5dae1e1142c3a8d0b681c1dbbb0de10 /server/controllers | |
parent | 38a3ccc7f8ad0ea94362b58c732af7c387ab46be (diff) | |
download | PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.gz PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.zst PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.zip |
Put private videos under a specific subdirectory
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/server/debug.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/token.ts | 33 | ||||
-rw-r--r-- | server/controllers/api/videos/update.ts | 76 | ||||
-rw-r--r-- | server/controllers/download.ts | 4 | ||||
-rw-r--r-- | server/controllers/static.ts | 31 |
6 files changed, 86 insertions, 62 deletions
diff --git a/server/controllers/api/server/debug.ts b/server/controllers/api/server/debug.ts index 4e5333782..f3792bfc8 100644 --- a/server/controllers/api/server/debug.ts +++ b/server/controllers/api/server/debug.ts | |||
@@ -8,6 +8,7 @@ import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | |||
8 | import { UserRight } from '../../../../shared/models/users' | 8 | import { UserRight } from '../../../../shared/models/users' |
9 | import { authenticate, ensureUserHasRight } from '../../../middlewares' | 9 | import { authenticate, ensureUserHasRight } from '../../../middlewares' |
10 | import { VideoChannelSyncLatestScheduler } from '@server/lib/schedulers/video-channel-sync-latest-scheduler' | 10 | import { VideoChannelSyncLatestScheduler } from '@server/lib/schedulers/video-channel-sync-latest-scheduler' |
11 | import { UpdateVideosScheduler } from '@server/lib/schedulers/update-videos-scheduler' | ||
11 | 12 | ||
12 | const debugRouter = express.Router() | 13 | const debugRouter = express.Router() |
13 | 14 | ||
@@ -45,6 +46,7 @@ async function runCommand (req: express.Request, res: express.Response) { | |||
45 | 'remove-dandling-resumable-uploads': () => RemoveDanglingResumableUploadsScheduler.Instance.execute(), | 46 | 'remove-dandling-resumable-uploads': () => RemoveDanglingResumableUploadsScheduler.Instance.execute(), |
46 | 'process-video-views-buffer': () => VideoViewsBufferScheduler.Instance.execute(), | 47 | 'process-video-views-buffer': () => VideoViewsBufferScheduler.Instance.execute(), |
47 | 'process-video-viewers': () => VideoViewsManager.Instance.processViewerStats(), | 48 | 'process-video-viewers': () => VideoViewsManager.Instance.processViewerStats(), |
49 | 'process-update-videos-scheduler': () => UpdateVideosScheduler.Instance.execute(), | ||
48 | 'process-video-channel-sync-latest': () => VideoChannelSyncLatestScheduler.Instance.execute() | 50 | 'process-video-channel-sync-latest': () => VideoChannelSyncLatestScheduler.Instance.execute() |
49 | } | 51 | } |
50 | 52 | ||
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index b301515df..ea081e5ab 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -41,6 +41,7 @@ import { ownershipVideoRouter } from './ownership' | |||
41 | import { rateVideoRouter } from './rate' | 41 | import { rateVideoRouter } from './rate' |
42 | import { statsRouter } from './stats' | 42 | import { statsRouter } from './stats' |
43 | import { studioRouter } from './studio' | 43 | import { studioRouter } from './studio' |
44 | import { tokenRouter } from './token' | ||
44 | import { transcodingRouter } from './transcoding' | 45 | import { transcodingRouter } from './transcoding' |
45 | import { updateRouter } from './update' | 46 | import { updateRouter } from './update' |
46 | import { uploadRouter } from './upload' | 47 | import { uploadRouter } from './upload' |
@@ -63,6 +64,7 @@ videosRouter.use('/', uploadRouter) | |||
63 | videosRouter.use('/', updateRouter) | 64 | videosRouter.use('/', updateRouter) |
64 | videosRouter.use('/', filesRouter) | 65 | videosRouter.use('/', filesRouter) |
65 | videosRouter.use('/', transcodingRouter) | 66 | videosRouter.use('/', transcodingRouter) |
67 | videosRouter.use('/', tokenRouter) | ||
66 | 68 | ||
67 | videosRouter.get('/categories', | 69 | videosRouter.get('/categories', |
68 | openapiOperationDoc({ operationId: 'getCategories' }), | 70 | openapiOperationDoc({ operationId: 'getCategories' }), |
diff --git a/server/controllers/api/videos/token.ts b/server/controllers/api/videos/token.ts new file mode 100644 index 000000000..009b6dfb6 --- /dev/null +++ b/server/controllers/api/videos/token.ts | |||
@@ -0,0 +1,33 @@ | |||
1 | import express from 'express' | ||
2 | import { VideoTokensManager } from '@server/lib/video-tokens-manager' | ||
3 | import { VideoToken } from '@shared/models' | ||
4 | import { asyncMiddleware, authenticate, videosCustomGetValidator } from '../../../middlewares' | ||
5 | |||
6 | const tokenRouter = express.Router() | ||
7 | |||
8 | tokenRouter.post('/:id/token', | ||
9 | authenticate, | ||
10 | asyncMiddleware(videosCustomGetValidator('only-video')), | ||
11 | generateToken | ||
12 | ) | ||
13 | |||
14 | // --------------------------------------------------------------------------- | ||
15 | |||
16 | export { | ||
17 | tokenRouter | ||
18 | } | ||
19 | |||
20 | // --------------------------------------------------------------------------- | ||
21 | |||
22 | function generateToken (req: express.Request, res: express.Response) { | ||
23 | const video = res.locals.onlyVideo | ||
24 | |||
25 | const { token, expires } = VideoTokensManager.Instance.create(video.uuid) | ||
26 | |||
27 | return res.json({ | ||
28 | files: { | ||
29 | token, | ||
30 | expires | ||
31 | } | ||
32 | } as VideoToken) | ||
33 | } | ||
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index ab1a23d9a..0a910379a 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { Transaction } from 'sequelize/types' | 2 | import { Transaction } from 'sequelize/types' |
3 | import { changeVideoChannelShare } from '@server/lib/activitypub/share' | 3 | import { changeVideoChannelShare } from '@server/lib/activitypub/share' |
4 | import { CreateJobArgument, JobQueue } from '@server/lib/job-queue' | 4 | import { addVideoJobsAfterUpdate, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' |
5 | import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' | 5 | import { setVideoPrivacy } from '@server/lib/video-privacy' |
6 | import { openapiOperationDoc } from '@server/middlewares/doc' | 6 | import { openapiOperationDoc } from '@server/middlewares/doc' |
7 | import { FilteredModelAttributes } from '@server/types' | 7 | import { FilteredModelAttributes } from '@server/types' |
8 | import { MVideoFullLight } from '@server/types/models' | 8 | import { MVideoFullLight } from '@server/types/models' |
9 | import { HttpStatusCode, ManageVideoTorrentPayload, VideoUpdate } from '@shared/models' | 9 | import { HttpStatusCode, VideoUpdate } from '@shared/models' |
10 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | 10 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' |
11 | import { resetSequelizeInstance } from '../../../helpers/database-utils' | 11 | import { resetSequelizeInstance } from '../../../helpers/database-utils' |
12 | import { createReqFiles } from '../../../helpers/express-utils' | 12 | import { createReqFiles } from '../../../helpers/express-utils' |
@@ -18,6 +18,7 @@ import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' | |||
18 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares' | 18 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares' |
19 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | 19 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' |
20 | import { VideoModel } from '../../../models/video/video' | 20 | import { VideoModel } from '../../../models/video/video' |
21 | import { VideoPathManager } from '@server/lib/video-path-manager' | ||
21 | 22 | ||
22 | const lTags = loggerTagsFactory('api', 'video') | 23 | const lTags = loggerTagsFactory('api', 'video') |
23 | const auditLogger = auditLoggerFactory('videos') | 24 | const auditLogger = auditLoggerFactory('videos') |
@@ -47,8 +48,8 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
47 | const oldVideoAuditView = new VideoAuditView(videoFromReq.toFormattedDetailsJSON()) | 48 | const oldVideoAuditView = new VideoAuditView(videoFromReq.toFormattedDetailsJSON()) |
48 | const videoInfoToUpdate: VideoUpdate = req.body | 49 | const videoInfoToUpdate: VideoUpdate = req.body |
49 | 50 | ||
50 | const wasConfidentialVideo = videoFromReq.isConfidential() | ||
51 | const hadPrivacyForFederation = videoFromReq.hasPrivacyForFederation() | 51 | const hadPrivacyForFederation = videoFromReq.hasPrivacyForFederation() |
52 | const oldPrivacy = videoFromReq.privacy | ||
52 | 53 | ||
53 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ | 54 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ |
54 | video: videoFromReq, | 55 | video: videoFromReq, |
@@ -57,12 +58,13 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
57 | automaticallyGenerated: false | 58 | automaticallyGenerated: false |
58 | }) | 59 | }) |
59 | 60 | ||
61 | const videoFileLockReleaser = await VideoPathManager.Instance.lockFiles(videoFromReq.uuid) | ||
62 | |||
60 | try { | 63 | try { |
61 | const { videoInstanceUpdated, isNewVideo } = await sequelizeTypescript.transaction(async t => { | 64 | const { videoInstanceUpdated, isNewVideo } = await sequelizeTypescript.transaction(async t => { |
62 | // Refresh video since thumbnails to prevent concurrent updates | 65 | // Refresh video since thumbnails to prevent concurrent updates |
63 | const video = await VideoModel.loadFull(videoFromReq.id, t) | 66 | const video = await VideoModel.loadFull(videoFromReq.id, t) |
64 | 67 | ||
65 | const sequelizeOptions = { transaction: t } | ||
66 | const oldVideoChannel = video.VideoChannel | 68 | const oldVideoChannel = video.VideoChannel |
67 | 69 | ||
68 | const keysToUpdate: (keyof VideoUpdate & FilteredModelAttributes<VideoModel>)[] = [ | 70 | const keysToUpdate: (keyof VideoUpdate & FilteredModelAttributes<VideoModel>)[] = [ |
@@ -97,7 +99,7 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
97 | await video.setAsRefreshed(t) | 99 | await video.setAsRefreshed(t) |
98 | } | 100 | } |
99 | 101 | ||
100 | const videoInstanceUpdated = await video.save(sequelizeOptions) as MVideoFullLight | 102 | const videoInstanceUpdated = await video.save({ transaction: t }) as MVideoFullLight |
101 | 103 | ||
102 | // Thumbnail & preview updates? | 104 | // Thumbnail & preview updates? |
103 | if (thumbnailModel) await videoInstanceUpdated.addAndSaveThumbnail(thumbnailModel, t) | 105 | if (thumbnailModel) await videoInstanceUpdated.addAndSaveThumbnail(thumbnailModel, t) |
@@ -113,7 +115,9 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
113 | await videoInstanceUpdated.$set('VideoChannel', res.locals.videoChannel, { transaction: t }) | 115 | await videoInstanceUpdated.$set('VideoChannel', res.locals.videoChannel, { transaction: t }) |
114 | videoInstanceUpdated.VideoChannel = res.locals.videoChannel | 116 | videoInstanceUpdated.VideoChannel = res.locals.videoChannel |
115 | 117 | ||
116 | if (hadPrivacyForFederation === true) await changeVideoChannelShare(videoInstanceUpdated, oldVideoChannel, t) | 118 | if (hadPrivacyForFederation === true) { |
119 | await changeVideoChannelShare(videoInstanceUpdated, oldVideoChannel, t) | ||
120 | } | ||
117 | } | 121 | } |
118 | 122 | ||
119 | // Schedule an update in the future? | 123 | // Schedule an update in the future? |
@@ -139,7 +143,12 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
139 | 143 | ||
140 | Hooks.runAction('action:api.video.updated', { video: videoInstanceUpdated, body: req.body, req, res }) | 144 | Hooks.runAction('action:api.video.updated', { video: videoInstanceUpdated, body: req.body, req, res }) |
141 | 145 | ||
142 | await addVideoJobsAfterUpdate({ video: videoInstanceUpdated, videoInfoToUpdate, wasConfidentialVideo, isNewVideo }) | 146 | await addVideoJobsAfterUpdate({ |
147 | video: videoInstanceUpdated, | ||
148 | nameChanged: !!videoInfoToUpdate.name, | ||
149 | oldPrivacy, | ||
150 | isNewVideo | ||
151 | }) | ||
143 | } catch (err) { | 152 | } catch (err) { |
144 | // Force fields we want to update | 153 | // Force fields we want to update |
145 | // If the transaction is retried, sequelize will think the object has not changed | 154 | // If the transaction is retried, sequelize will think the object has not changed |
@@ -147,6 +156,8 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
147 | resetSequelizeInstance(videoFromReq, videoFieldsSave) | 156 | resetSequelizeInstance(videoFromReq, videoFieldsSave) |
148 | 157 | ||
149 | throw err | 158 | throw err |
159 | } finally { | ||
160 | videoFileLockReleaser() | ||
150 | } | 161 | } |
151 | 162 | ||
152 | return res.type('json') | 163 | return res.type('json') |
@@ -164,7 +175,7 @@ async function updateVideoPrivacy (options: { | |||
164 | const isNewVideo = videoInstance.isNewVideo(videoInfoToUpdate.privacy) | 175 | const isNewVideo = videoInstance.isNewVideo(videoInfoToUpdate.privacy) |
165 | 176 | ||
166 | const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10) | 177 | const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10) |
167 | videoInstance.setPrivacy(newPrivacy) | 178 | setVideoPrivacy(videoInstance, newPrivacy) |
168 | 179 | ||
169 | // Unfederate the video if the new privacy is not compatible with federation | 180 | // Unfederate the video if the new privacy is not compatible with federation |
170 | if (hadPrivacyForFederation && !videoInstance.hasPrivacyForFederation()) { | 181 | if (hadPrivacyForFederation && !videoInstance.hasPrivacyForFederation()) { |
@@ -185,50 +196,3 @@ function updateSchedule (videoInstance: MVideoFullLight, videoInfoToUpdate: Vide | |||
185 | return ScheduleVideoUpdateModel.deleteByVideoId(videoInstance.id, transaction) | 196 | return ScheduleVideoUpdateModel.deleteByVideoId(videoInstance.id, transaction) |
186 | } | 197 | } |
187 | } | 198 | } |
188 | |||
189 | async function addVideoJobsAfterUpdate (options: { | ||
190 | video: MVideoFullLight | ||
191 | videoInfoToUpdate: VideoUpdate | ||
192 | wasConfidentialVideo: boolean | ||
193 | isNewVideo: boolean | ||
194 | }) { | ||
195 | const { video, videoInfoToUpdate, wasConfidentialVideo, isNewVideo } = options | ||
196 | const jobs: CreateJobArgument[] = [] | ||
197 | |||
198 | if (!video.isLive && videoInfoToUpdate.name) { | ||
199 | |||
200 | for (const file of (video.VideoFiles || [])) { | ||
201 | const payload: ManageVideoTorrentPayload = { action: 'update-metadata', videoId: video.id, videoFileId: file.id } | ||
202 | |||
203 | jobs.push({ type: 'manage-video-torrent', payload }) | ||
204 | } | ||
205 | |||
206 | const hls = video.getHLSPlaylist() | ||
207 | |||
208 | for (const file of (hls?.VideoFiles || [])) { | ||
209 | const payload: ManageVideoTorrentPayload = { action: 'update-metadata', streamingPlaylistId: hls.id, videoFileId: file.id } | ||
210 | |||
211 | jobs.push({ type: 'manage-video-torrent', payload }) | ||
212 | } | ||
213 | } | ||
214 | |||
215 | jobs.push({ | ||
216 | type: 'federate-video', | ||
217 | payload: { | ||
218 | videoUUID: video.uuid, | ||
219 | isNewVideo | ||
220 | } | ||
221 | }) | ||
222 | |||
223 | if (wasConfidentialVideo) { | ||
224 | jobs.push({ | ||
225 | type: 'notify', | ||
226 | payload: { | ||
227 | action: 'new-video', | ||
228 | videoUUID: video.uuid | ||
229 | } | ||
230 | }) | ||
231 | } | ||
232 | |||
233 | return JobQueue.Instance.createSequentialJobFlow(...jobs) | ||
234 | } | ||
diff --git a/server/controllers/download.ts b/server/controllers/download.ts index a270180c0..abd1df26f 100644 --- a/server/controllers/download.ts +++ b/server/controllers/download.ts | |||
@@ -7,7 +7,7 @@ import { VideoPathManager } from '@server/lib/video-path-manager' | |||
7 | import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' | 7 | import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' |
8 | import { HttpStatusCode, VideoStorage, VideoStreamingPlaylistType } from '@shared/models' | 8 | import { HttpStatusCode, VideoStorage, VideoStreamingPlaylistType } from '@shared/models' |
9 | import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants' | 9 | import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants' |
10 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' | 10 | import { asyncMiddleware, optionalAuthenticate, videosDownloadValidator } from '../middlewares' |
11 | 11 | ||
12 | const downloadRouter = express.Router() | 12 | const downloadRouter = express.Router() |
13 | 13 | ||
@@ -20,12 +20,14 @@ downloadRouter.use( | |||
20 | 20 | ||
21 | downloadRouter.use( | 21 | downloadRouter.use( |
22 | STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension', | 22 | STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension', |
23 | optionalAuthenticate, | ||
23 | asyncMiddleware(videosDownloadValidator), | 24 | asyncMiddleware(videosDownloadValidator), |
24 | asyncMiddleware(downloadVideoFile) | 25 | asyncMiddleware(downloadVideoFile) |
25 | ) | 26 | ) |
26 | 27 | ||
27 | downloadRouter.use( | 28 | downloadRouter.use( |
28 | STATIC_DOWNLOAD_PATHS.HLS_VIDEOS + ':id-:resolution([0-9]+)-fragmented.:extension', | 29 | STATIC_DOWNLOAD_PATHS.HLS_VIDEOS + ':id-:resolution([0-9]+)-fragmented.:extension', |
30 | optionalAuthenticate, | ||
29 | asyncMiddleware(videosDownloadValidator), | 31 | asyncMiddleware(videosDownloadValidator), |
30 | asyncMiddleware(downloadHLSVideoFile) | 32 | asyncMiddleware(downloadHLSVideoFile) |
31 | ) | 33 | ) |
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 33c429eb1..dc091455a 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,20 +1,34 @@ | |||
1 | import cors from 'cors' | 1 | import cors from 'cors' |
2 | import express from 'express' | 2 | import express from 'express' |
3 | import { handleStaticError } from '@server/middlewares' | 3 | import { |
4 | asyncMiddleware, | ||
5 | ensureCanAccessPrivateVideoHLSFiles, | ||
6 | ensureCanAccessVideoPrivateWebTorrentFiles, | ||
7 | handleStaticError, | ||
8 | optionalAuthenticate | ||
9 | } from '@server/middlewares' | ||
4 | import { CONFIG } from '../initializers/config' | 10 | import { CONFIG } from '../initializers/config' |
5 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants' | 11 | import { DIRECTORIES, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants' |
6 | 12 | ||
7 | const staticRouter = express.Router() | 13 | const staticRouter = express.Router() |
8 | 14 | ||
9 | // Cors is very important to let other servers access torrent and video files | 15 | // Cors is very important to let other servers access torrent and video files |
10 | staticRouter.use(cors()) | 16 | staticRouter.use(cors()) |
11 | 17 | ||
12 | // Videos path for webseed | 18 | // WebTorrent/Classic videos |
19 | staticRouter.use( | ||
20 | STATIC_PATHS.PRIVATE_WEBSEED, | ||
21 | optionalAuthenticate, | ||
22 | asyncMiddleware(ensureCanAccessVideoPrivateWebTorrentFiles), | ||
23 | express.static(DIRECTORIES.VIDEOS.PRIVATE, { fallthrough: false }), | ||
24 | handleStaticError | ||
25 | ) | ||
13 | staticRouter.use( | 26 | staticRouter.use( |
14 | STATIC_PATHS.WEBSEED, | 27 | STATIC_PATHS.WEBSEED, |
15 | express.static(CONFIG.STORAGE.VIDEOS_DIR, { fallthrough: false }), | 28 | express.static(DIRECTORIES.VIDEOS.PUBLIC, { fallthrough: false }), |
16 | handleStaticError | 29 | handleStaticError |
17 | ) | 30 | ) |
31 | |||
18 | staticRouter.use( | 32 | staticRouter.use( |
19 | STATIC_PATHS.REDUNDANCY, | 33 | STATIC_PATHS.REDUNDANCY, |
20 | express.static(CONFIG.STORAGE.REDUNDANCY_DIR, { fallthrough: false }), | 34 | express.static(CONFIG.STORAGE.REDUNDANCY_DIR, { fallthrough: false }), |
@@ -23,8 +37,15 @@ staticRouter.use( | |||
23 | 37 | ||
24 | // HLS | 38 | // HLS |
25 | staticRouter.use( | 39 | staticRouter.use( |
40 | STATIC_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS, | ||
41 | optionalAuthenticate, | ||
42 | asyncMiddleware(ensureCanAccessPrivateVideoHLSFiles), | ||
43 | express.static(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, { fallthrough: false }), | ||
44 | handleStaticError | ||
45 | ) | ||
46 | staticRouter.use( | ||
26 | STATIC_PATHS.STREAMING_PLAYLISTS.HLS, | 47 | STATIC_PATHS.STREAMING_PLAYLISTS.HLS, |
27 | express.static(HLS_STREAMING_PLAYLIST_DIRECTORY, { fallthrough: false }), | 48 | express.static(DIRECTORIES.HLS_STREAMING_PLAYLIST.PUBLIC, { fallthrough: false }), |
28 | handleStaticError | 49 | handleStaticError |
29 | ) | 50 | ) |
30 | 51 | ||