mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Merge branch 'release/7.1.0' into develop
This commit is contained in:
commit
ccb3fd4ab7
30 changed files with 384 additions and 157 deletions
|
@ -5,7 +5,9 @@ import {
|
|||
ensureCanAccessPrivateVideoHLSFiles,
|
||||
ensureCanAccessVideoPrivateWebVideoFiles,
|
||||
handleStaticError,
|
||||
optionalAuthenticate
|
||||
optionalAuthenticate,
|
||||
privateHLSFileValidator,
|
||||
privateM3U8PlaylistValidator
|
||||
} from '@server/middlewares/index.js'
|
||||
import cors from 'cors'
|
||||
import express from 'express'
|
||||
|
@ -55,17 +57,20 @@ const privateHLSStaticMiddlewares = CONFIG.STATIC_FILES.PRIVATE_FILES_REQUIRE_AU
|
|||
: []
|
||||
|
||||
staticRouter.use(
|
||||
STATIC_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + ':videoUUID/:playlistName.m3u8',
|
||||
STATIC_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + ':videoUUID/:playlistNameWithoutExtension([a-z0-9-]+).m3u8',
|
||||
privateM3U8PlaylistValidator,
|
||||
...privateHLSStaticMiddlewares,
|
||||
asyncMiddleware(servePrivateM3U8)
|
||||
)
|
||||
|
||||
staticRouter.use(
|
||||
STATIC_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS,
|
||||
STATIC_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + ':videoUUID/:filename',
|
||||
privateHLSFileValidator,
|
||||
...privateHLSStaticMiddlewares,
|
||||
express.static(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, { fallthrough: false }),
|
||||
handleStaticError
|
||||
servePrivateHLSFile
|
||||
)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
staticRouter.use(
|
||||
STATIC_PATHS.STREAMING_PLAYLISTS.HLS,
|
||||
express.static(DIRECTORIES.HLS_STREAMING_PLAYLIST.PUBLIC, { fallthrough: false }),
|
||||
|
@ -80,9 +85,15 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function servePrivateHLSFile (req: express.Request, res: express.Response) {
|
||||
const path = join(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, req.params.videoUUID, req.params.filename)
|
||||
|
||||
return res.sendFile(path)
|
||||
}
|
||||
|
||||
async function servePrivateM3U8 (req: express.Request, res: express.Response) {
|
||||
const path = join(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, req.params.videoUUID, req.params.playlistName + '.m3u8')
|
||||
const filename = req.params.playlistName + '.m3u8'
|
||||
const path = join(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, req.params.videoUUID, req.params.playlistNameWithoutExtension + '.m3u8')
|
||||
const filename = req.params.playlistNameWithoutExtension + '.m3u8'
|
||||
|
||||
let playlistContent: string
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue