Alex Maras
7 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
11 additions and
8 deletions
-
src/invidious/frontend/watch_page.cr
-
src/invidious/routes/watch.cr
|
|
|
@ -23,10 +23,16 @@ module Invidious::Frontend::WatchPage |
|
|
|
return "<p id=\"download\">#{translate(locale, "Download is disabled")}</p>" |
|
|
|
end |
|
|
|
|
|
|
|
url = "/download" |
|
|
|
if (CONFIG.invidious_companion.present?) |
|
|
|
invidious_companion = CONFIG.invidious_companion.sample |
|
|
|
url = "#{invidious_companion.public_url}/download?check=#{invidious_companion_encrypt(video.id)}" |
|
|
|
end |
|
|
|
|
|
|
|
return String.build(4000) do |str| |
|
|
|
str << "<form" |
|
|
|
str << " class=\"pure-form pure-form-stacked\"" |
|
|
|
str << " action='/download'" |
|
|
|
str << " action='#{url}'" |
|
|
|
str << " method='post'" |
|
|
|
str << " rel='noopener'" |
|
|
|
str << " target='_blank'>" |
|
|
|
|
|
|
|
@ -293,6 +293,9 @@ module Invidious::Routes::Watch |
|
|
|
if CONFIG.disabled?("downloads") |
|
|
|
return error_template(403, "Administrator has disabled this endpoint.") |
|
|
|
end |
|
|
|
if CONFIG.invidious_companion.present? |
|
|
|
return error_template(403, "Downloads should be routed through Companion when present") |
|
|
|
end |
|
|
|
|
|
|
|
title = env.params.body["title"]? || "" |
|
|
|
video_id = env.params.body["id"]? || "" |
|
|
|
@ -328,13 +331,7 @@ module Invidious::Routes::Watch |
|
|
|
env.params.query["title"] = filename |
|
|
|
env.params.query["local"] = "true" |
|
|
|
|
|
|
|
if (CONFIG.invidious_companion.present?) |
|
|
|
video = get_video(video_id) |
|
|
|
invidious_companion = CONFIG.invidious_companion.sample |
|
|
|
return env.redirect "#{invidious_companion.public_url}/latest_version?#{env.params.query}" |
|
|
|
else |
|
|
|
return Invidious::Routes::VideoPlayback.latest_version(env) |
|
|
|
end |
|
|
|
return Invidious::Routes::VideoPlayback.latest_version(env) |
|
|
|
else |
|
|
|
return error_template(400, "Invalid label or itag") |
|
|
|
end |
|
|
|
|