File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,16 @@ module Invidious::Frontend::WatchPage
2323 return " <p id=\" download\" >#{ translate(locale, " Download is disabled" ) } </p>"
2424 end
2525
26+ url = " /download"
27+ if (CONFIG .invidious_companion.present?)
28+ invidious_companion = CONFIG .invidious_companion.sample
29+ url = " #{ invidious_companion.public_url } /download?check=#{ invidious_companion_encrypt(video.id) } "
30+ end
31+
2632 return String .build(4000 ) do |str |
2733 str << " <form"
2834 str << " class=\" pure-form pure-form-stacked\" "
29- str << " action='/download '"
35+ str << " action='#{ url } '"
3036 str << " method='post'"
3137 str << " rel='noopener'"
3238 str << " target='_blank'>"
Original file line number Diff line number Diff line change @@ -293,6 +293,9 @@ module Invidious::Routes::Watch
293293 if CONFIG .disabled?(" downloads" )
294294 return error_template(403 , " Administrator has disabled this endpoint." )
295295 end
296+ if CONFIG .invidious_companion.present?
297+ return error_template(403 , " Downloads should be routed through Companion when present" )
298+ end
296299
297300 title = env.params.body[" title" ]? || " "
298301 video_id = env.params.body[" id" ]? || " "
@@ -328,13 +331,7 @@ module Invidious::Routes::Watch
328331 env.params.query[" title" ] = filename
329332 env.params.query[" local" ] = " true"
330333
331- if (CONFIG .invidious_companion.present?)
332- video = get_video(video_id)
333- invidious_companion = CONFIG .invidious_companion.sample
334- return env.redirect " #{ invidious_companion.public_url } /latest_version?#{ env.params.query } "
335- else
336- return Invidious ::Routes ::VideoPlayback .latest_version(env)
337- end
334+ return Invidious ::Routes ::VideoPlayback .latest_version(env)
338335 else
339336 return error_template(400 , " Invalid label or itag" )
340337 end
You can’t perform that action at this time.
0 commit comments