best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
api/stream: move bsky override into isHlsResponse
jjbf4675a5e37f
diff --git a/api/src/stream/internal-hls.js b/api/src/stream/internal-hls.jsindex 55634c71..61f3d361 100644--- a/api/src/stream/internal-hls.js+++ b/api/src/stream/internal-hls.js@@ -55,8 +55,11 @@ function transformMediaPlaylist(streamInfo, hlsPlaylist) {const HLS_MIME_TYPES = ["application/vnd.apple.mpegurl", "audio/mpegurl", "application/x-mpegURL"];-export function isHlsResponse (req) {- return HLS_MIME_TYPES.includes(req.headers['content-type']);+export function isHlsResponse(req, streamInfo) {+ return HLS_MIME_TYPES.includes(req.headers['content-type'])+ // bluesky's cdn responds with wrong content-type for the hls playlist,+ // so we enforce it here until they fix it+ || (streamInfo.service === 'bsky' && streamInfo.url.endsWith('.m3u8'));}export async function handleHlsPlaylist(streamInfo, req, res) {diff --git a/api/src/stream/internal.js b/api/src/stream/internal.jsindex 7d8bf4c9..c32a3692 100644--- a/api/src/stream/internal.js+++ b/api/src/stream/internal.js@@ -96,10 +96,7 @@ async function handleGenericStream(streamInfo, res) {res.status(fileResponse.statusCode);fileResponse.body.on('error', () => {});- // bluesky's cdn responds with wrong content-type for the hls playlist,- // so we enforce it here until they fix it- const isHls = isHlsResponse(fileResponse)- || (streamInfo.service === "bsky" && streamInfo.url.endsWith('.m3u8'));+ const isHls = isHlsResponse(fileResponse, streamInfo);for (const [ name, value ] of Object.entries(fileResponse.headers)) {if (!isHls || name.toLowerCase() !== 'content-length') {