diff --git a/src/invidious/routes/embed.cr b/src/invidious/routes/embed.cr index 23f2bbe1..df697001 100644 --- a/src/invidious/routes/embed.cr +++ b/src/invidious/routes/embed.cr @@ -201,7 +201,7 @@ module Invidious::Routes::Embed return env.redirect url 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"] .gsub("media-src", "media-src " + video.invidious_companion.not_nil!["baseUrl"].as_s) diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 740a15b2..b42ee12d 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -190,7 +190,7 @@ module Invidious::Routes::Watch 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"] .gsub("media-src", "media-src " + video.invidious_companion.not_nil!["baseUrl"].as_s) diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr index 59f43239..46c00137 100644 --- a/src/invidious/views/components/player.ecr +++ b/src/invidious/views/components/player.ecr @@ -22,7 +22,7 @@ audio_streams.each_with_index do |fmt, i| src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}" 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"] mimetype = HTML.escape(fmt["mimeType"].as_s) @@ -48,7 +48,7 @@ fmt_stream.each_with_index do |fmt, i| src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}" 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"] mimetype = HTML.escape(fmt["mimeType"].as_s)