mirror of
https://github.com/iv-org/invidious.git
synced 2025-12-20 19:50:24 +00:00
Remove JS from download widget
This commit is contained in:
@@ -3904,12 +3904,20 @@ end
|
||||
# YouTube /videoplayback links expire after 6 hours,
|
||||
# so we have a mechanism here to redirect to the latest version
|
||||
get "/latest_version" do |env|
|
||||
id = env.params.query["id"]?
|
||||
itag = env.params.query["itag"]?
|
||||
if env.params.query["download_widget"]?
|
||||
download_widget = JSON.parse(env.params.query["download_widget"])
|
||||
id = download_widget["id"].as_s
|
||||
itag = download_widget["itag"].as_s
|
||||
title = download_widget["title"].as_s
|
||||
local = "true"
|
||||
end
|
||||
|
||||
id ||= env.params.query["id"]?
|
||||
itag ||= env.params.query["itag"]?
|
||||
|
||||
region = env.params.query["region"]?
|
||||
|
||||
local = env.params.query["local"]?
|
||||
local ||= env.params.query["local"]?
|
||||
local ||= "false"
|
||||
local = local == "true"
|
||||
|
||||
@@ -3934,6 +3942,10 @@ get "/latest_version" do |env|
|
||||
url = URI.parse(url).full_path.not_nil!
|
||||
end
|
||||
|
||||
if title
|
||||
url += "&title=#{title}"
|
||||
end
|
||||
|
||||
env.redirect url
|
||||
end
|
||||
|
||||
@@ -4038,6 +4050,10 @@ get "/videoplayback" do |env|
|
||||
client.get(url, headers) do |response|
|
||||
env.response.status_code = response.status_code
|
||||
|
||||
if title = env.params.query["title"]?
|
||||
env.response.headers["Content-Disposition"] = "attachment; filename=#{title}"
|
||||
end
|
||||
|
||||
response.headers.each do |key, value|
|
||||
env.response.headers[key] = value
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user