feat: add support for AllTube download links

Introduce an optional feature to generate download links using AllTube if the alltube_url configuration is set. This provides users with an alternative download method, enhancing the functionality and offering more flexibility.

Ensures compatibility with existing download disabling configuration.
This commit is contained in:
Kumi 2024-09-18 17:05:37 +02:00
parent 4d2b8e9d15
commit dd662ff77b
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -19,6 +19,10 @@ 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) : String
if CONFIG.alltube_url
return "<a href=\"#{CONFIG.alltube_url}#{env.request.resource}\" target=\"_blank\">#{translate(locale, "Download with AllTube")}</a>"
end
if CONFIG.disabled?("downloads") if CONFIG.disabled?("downloads")
return "<p id=\"download\">#{translate(locale, "Download is disabled")}</p>" return "<p id=\"download\">#{translate(locale, "Download is disabled")}</p>"
end end