mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-23 08:40:03 +05:30
Clean up /videoplayback
This commit is contained in:
parent
77b12b6249
commit
41a04e7c67
@ -2659,6 +2659,12 @@ get "/videoplayback" do |env|
|
|||||||
client = make_client(URI.parse(host))
|
client = make_client(URI.parse(host))
|
||||||
response = client.head(url)
|
response = client.head(url)
|
||||||
|
|
||||||
|
if response.headers["Location"]?
|
||||||
|
url = URI.parse(response.headers["Location"])
|
||||||
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
|
next env.redirect url.full_path
|
||||||
|
end
|
||||||
|
|
||||||
headers = env.request.headers
|
headers = env.request.headers
|
||||||
headers.delete("Host")
|
headers.delete("Host")
|
||||||
headers.delete("Cookie")
|
headers.delete("Cookie")
|
||||||
@ -2666,11 +2672,6 @@ get "/videoplayback" do |env|
|
|||||||
headers.delete("Referer")
|
headers.delete("Referer")
|
||||||
|
|
||||||
client.get(url, headers) do |response|
|
client.get(url, headers) do |response|
|
||||||
if response.headers["Location"]?
|
|
||||||
url = URI.parse(response.headers["Location"])
|
|
||||||
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
|
||||||
env.redirect url.full_path
|
|
||||||
else
|
|
||||||
env.response.status_code = response.status_code
|
env.response.status_code = response.status_code
|
||||||
|
|
||||||
response.headers.each do |key, value|
|
response.headers.each do |key, value|
|
||||||
@ -2692,7 +2693,6 @@ get "/videoplayback" do |env|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
error 404 do |env|
|
error 404 do |env|
|
||||||
error_message = "404 Page not found"
|
error_message = "404 Page not found"
|
||||||
|
Loading…
Reference in New Issue
Block a user