diff options
author | Chocobozzz <me@florianbigard.com> | 2022-12-02 14:47:21 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-12-02 15:25:20 +0100 |
commit | 71e3e879c0616882ee82a0e44f8c2e5ee9698a3e (patch) | |
tree | 14452d26d240eb6d44178b76fc2dabda4cfc9428 /server/lib/hls.ts | |
parent | 04509c43254dc232c61681ac4bb98e09fd126115 (diff) | |
download | PeerTube-71e3e879c0616882ee82a0e44f8c2e5ee9698a3e.tar.gz PeerTube-71e3e879c0616882ee82a0e44f8c2e5ee9698a3e.tar.zst PeerTube-71e3e879c0616882ee82a0e44f8c2e5ee9698a3e.zip |
Support reinjecting token in private m3u8 playlist
Diffstat (limited to 'server/lib/hls.ts')
-rw-r--r-- | server/lib/hls.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/lib/hls.ts b/server/lib/hls.ts index a41f1ae48..053b5d326 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts | |||
@@ -234,13 +234,20 @@ function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, | |||
234 | 234 | ||
235 | // --------------------------------------------------------------------------- | 235 | // --------------------------------------------------------------------------- |
236 | 236 | ||
237 | function injectQueryToPlaylistUrls (content: string, queryString: string) { | ||
238 | return content.replace(/\.(m3u8|ts|mp4)/gm, '.$1?' + queryString) | ||
239 | } | ||
240 | |||
241 | // --------------------------------------------------------------------------- | ||
242 | |||
237 | export { | 243 | export { |
238 | updateMasterHLSPlaylist, | 244 | updateMasterHLSPlaylist, |
239 | updateSha256VODSegments, | 245 | updateSha256VODSegments, |
240 | buildSha256Segment, | 246 | buildSha256Segment, |
241 | downloadPlaylistSegments, | 247 | downloadPlaylistSegments, |
242 | updateStreamingPlaylistsInfohashesIfNeeded, | 248 | updateStreamingPlaylistsInfohashesIfNeeded, |
243 | updatePlaylistAfterFileChange | 249 | updatePlaylistAfterFileChange, |
250 | injectQueryToPlaylistUrls | ||
244 | } | 251 | } |
245 | 252 | ||
246 | // --------------------------------------------------------------------------- | 253 | // --------------------------------------------------------------------------- |