From 04cacfee5eaa9cea6977172c24c5d1ef4308414e Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sun, 21 Apr 2024 12:31:28 +0200 Subject: [PATCH] Fix proxying live DASH streams --- src/invidious/routes/video_playback.cr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/invidious/routes/video_playback.cr b/src/invidious/routes/video_playback.cr index ec18f3b8..9779f48a 100644 --- a/src/invidious/routes/video_playback.cr +++ b/src/invidious/routes/video_playback.cr @@ -21,7 +21,7 @@ module Invidious::Routes::VideoPlayback end # Sanity check, to avoid being used as an open proxy - if !host.matches?(/[\w-]+.googlevideo.com/) + if !host.matches?(/[\w-]+\.(?:googlevideo|c\.youtube)\.com/) return error_template(400, "Invalid \"host\" parameter.") end @@ -37,7 +37,8 @@ module Invidious::Routes::VideoPlayback # See: https://github.com/iv-org/invidious/issues/3302 range_header = env.request.headers["Range"]? - if range_header.nil? + sq = query_params["sq"]? + if range_header.nil? && sq.nil? range_for_head = query_params["range"]? || "0-640" headers["Range"] = "bytes=#{range_for_head}" end