mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2026-01-31 07:16:27 +00:00
feat(routes): redirect to the backend selected at the time of downloading
This commit is contained in:
@@ -18,14 +18,15 @@ module Invidious::Frontend::WatchPage
|
||||
end
|
||||
end
|
||||
|
||||
def download_widget(locale : String, video : Video, video_assets : VideoAssets) : String
|
||||
def download_widget(locale : String, video : Video, video_assets : VideoAssets, env : HTTP::Server::Context) : String
|
||||
if CONFIG.disabled?("downloads")
|
||||
return "<p id=\"download\">#{translate(locale, "Download is disabled")}</p>"
|
||||
end
|
||||
|
||||
url = "/download"
|
||||
if (CONFIG.invidious_companion.present?)
|
||||
invidious_companion = CONFIG.invidious_companion.sample
|
||||
current_companion = env.get("current_companion").as(Int32)
|
||||
invidious_companion = CONFIG.invidious_companion[current_companion]
|
||||
url = "#{invidious_companion.public_url}/download?check=#{invidious_companion_encrypt(video.id)}"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user