Compare commits

...

3 Commits

Author SHA1 Message Date
Émilien (perso)
575aac5dd2
Merge 7a070fa710 into 9892604758 2024-11-18 11:30:46 +00:00
Emilien
7a070fa710 invidious companion always used so always add CSP and redirect latest_version 2024-11-18 12:30:37 +01:00
Emilien
1f51edd0b9 fix linting 2024-11-18 12:22:40 +01:00
4 changed files with 6 additions and 6 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -684,8 +684,8 @@ module YoutubeAPI
data : Hash
) : Hash(String, JSON::Any)
headers = HTTP::Headers{
"Content-Type" => "application/json; charset=UTF-8",
"Authorization" => "Bearer " + CONFIG.invidious_companion_key,
"Content-Type" => "application/json; charset=UTF-8",
"Authorization" => "Bearer " + CONFIG.invidious_companion_key,
}
# Logging