diff options
author | Wicklow <wicklow@framasoft.org> | 2023-03-07 10:52:20 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-03-07 11:16:56 +0100 |
commit | 73fb3dc53571a6e94750a9d6cb5c2e949e1adcb9 (patch) | |
tree | f86cfe5b29a999bcbc10562e918df33429b468b4 /server/controllers/static.ts | |
parent | a3e5f7e732cca41267314d64307bdcfebd12e7de (diff) | |
download | PeerTube-73fb3dc53571a6e94750a9d6cb5c2e949e1adcb9.tar.gz PeerTube-73fb3dc53571a6e94750a9d6cb5c2e949e1adcb9.tar.zst PeerTube-73fb3dc53571a6e94750a9d6cb5c2e949e1adcb9.zip |
Fix file token reinjection on fragments
Diffstat (limited to 'server/controllers/static.ts')
-rw-r--r-- | server/controllers/static.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 52e48267f..9baff94c0 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -90,6 +90,7 @@ export { | |||
90 | 90 | ||
91 | async function servePrivateM3U8 (req: express.Request, res: express.Response) { | 91 | async function servePrivateM3U8 (req: express.Request, res: express.Response) { |
92 | const path = join(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, req.params.videoUUID, req.params.playlistName + '.m3u8') | 92 | const path = join(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, req.params.videoUUID, req.params.playlistName + '.m3u8') |
93 | const filename = req.params.playlistName + '.m3u8' | ||
93 | 94 | ||
94 | let playlistContent: string | 95 | let playlistContent: string |
95 | 96 | ||
@@ -108,7 +109,7 @@ async function servePrivateM3U8 (req: express.Request, res: express.Response) { | |||
108 | 109 | ||
109 | // Inject token in playlist so players that cannot alter the HTTP request can still watch the video | 110 | // Inject token in playlist so players that cannot alter the HTTP request can still watch the video |
110 | const transformedContent = doReinjectVideoFileToken(req) | 111 | const transformedContent = doReinjectVideoFileToken(req) |
111 | ? injectQueryToPlaylistUrls(playlistContent, buildReinjectVideoFileTokenQuery(req)) | 112 | ? injectQueryToPlaylistUrls(playlistContent, buildReinjectVideoFileTokenQuery(req, filename.endsWith('master.m3u8'))) |
112 | : playlistContent | 113 | : playlistContent |
113 | 114 | ||
114 | return res.set('content-type', 'application/vnd.apple.mpegurl').send(transformedContent).end() | 115 | return res.set('content-type', 'application/vnd.apple.mpegurl').send(transformedContent).end() |