invidious companion always used so always add CSP and redirect latest_version

This commit is contained in:
Emilien 2024-11-18 12:30:37 +01:00
parent 1f51edd0b9
commit 7a070fa710
3 changed files with 4 additions and 4 deletions

View File

@ -201,7 +201,7 @@ module Invidious::Routes::Embed
return env.redirect url return env.redirect url
end end
if (!CONFIG.invidious_companion.empty? && (preferences.local || preferences.quality == "dash")) if (!CONFIG.invidious_companion.empty?)
env.response.headers["Content-Security-Policy"] = env.response.headers["Content-Security-Policy"] =
env.response.headers["Content-Security-Policy"] env.response.headers["Content-Security-Policy"]
.gsub("media-src", "media-src " + video.invidious_companion.not_nil!["baseUrl"].as_s) .gsub("media-src", "media-src " + video.invidious_companion.not_nil!["baseUrl"].as_s)

View File

@ -190,7 +190,7 @@ module Invidious::Routes::Watch
captions: video.captions captions: video.captions
) )
if (!CONFIG.invidious_companion.empty? && (preferences.local || preferences.quality == "dash")) if (!CONFIG.invidious_companion.empty?)
env.response.headers["Content-Security-Policy"] = env.response.headers["Content-Security-Policy"] =
env.response.headers["Content-Security-Policy"] env.response.headers["Content-Security-Policy"]
.gsub("media-src", "media-src " + video.invidious_companion.not_nil!["baseUrl"].as_s) .gsub("media-src", "media-src " + video.invidious_companion.not_nil!["baseUrl"].as_s)

View File

@ -22,7 +22,7 @@
audio_streams.each_with_index do |fmt, i| audio_streams.each_with_index do |fmt, i|
src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}" src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}"
src_url += "&local=true" if params.local src_url += "&local=true" if params.local
src_url = video.invidious_companion.not_nil!["baseUrl"].as_s + src_url if (!CONFIG.invidious_companion.empty? && params.local) src_url = video.invidious_companion.not_nil!["baseUrl"].as_s + src_url if (!CONFIG.invidious_companion.empty?)
bitrate = fmt["bitrate"] bitrate = fmt["bitrate"]
mimetype = HTML.escape(fmt["mimeType"].as_s) mimetype = HTML.escape(fmt["mimeType"].as_s)
@ -48,7 +48,7 @@
fmt_stream.each_with_index do |fmt, i| fmt_stream.each_with_index do |fmt, i|
src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}" src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}"
src_url += "&local=true" if params.local src_url += "&local=true" if params.local
src_url = video.invidious_companion.not_nil!["baseUrl"].as_s + src_url if (!CONFIG.invidious_companion.empty? && params.local) src_url = video.invidious_companion.not_nil!["baseUrl"].as_s + src_url if (!CONFIG.invidious_companion.empty?)
quality = fmt["quality"] quality = fmt["quality"]
mimetype = HTML.escape(fmt["mimeType"].as_s) mimetype = HTML.escape(fmt["mimeType"].as_s)