API: make /api/v1/videos respect the 'local' parameter

This commit is contained in:
Samantaz Fox
2023-01-15 17:04:04 +01:00
parent 05258d56bd
commit 1af846e58c
5 changed files with 36 additions and 11 deletions

View File

@@ -91,14 +91,8 @@ module Invidious::Routes::VideoPlayback
env.response.headers["Access-Control-Allow-Origin"] = "*"
if location = resp.headers["Location"]?
location = URI.parse(location)
location = "#{location.request_target}&host=#{location.host}"
if region
location += "&region=#{region}"
end
return env.redirect location
url = Invidious::HttpServer::Utils.proxy_video_url(location, region: region)
return env.redirect url
end
IO.copy(resp.body_io, env.response)